mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 14:57:39 -02:30
use settings.DEFAULT_EXECUTION_QUEUE_NAME in lieu of default
This commit is contained in:
@@ -449,7 +449,7 @@ def inspect_execution_nodes(instance_list):
|
|||||||
else:
|
else:
|
||||||
defaults = dict(enabled=False)
|
defaults = dict(enabled=False)
|
||||||
(changed, instance) = Instance.objects.register(hostname=hostname, node_type='execution', defaults=defaults)
|
(changed, instance) = Instance.objects.register(hostname=hostname, node_type='execution', defaults=defaults)
|
||||||
logger.warn("Registered execution node '{}' (marked disabled by default)".format(hostname))
|
logger.warn(f"Registered execution node '{hostname}' (marked disabled by default)")
|
||||||
|
|
||||||
was_lost = instance.is_lost(ref_time=nowtime)
|
was_lost = instance.is_lost(ref_time=nowtime)
|
||||||
last_seen = parse_date(ad['Time'])
|
last_seen = parse_date(ad['Time'])
|
||||||
@@ -461,15 +461,15 @@ def inspect_execution_nodes(instance_list):
|
|||||||
|
|
||||||
if changed:
|
if changed:
|
||||||
try:
|
try:
|
||||||
default_ig = InstanceGroup.objects.get(name='default')
|
default_ig = InstanceGroup.objects.get(name=settings.DEFAULT_EXECUTION_QUEUE_NAME)
|
||||||
if instance.hostname not in default_ig.policy_instance_list:
|
if instance.hostname not in default_ig.policy_instance_list:
|
||||||
default_ig.policy_instance_list += [instance.hostname]
|
default_ig.policy_instance_list += [instance.hostname]
|
||||||
default_ig.save(update_fields=['policy_instance_list'])
|
default_ig.save(update_fields=['policy_instance_list'])
|
||||||
logger.warn("Updated `default` instance group's policy_instance_list to include execution node '{}'".format(hostname))
|
logger.warn(f"Updated '{default_ig.name}' instance group's policy_instance_list to include execution node '{hostname}'")
|
||||||
else:
|
else:
|
||||||
logger.warn("`default` instance group's policy_instance_list already listed execution node '{}'".format(hostname))
|
logger.warn(f"'{default_ig.name}' instance group's policy_instance_list already listed execution node '{hostname}'")
|
||||||
except InstanceGroup.DoesNotExist:
|
except InstanceGroup.DoesNotExist:
|
||||||
logger.error(f"Unable to add execution node '{hostname}' to 'default' instance group; group not found.")
|
logger.error(f"Unable to add execution node '{hostname}' to '{default_ig.name}' instance group; group not found.")
|
||||||
|
|
||||||
execution_node_health_check.apply_async([hostname])
|
execution_node_health_check.apply_async([hostname])
|
||||||
elif was_lost:
|
elif was_lost:
|
||||||
|
|||||||
Reference in New Issue
Block a user