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) new_item = ast.literal_eval(item)
return replace_resource_dict(new_item, value) return replace_resource_dict(new_item, value)
except ValueError: except ValueError:
return new_item return item
# Handles all authentication and HTTP sessions for GCP API calls. # 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') result = fetch_wrapped_resource(resource, 'dns#resourceRecordSet', 'dns#resourceRecordSetsListResponse', 'rrsets')
if not result: 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 return result