REVERT revno 714: config-drive-v2: populate metadata['public-keys'] from 'public_keys'

This commit is contained in:
Scott Moser
2012-11-12 11:57:14 -05:00
parent babbf53f72
commit 37042f6f14

View File

@@ -218,6 +218,11 @@ class DataSourceConfigDrive(sources.DataSource):
return True return True
def get_public_ssh_keys(self):
if not 'public-keys' in self.metadata:
return []
return self.metadata['public-keys']
class DataSourceConfigDriveNet(DataSourceConfigDrive): class DataSourceConfigDriveNet(DataSourceConfigDrive):
def __init__(self, sys_cfg, distro, paths): def __init__(self, sys_cfg, distro, paths):
@@ -326,13 +331,6 @@ def read_config_drive_dir_v2(source_dir, version="2012-08-10"):
except KeyError: except KeyError:
raise BrokenConfigDriveDir("No uuid entry in metadata") 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): def read_content_path(item):
# do not use os.path.join here, as content_path starts with / # do not use os.path.join here, as content_path starts with /
cpath = os.path.sep.join((source_dir, "openstack", cpath = os.path.sep.join((source_dir, "openstack",