From 0659e75ee2a2c25c113e8e652a3366433e76eff0 Mon Sep 17 00:00:00 2001 From: Vlastimil Holer Date: Wed, 19 Sep 2012 15:32:10 +0200 Subject: Use and resolve PUBLIC_IP from context disk if no HOSTNAME is specified. --- cloudinit/sources/DataSourceOpenNebula.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'cloudinit/sources/DataSourceOpenNebula.py') 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: -- cgit v1.2.3