summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceOpenNebula.py
diff options
context:
space:
mode:
authorVlastimil Holer <vlastimil.holer@gmail.com>2012-09-19 15:32:10 +0200
committerVlastimil Holer <vlastimil.holer@gmail.com>2012-09-19 15:32:10 +0200
commit0659e75ee2a2c25c113e8e652a3366433e76eff0 (patch)
tree093338a5c503bd02689ac95ea38eba71b53087ab /cloudinit/sources/DataSourceOpenNebula.py
parent34bebd8569e9319b791802f4fd551537967aec69 (diff)
downloadvyos-cloud-init-0659e75ee2a2c25c113e8e652a3366433e76eff0.tar.gz
vyos-cloud-init-0659e75ee2a2c25c113e8e652a3366433e76eff0.zip
Use and resolve PUBLIC_IP from context disk if no HOSTNAME is specified.
Diffstat (limited to 'cloudinit/sources/DataSourceOpenNebula.py')
-rw-r--r--cloudinit/sources/DataSourceOpenNebula.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/cloudinit/sources/DataSourceOpenNebula.py b/cloudinit/sources/DataSourceOpenNebula.py
index 03c0103e..e8e79c7e 100644
--- a/cloudinit/sources/DataSourceOpenNebula.py
+++ b/cloudinit/sources/DataSourceOpenNebula.py
@@ -109,6 +109,8 @@ class DataSourceOpenNebula(sources.DataSource):
LOG.debug("%s: not claiming datasource, dsmode=%s", self, md['dsmode'])
return False
+ def get_hostname(self, fqdn=False, resolve_ip=True):
+ return sources.DataSource.get_hostname(self, fqdn, resolve_ip)
class DataSourceOpenNebulaNet(DataSourceOpenNebula):
dsmode = "net"
@@ -205,6 +207,8 @@ def read_context_disk_dir(source_dir):
# custom hostname
if 'hostname' in context_sh:
results['metadata']['local-hostname'] = context_sh['hostname']
+ elif 'public_ip'in context_sh:
+ results['metadata']['local-hostname'] = context_sh['public_ip']
# raw user data
if "user_data" in context_sh: