Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

salt/states/boto_route53.py: fix parsing the deets dictionary #49746

Conversation

martin-paulus
Copy link
Contributor

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.

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'
@ghost ghost self-requested a review September 22, 2018 12:00
@martin-paulus
Copy link
Contributor Author

Among the failing CI job results I did not find any boto_route53-related errors. It seems the failures are not reflecting the changes in this pull request but rather the current state of the develop branch.

The one job that actually runs tests for boto_route53 sees them passing: https://jenkinsci.saltstack.com/job/pr-windows2016-py2/job/PR-49746/1/consoleFull

@rallytime rallytime merged commit 92d5172 into saltstack:develop Sep 24, 2018
@alexey-zhukovin alexey-zhukovin added the has master-port port to master has been created label May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has master-port port to master has been created
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants