summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2011-10-06 16:54:35 -0400
committerScott Moser <smoser@ubuntu.com>2011-10-06 16:54:35 -0400
commit3468479bca55c3c62a19ab428119153ce32caf84 (patch)
tree282588b5a098796b91aeb6cbd73c8494643e5e14
parentbad89c162e8f5be513537a1a430aa98cd1822fb7 (diff)
downloadvyos-cloud-init-3468479bca55c3c62a19ab428119153ce32caf84.tar.gz
vyos-cloud-init-3468479bca55c3c62a19ab428119153ce32caf84.zip
DataSourceEc2: catch a socket timeout in wait-for-md-service code
In addition to catching a url timeout, we also need to catch and retry on a socket timeout. Apparently urllib2 doesn't catch this and brand it as a urlerror. LP: #869492
-rw-r--r--cloudinit/DataSourceEc2.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/cloudinit/DataSourceEc2.py b/cloudinit/DataSourceEc2.py
index bf8dc145..0d8f358f 100644
--- a/cloudinit/DataSourceEc2.py
+++ b/cloudinit/DataSourceEc2.py
@@ -94,7 +94,7 @@ class DataSourceEc2(DataSource.DataSource):
if sleeps == 0: return False
- timeout=2
+ timeout=3
try:
timeout = int(mcfg.get("timeout",timeout))
except Exception as e:
@@ -148,6 +148,8 @@ class DataSourceEc2(DataSource.DataSource):
reason = "http error [%s]" % e.code
except urllib2.URLError as e:
reason = "url error [%s]" % e.reason
+ except socket.timeout as e:
+ reason = "socket timeout [%s]" % e
#not needed? Addresses being checked are displayed above
#if x == 0: