From 6da2c371128cea88dde2498c2d30a410b449d31e Mon Sep 17 00:00:00 2001 From: James Tanner Date: Tue, 11 Mar 2014 21:38:00 -0400 Subject: [PATCH] Fixes #6411 Return None for ec2 api endpoints that return 404 --- library/cloud/ec2_facts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/cloud/ec2_facts b/library/cloud/ec2_facts index 31024b65f8..09c9d761ef 100644 --- a/library/cloud/ec2_facts +++ b/library/cloud/ec2_facts @@ -71,7 +71,11 @@ class Ec2Metadata(object): def _fetch(self, url): (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']): new_fields = {}