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

ec2_metadata_facts: avoid an AttributeError #1140

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/ec2_metadata_facts_ami-launch-index.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- "ec2_metadata_facts - Avoid an exception caused by the type of the ami-launch-index field (https://github.com/ansible-collections/amazon.aws/pull/1140)."
2 changes: 1 addition & 1 deletion plugins/modules/ec2_metadata_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ def fetch(self, uri, recurse=True):
self._data['%s' % (new_uri)] = content
for (key, value) in json_dict.items():
self._data['%s:%s' % (new_uri, key.lower())] = value
except json.JSONDecodeError:
except (json.JSONDecodeError, AttributeError):
self._data['%s' % (new_uri)] = content # not a stringified JSON string

def fix_invalid_varnames(self, data):
Expand Down
4 changes: 0 additions & 4 deletions tests/integration/targets/ec2_metadata_facts/aliases
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
# We're dependent on AWS actually starting up the instances in a timely manner.
# This doesn't always happen...
unstable

non_local
cloud/aws