diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-10-05 09:39:53 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2012-10-05 09:39:53 -0400 |
commit | 223e1012608c5eb309ee51987446928fcbcd292b (patch) | |
tree | 6c66dede1f59e3180665d902eb5cb744da3646b4 | |
parent | df00a64c662a916fab18602a294a0443545a1990 (diff) | |
parent | ab1b27294ce852a5d67b230971a1c28c99940e50 (diff) | |
download | vyos-cloud-init-223e1012608c5eb309ee51987446928fcbcd292b.tar.gz vyos-cloud-init-223e1012608c5eb309ee51987446928fcbcd292b.zip |
config-drive: map hostname to local-hostname
Ensure that for config drive that we map 'hostname' to 'local-hostname' so that
the modules work correctly with the cfgdrive style of data.
-rw-r--r-- | cloudinit/sources/DataSourceConfigDrive.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/cloudinit/sources/DataSourceConfigDrive.py b/cloudinit/sources/DataSourceConfigDrive.py index b8154367..b1cf942e 100644 --- a/cloudinit/sources/DataSourceConfigDrive.py +++ b/cloudinit/sources/DataSourceConfigDrive.py @@ -85,6 +85,16 @@ class DataSourceConfigDrive(sources.DataSource): md = results['metadata'] md = util.mergedict(md, DEFAULT_METADATA) + # Perform some metadata 'fixups' + # + # OpenStack uses the 'hostname' key + # while most of cloud-init uses the metadata + # 'local-hostname' key instead so if it doesn't + # exist we need to make sure its copied over. + for (tgt, src) in [('local-hostname', 'hostname')]: + if tgt not in md and src in md: + md[tgt] = md[src] + user_dsmode = results.get('dsmode', None) if user_dsmode not in VALID_DSMODES + (None,): LOG.warn("user specified invalid mode: %s" % user_dsmode) |