From cd47f4a6ae1249c3b516259edaa79fcc80a5990b Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Fri, 24 Aug 2012 16:51:16 -0400 Subject: use 'uuid' as 'instance-id' openstack metadata uses 'uuid' as an instances 'instance-id'. just copy that to the metadata['instance-id'] --- cloudinit/sources/DataSourceConfigDrive.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'cloudinit/sources') diff --git a/cloudinit/sources/DataSourceConfigDrive.py b/cloudinit/sources/DataSourceConfigDrive.py index b68a97bb..585dbb58 100644 --- a/cloudinit/sources/DataSourceConfigDrive.py +++ b/cloudinit/sources/DataSourceConfigDrive.py @@ -237,6 +237,13 @@ def read_config_drive_dir_v2(source_dir, version="latest"): if found: results[name] = data + # instance-id is 'uuid' for openstack. just copy it to instance-id. + if 'instance-id' not in results['metadata']: + try: + results['metadata']['instance-id'] = results['metadata']['uuid'] + except KeyError: + raise BrokenConfigDriveDir("No uuid entry in metadata") + 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", -- cgit v1.2.3