From 7c550a76a52cdd6b2243cdd80121438c57dcd703 Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Tue, 25 Jan 2022 11:06:20 -0500 Subject: [PATCH] Make sure to filter out control-plane nodes in inspect_execution_nodes Also, make sure that the cluster host doesn't get marked as lost by this machinery. --- awx/main/tasks/system.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/awx/main/tasks/system.py b/awx/main/tasks/system.py index c14ac8d7d9..43ac6c2b26 100644 --- a/awx/main/tasks/system.py +++ b/awx/main/tasks/system.py @@ -437,12 +437,17 @@ def inspect_execution_nodes(instance_list): for ad in workers: hostname = ad['NodeID'] changed = False + if hostname in node_lookup: instance = node_lookup[hostname] else: logger.warn(f"Unrecognized node advertising on mesh: {hostname}") continue + # Control-plane nodes are dealt with via local_health_check instead. + if instance.node_type in ('control', 'hybrid'): + continue + was_lost = instance.is_lost(ref_time=nowtime) last_seen = parse_date(ad['Time']) @@ -451,8 +456,8 @@ def inspect_execution_nodes(instance_list): instance.last_seen = last_seen instance.save(update_fields=['last_seen']) - # Make sure that hop nodes don't fall through and have the execution_node_health_check task applied - if not any(cmd['WorkType'] == 'ansible-runner' for cmd in ad['WorkCommands'] or []): + # Only execution nodes should be dealt with by execution_node_health_check + if instance.node_type == 'hop': continue if changed: @@ -492,6 +497,8 @@ def cluster_node_heartbeat(): inspect_execution_nodes(instance_list) for inst in list(instance_list): + if inst == this_inst: + continue if inst.is_lost(ref_time=nowtime): lost_instances.append(inst) instance_list.remove(inst)