From 3fc63489f16c0585134bdabd0a2090e5f0329c71 Mon Sep 17 00:00:00 2001 From: Alan Rominger Date: Fri, 24 Sep 2021 23:01:32 -0400 Subject: [PATCH] Filter controller_node selection to online nodes (#11120) --- awx/main/models/ha.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/awx/main/models/ha.py b/awx/main/models/ha.py index d2686708e5..9b49f77e40 100644 --- a/awx/main/models/ha.py +++ b/awx/main/models/ha.py @@ -151,7 +151,9 @@ class Instance(HasPolicyEditsMixin, BaseModel): @staticmethod def choose_online_control_plane_node(): - return random.choice(Instance.objects.filter(enabled=True).filter(node_type__in=['control', 'hybrid']).values_list('hostname', flat=True)) + return random.choice( + Instance.objects.filter(enabled=True, capacity__gt=0).filter(node_type__in=['control', 'hybrid']).values_list('hostname', flat=True) + ) def is_lost(self, ref_time=None): if self.last_seen is None: