Fixes #6411 Return None for ec2 api endpoints that return 404
This commit is contained in:
parent
bb047b9e89
commit
6da2c37112
1 changed files with 5 additions and 1 deletions
|
@ -71,7 +71,11 @@ class Ec2Metadata(object):
|
||||||
|
|
||||||
def _fetch(self, url):
|
def _fetch(self, url):
|
||||||
(response, info) = fetch_url(self.module, url, force=True)
|
(response, info) = fetch_url(self.module, url, force=True)
|
||||||
return response.read()
|
if response:
|
||||||
|
data = response.read()
|
||||||
|
else:
|
||||||
|
data = None
|
||||||
|
return data
|
||||||
|
|
||||||
def _mangle_fields(self, fields, uri, filter_patterns=['public-keys-0']):
|
def _mangle_fields(self, fields, uri, filter_patterns=['public-keys-0']):
|
||||||
new_fields = {}
|
new_fields = {}
|
||||||
|
|
Loading…
Reference in a new issue