salt/states/boto_route53.py: fix parsing the deets dictionary #49746
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In case of private hosted zones, the validation fails because the
data format is incompatible with the parsing code.
Example:
deets: {u'VPCs': [{u'VPCId': u'vpc-f2e7c094', u'VPCRegion':
u'eu-west-1'}], u'HostedZone': {u'ResourceRecord SetCount': u'2',
u'CallerReference': u'0beecc60-279a-4981-878d-663d3228c042', u'Config':
{u'PrivateZone': u'true'}, u'Id': u'/hostedzone/Z1ANNYV58T6IGH',
u'Name': u'foo.bar.'}}
Parsing the example without this patch results in:
File "/usr/lib/python2.7/site-packages/salt/state.py", line 1905, in
call
**cdata['kwargs'])
File "/usr/lib/python2.7/site-packages/salt/loader.py", line 1830, in
wrapper
return f(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/salt/states/boto_route53.py",
line 442, in hosted_zone_present
for v, d in deets.get('VPCs', {}).items():
AttributeError: 'ListElement' object has no attribute 'items'
What does this PR do?
Fix private hosted zone validation in boto_route53 state
What issues does this PR fix or reference?
No related issues found when searching for "boto_route53"
Previous Behavior
State run results in an
AttributeError: 'ListElement' object has no attribute 'items'
New Behavior
State run correctly detects the existence of the specified private hosted zone without generating errors
Tests written?
No
Commits signed with GPG?
No
Please review Salt's Contributing Guide for best practices.
See GitHub's page on GPG signing for more information about signing commits with GPG.