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
pull/51451/head
bverschueren 6 years ago committed by ansibot
parent 1f9ad3bf50
commit 369076a1a4

@ -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.

@ -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

Loading…
Cancel
Save