summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceGCE.py
diff options
context:
space:
mode:
authorBen Howard <ben.howard@canonical.com>2015-01-14 07:29:57 -0700
committerBen Howard <ben.howard@canonical.com>2015-01-14 07:29:57 -0700
commitbd0c29c2f298ad060bba88ddbb4d2d11ab07cafe (patch)
treee05ab21629f0e87908e0ac91d8c5c648270f962b /cloudinit/sources/DataSourceGCE.py
parent62e9e73e3ed8467fc4d4d95f76ed0443c50f176c (diff)
downloadvyos-cloud-init-bd0c29c2f298ad060bba88ddbb4d2d11ab07cafe.tar.gz
vyos-cloud-init-bd0c29c2f298ad060bba88ddbb4d2d11ab07cafe.zip
Use the short name for GCE hostnames per GCE's request (LP: #1383794).
Diffstat (limited to 'cloudinit/sources/DataSourceGCE.py')
-rw-r--r--cloudinit/sources/DataSourceGCE.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/cloudinit/sources/DataSourceGCE.py b/cloudinit/sources/DataSourceGCE.py
index 92e5a28e..f877b3d1 100644
--- a/cloudinit/sources/DataSourceGCE.py
+++ b/cloudinit/sources/DataSourceGCE.py
@@ -124,7 +124,8 @@ class DataSourceGCE(sources.DataSource):
return self.metadata['public-keys']
def get_hostname(self, fqdn=False, _resolve_ip=False):
- return self.metadata['local-hostname']
+ # GCE has long FDQN's and has asked for short hostnames
+ return self.metadata['local-hostname'].split('.')[0]
def get_userdata_raw(self):
return self.metadata['user-data']