summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceGCE.py
diff options
context:
space:
mode:
authorVaidas Jablonskis <jablonskis@gmail.com>2014-02-08 20:59:52 +0000
committerVaidas Jablonskis <jablonskis@gmail.com>2014-02-08 20:59:52 +0000
commitaa1d0328da6ae1ace03e327feafabcf84f91b2b5 (patch)
tree09d9bd88d77c76bb463393e2e4a4432bf561dcf6 /cloudinit/sources/DataSourceGCE.py
parent64b35a9c3b201aed5073823fd4a15ecb15195aea (diff)
downloadcloud-init-git-aa1d0328da6ae1ace03e327feafabcf84f91b2b5.tar.gz
wrap url get call in try/except clause
Diffstat (limited to 'cloudinit/sources/DataSourceGCE.py')
-rw-r--r--cloudinit/sources/DataSourceGCE.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/cloudinit/sources/DataSourceGCE.py b/cloudinit/sources/DataSourceGCE.py
index 8a46f933..c96cfffd 100644
--- a/cloudinit/sources/DataSourceGCE.py
+++ b/cloudinit/sources/DataSourceGCE.py
@@ -52,7 +52,10 @@ class DataSourceGCE(sources.DataSource):
}
for mkey in url_map.iterkeys():
- resp = url_helper.readurl(url=url_map[mkey], headers=headers)
+ try:
+ resp = url_helper.readurl(url=url_map[mkey], headers=headers)
+ except IOError:
+ return False
if resp.ok():
if mkey == 'public-keys':
pub_keys = [self._trim_key(k) for k in resp.contents.splitlines()]