summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceGCE.py
diff options
context:
space:
mode:
authorVaidas Jablonskis <jablonskis@gmail.com>2014-02-13 22:03:12 +0000
committerVaidas Jablonskis <jablonskis@gmail.com>2014-02-13 22:03:12 +0000
commitf40bdb4869567124dbc48feaa0574cc83df26e3a (patch)
treebf1ad6ad35860949587d0dc8fe8aa31c89bdbd15 /cloudinit/sources/DataSourceGCE.py
parent046352fc69e94f4c2f2d209ff5638fc455ff4b97 (diff)
downloadvyos-cloud-init-f40bdb4869567124dbc48feaa0574cc83df26e3a.tar.gz
vyos-cloud-init-f40bdb4869567124dbc48feaa0574cc83df26e3a.zip
GCE: use dns name instead of IP address
Diffstat (limited to 'cloudinit/sources/DataSourceGCE.py')
-rw-r--r--cloudinit/sources/DataSourceGCE.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/cloudinit/sources/DataSourceGCE.py b/cloudinit/sources/DataSourceGCE.py
index 2d5ccad5..e2be15b0 100644
--- a/cloudinit/sources/DataSourceGCE.py
+++ b/cloudinit/sources/DataSourceGCE.py
@@ -23,7 +23,7 @@ from cloudinit import url_helper
LOG = logging.getLogger(__name__)
BUILTIN_DS_CONFIG = {
- 'metadata_url': 'http://169.254.169.254/computeMetadata/v1/'
+ 'metadata_url': 'http://metadata.google.internal./computeMetadata/v1/'
}
REQUIRED_FIELDS = ('instance-id', 'availability-zone', 'local-hostname')
@@ -59,12 +59,9 @@ class DataSourceGCE(sources.DataSource):
'user-data': self.metadata_address + 'instance/attributes/user-data',
}
- # try to connect to metadata service or fail otherwise
- try:
- url_helper.readurl(url=url_map['instance-id'], headers=headers)
- except url_helper.UrlError as e:
- LOG.debug('Failed to connect to metadata service. Reason: {0}'.format(
- e))
+ # if we cannot resolve the metadata server, then no point in trying
+ if not util.is_resolvable(self.metadata_address):
+ LOG.debug('{0} is not resolvable'.format(self.metadata_address))
return False
# iterate over url_map keys to get metadata items