mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 18:07:36 -02:30
Move InstanceLink creation and updating to the async tasks
So that they get applied in situations that do not go through the API.
This commit is contained in:
@@ -427,11 +427,11 @@ def on_instance_group_saved(sender, instance, created=False, raw=False, **kwargs
|
||||
def on_instance_saved(sender, instance, created=False, raw=False, **kwargs):
|
||||
if settings.IS_K8S and instance.node_type in (Instance.Types.EXECUTION,):
|
||||
if instance.node_state == Instance.States.DEPROVISIONING:
|
||||
from awx.main.tasks.receptor import wait_for_jobs # prevents circular import
|
||||
from awx.main.tasks.receptor import remove_deprovisioned_node # prevents circular import
|
||||
|
||||
# wait for jobs on the node to complete, then delete the
|
||||
# node and kick off write_receptor_config
|
||||
connection.on_commit(lambda: wait_for_jobs.apply_async(instance.hostname))
|
||||
connection.on_commit(lambda: remove_deprovisioned_node.apply_async([instance.hostname]))
|
||||
|
||||
if instance.node_state == Instance.States.INSTALLED:
|
||||
from awx.main.tasks.receptor import write_receptor_config # prevents circular import
|
||||
|
||||
Reference in New Issue
Block a user