mirror of
https://github.com/ansible/awx.git
synced 2026-02-25 06:56:00 -03:30
Fix : awx.awx.group preserve hosts fails when there are no hosts (#13913)
Co-authored-by: Sean Sullivan <ssulliva@redhat.com>
This commit is contained in:
@@ -170,9 +170,11 @@ def main():
|
||||
id_list.append(sub_obj['id'])
|
||||
# Preserve existing objects
|
||||
if (preserve_existing_hosts and relationship == 'hosts') or (preserve_existing_children and relationship == 'children'):
|
||||
preserve_existing_check = module.get_all_endpoint(group['related'][relationship])
|
||||
for sub_obj in preserve_existing_check['json']['results']:
|
||||
id_list.append(sub_obj['id'])
|
||||
if group:
|
||||
preserve_existing_check = module.get_all_endpoint(group['related'][relationship])
|
||||
for sub_obj in preserve_existing_check['json']['results']:
|
||||
if 'id' in sub_obj:
|
||||
id_list.append(sub_obj['id'])
|
||||
if id_list:
|
||||
association_fields[relationship] = id_list
|
||||
|
||||
|
||||
Reference in New Issue
Block a user