From fd9c28c960c16f74d0fbbdceb5a3ecf1d9dd7fa9 Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Mon, 24 Jan 2022 17:40:55 -0500 Subject: [PATCH] Adjust register_queue command to not allow hop nodes to be added --- awx/main/management/commands/register_queue.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/awx/main/management/commands/register_queue.py b/awx/main/management/commands/register_queue.py index 8f4c564279..3268dc0ebc 100644 --- a/awx/main/management/commands/register_queue.py +++ b/awx/main/management/commands/register_queue.py @@ -53,14 +53,14 @@ class RegisterQueue: def add_instances_to_group(self, ig): changed = False - instance_list_unique = set([x.strip() for x in self.hostname_list if x]) + instance_list_unique = {x for x in (x.strip() for x in self.hostname_list) if x} instances = [] for inst_name in instance_list_unique: - instance = Instance.objects.filter(hostname=inst_name) + instance = Instance.objects.filter(hostname=inst_name).exclude(node_type='hop') if instance.exists(): instances.append(instance[0]) else: - raise InstanceNotFound("Instance does not exist: {}".format(inst_name), changed) + raise InstanceNotFound("Instance does not exist or cannot run jobs: {}".format(inst_name), changed) ig.instances.add(*instances)