diff options
author | Scott Moser <smoser@ubuntu.com> | 2012-11-11 21:49:10 -0500 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2012-11-11 21:49:10 -0500 |
commit | 71ba36704132ff8597dfc0e45b34e0c4424e239f (patch) | |
tree | 66ebf04364d5bad1fd6aa74770fad17109bc30c6 | |
parent | 3248ac9bbb2008e88a3bd9c030ba0fcbc14b7fce (diff) | |
download | vyos-cloud-init-71ba36704132ff8597dfc0e45b34e0c4424e239f.tar.gz vyos-cloud-init-71ba36704132ff8597dfc0e45b34e0c4424e239f.zip |
config-drive-v2: populate metadata['public-keys'] from 'public_keys'
other datasources populate 'public-keys' rather than 'public_keys'
and there is a more complete handler in the base DataSource.
So, to take advantage of that, have DataSourceConfigDrive copy
public_keys to public-keys, and remove the 'get_public_ssh_keys'
from the DataSourcEConfigDrive.
LP: #1077700
-rw-r--r-- | cloudinit/sources/DataSourceConfigDrive.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cloudinit/sources/DataSourceConfigDrive.py b/cloudinit/sources/DataSourceConfigDrive.py index 9729cfb9..dbbedce1 100644 --- a/cloudinit/sources/DataSourceConfigDrive.py +++ b/cloudinit/sources/DataSourceConfigDrive.py @@ -218,11 +218,6 @@ class DataSourceConfigDrive(sources.DataSource): return True - def get_public_ssh_keys(self): - if not 'public-keys' in self.metadata: - return [] - return self.metadata['public-keys'] - class DataSourceConfigDriveNet(DataSourceConfigDrive): def __init__(self, sys_cfg, distro, paths): @@ -331,6 +326,13 @@ def read_config_drive_dir_v2(source_dir, version="2012-08-10"): except KeyError: raise BrokenConfigDriveDir("No uuid entry in metadata") + # other datasources (and config-drive-v1) populate metadata['public-keys'] + # where as with config-drive-v2, that would be 'public_keys'. So, just + # copy the field if it is present + if ('public_keys' in results['metadata'] and not + 'public-keys' in results['metadata']): + results['public-keys'] = results['public_keys'] + def read_content_path(item): # do not use os.path.join here, as content_path starts with / cpath = os.path.sep.join((source_dir, "openstack", |