From a17eedd9fe0eabc416a61fbf6bd10bb85e0b410c Mon Sep 17 00:00:00 2001 From: sean-m-sullivan Date: Tue, 1 Sep 2020 23:08:15 -0500 Subject: [PATCH] update to not use organizations --- .../plugins/modules/tower_job_template.py | 13 +++++++------ .../plugins/modules/tower_workflow_job_template.py | 13 +++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/awx_collection/plugins/modules/tower_job_template.py b/awx_collection/plugins/modules/tower_job_template.py index d1638d7981..dd149ec742 100644 --- a/awx_collection/plugins/modules/tower_job_template.py +++ b/awx_collection/plugins/modules/tower_job_template.py @@ -479,13 +479,14 @@ def main(): labels = module.params.get('labels') if labels is not None: association_fields['labels'] = [] - for item in labels: - search_fields = {'name': item} - if organization: - search_fields['organization'] = organization_id - label_id = module.get_one('labels', **{'data': search_fields}) - association_fields['labels'].append(label_id) + association_fields['labels'].append(module.resolve_name_to_id('labels', item)) +# Code to use once Issue #7567 is resolved +# search_fields = {'name': item} +# if organization: +# search_fields['organization'] = organization_id +# label_id = module.get_one('labels', **{'data': search_fields}) +# association_fields['labels'].append(label_id) notifications_start = module.params.get('notification_templates_started') if notifications_start is not None: diff --git a/awx_collection/plugins/modules/tower_workflow_job_template.py b/awx_collection/plugins/modules/tower_workflow_job_template.py index 5133f07f7a..54ab6dbf9b 100644 --- a/awx_collection/plugins/modules/tower_workflow_job_template.py +++ b/awx_collection/plugins/modules/tower_workflow_job_template.py @@ -256,13 +256,14 @@ def main(): labels = module.params.get('labels') if labels is not None: association_fields['labels'] = [] - for item in labels: - search_fields = {'name': item} - if organization: - search_fields['organization'] = organization_id - label_id = module.get_one('labels', **{'data': search_fields}) - association_fields['labels'].append(label_id) + association_fields['labels'].append(module.resolve_name_to_id('labels', item)) +# Code to use once Issue #7567 is resolved +# search_fields = {'name': item} +# if organization: +# search_fields['organization'] = organization_id +# label_id = module.get_one('labels', **{'data': search_fields}) +# association_fields['labels'].append(label_id) on_change = None new_spec = module.params.get('survey')