summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cloudinit/DataSourceEc2.py11
1 files changed, 1 insertions, 10 deletions
diff --git a/cloudinit/DataSourceEc2.py b/cloudinit/DataSourceEc2.py
index 908a29cd..ea56960b 100644
--- a/cloudinit/DataSourceEc2.py
+++ b/cloudinit/DataSourceEc2.py
@@ -114,7 +114,7 @@ class DataSourceEc2(DataSource.DataSource):
starttime = time.time()
# Remove addresses from the list that wont resolve.
- filtered = [x for x in mdurls if try_to_resolve_metadata(x)]
+ filtered = [x for x in mdurls if util.is_resolvable_url(x)]
if set(filtered) != set(mdurls):
log.debug("removed the following from metadata urls: %s" %
@@ -221,15 +221,6 @@ class DataSourceEc2(DataSource.DataSource):
return True
return False
-def try_to_resolve_metadata(url):
- try:
- addr = urlparse.urlsplit(url).netloc.split(":")[0]
- socket.getaddrinfo(addr, None)
- return True
- except Exception as e:
- return False
-
-
datasources = [
( DataSourceEc2, ( DataSource.DEP_FILESYSTEM , DataSource.DEP_NETWORK ) ),
]