add search label by org

This commit is contained in:
sean-m-ssullivan
2021-04-28 17:48:57 -05:00
parent ba7b55bfe3
commit 666e9c5c2f
4 changed files with 45 additions and 18 deletions

View File

@@ -544,13 +544,8 @@ def main():
if labels is not None:
association_fields['labels'] = []
for item in labels:
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)
label_id = module.get_one('labels', name_or_id=item, **{'data': search_fields})
association_fields['labels'].append(label_id['id'])
notifications_start = module.params.get('notification_templates_started')
if notifications_start is not None:

View File

@@ -795,13 +795,8 @@ def main():
if labels is not None:
association_fields['labels'] = []
for item in labels:
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)
label_id = module.get_one('labels', name_or_id=item, **{'data': search_fields})
association_fields['labels'].append(label_id['id'])
on_change = None
new_spec = module.params.get('survey_spec')