diff options
author | Vlastimil Holer <vlastimil.holer@gmail.com> | 2012-09-19 15:32:10 +0200 |
---|---|---|
committer | Vlastimil Holer <vlastimil.holer@gmail.com> | 2012-09-19 15:32:10 +0200 |
commit | 0659e75ee2a2c25c113e8e652a3366433e76eff0 (patch) | |
tree | 093338a5c503bd02689ac95ea38eba71b53087ab /cloudinit/sources | |
parent | 34bebd8569e9319b791802f4fd551537967aec69 (diff) | |
download | vyos-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')
-rw-r--r-- | cloudinit/sources/DataSourceOpenNebula.py | 4 |
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: |