generate control node receptor.conf

when a new remote execution/hop node is added
regenerate the receptor.conf for all control node to
peer out to the new remote execution node

Signed-off-by: Hao Liu <haoli@redhat.com>
Co-Authored-By: Seth Foster <fosterseth@users.noreply.github.com>
Co-Authored-By: Shane McDonald <me@shanemcd.com>
This commit is contained in:
Shane McDonald
2022-08-01 14:13:59 -04:00
committed by Jeff Bradberry
parent 4bf9925cf7
commit 9b034ad574
10 changed files with 150 additions and 16 deletions

View File

@@ -423,6 +423,13 @@ def on_instance_group_saved(sender, instance, created=False, raw=False, **kwargs
@receiver(post_save, sender=Instance)
def on_instance_saved(sender, instance, created=False, raw=False, **kwargs):
# TODO: handle update to instance
if settings.IS_K8S and created and instance.node_type in ('execution', 'hop'):
from awx.main.tasks.receptor import write_receptor_config # prevents circular import
# on commit broadcast to all control instance to update their receptor configs
connection.on_commit(lambda: write_receptor_config.apply_async(queue='tower_broadcast_all'))
if created or instance.has_policy_changes():
schedule_policy_task()