Skip to content

Commit c269898

Browse files
authored
Fix AttributeError when running ec2_metadata_facts (ansible-collections#1138)
Fix AttributeError when running ec2_metadata_facts SUMMARY Prior to 5.0.0 we caught "Exception" within fetch, this was limited to json.JSONDecodeError, however it looks like we also needed to catch AttributeError for non-dict JSON ISSUE TYPE Bugfix Pull Request COMPONENT NAME ec2_metadata_facts ADDITIONAL INFORMATION fixes: ansible-collections#1134
1 parent 6d0d5ad commit c269898

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bugfixes:
2+
- ec2_metadata_facts - fixed ``AttributeError`` (https://github.com/ansible-collections/amazon.aws/issues/1134).

plugins/modules/ec2_metadata_facts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ def fetch(self, uri, recurse=True):
528528
self._data['%s' % (new_uri)] = content
529529
for (key, value) in json_dict.items():
530530
self._data['%s:%s' % (new_uri, key.lower())] = value
531-
except json.JSONDecodeError:
531+
except (json.JSONDecodeError, AttributeError):
532532
self._data['%s' % (new_uri)] = content # not a stringified JSON string
533533

534534
def fix_invalid_varnames(self, data):

0 commit comments

Comments
 (0)