1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix gcp utils dict replace (#51426)

* fix reference before assignment of new_item if item is plain string

* fix KeyError if managed_zone is plain string
This commit is contained in:
bverschueren 2019-01-29 21:52:31 +01:00 committed by ansibot
parent 1f9ad3bf50
commit 369076a1a4
2 changed files with 2 additions and 2 deletions

View file

@ -69,7 +69,7 @@ def replace_resource_dict(item, value):
new_item = ast.literal_eval(item)
return replace_resource_dict(new_item, value)
except ValueError:
return new_item
return item
# Handles all authentication and HTTP sessions for GCP API calls.

View file

@ -376,7 +376,7 @@ def prefetch_soa_resource(module):
result = fetch_wrapped_resource(resource, 'dns#resourceRecordSet', 'dns#resourceRecordSetsListResponse', 'rrsets')
if not result:
raise ValueError("Google DNS Managed Zone %s not found" % module.params['managed_zone']['name'])
raise ValueError("Google DNS Managed Zone %s not found" % replace_resource_dict(module.params['managed_zone'], 'name'))
return result