diff options
author | Scott Moser <smoser@ubuntu.com> | 2011-12-18 12:02:04 -0500 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2011-12-18 12:02:04 -0500 |
commit | 6b799f1c4384094dabc59a08c8418f9eeec59573 (patch) | |
tree | bb6d80ff98a1c7f0d66269d5aadc2245829d0a4b | |
parent | 5c84e5972c4e363da1b3b874d7e5af5b1cd2221b (diff) | |
download | vyos-cloud-init-6b799f1c4384094dabc59a08c8418f9eeec59573.tar.gz vyos-cloud-init-6b799f1c4384094dabc59a08c8418f9eeec59573.zip |
cloudinit/DataSourceEc2: use util.is_resolvable_url
-rw-r--r-- | cloudinit/DataSourceEc2.py | 11 |
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 ) ), ] |