From 3468479bca55c3c62a19ab428119153ce32caf84 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Thu, 6 Oct 2011 16:54:35 -0400 Subject: 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 --- cloudinit/DataSourceEc2.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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: -- cgit v1.2.3