mirror of
https://github.com/ansible/awx.git
synced 2026-02-27 07:56:06 -03:30
Adjust register_queue command to not allow hop nodes to be added
This commit is contained in:
@@ -53,14 +53,14 @@ class RegisterQueue:
|
|||||||
def add_instances_to_group(self, ig):
|
def add_instances_to_group(self, ig):
|
||||||
changed = False
|
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 = []
|
instances = []
|
||||||
for inst_name in instance_list_unique:
|
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():
|
if instance.exists():
|
||||||
instances.append(instance[0])
|
instances.append(instance[0])
|
||||||
else:
|
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)
|
ig.instances.add(*instances)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user