From c883c28c8abd00e9681ddcee97ac2f1ab5b33883 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Fri, 24 Aug 2012 17:06:18 -0400 Subject: use openstack metadata version 2012-08-10 unless not available If 'latest' is found, but '2012-08-10' is not, we will log a warning but attempt to use it. --- cloudinit/sources/DataSourceConfigDrive.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cloudinit/sources/DataSourceConfigDrive.py b/cloudinit/sources/DataSourceConfigDrive.py index 558e773c..b8154367 100644 --- a/cloudinit/sources/DataSourceConfigDrive.py +++ b/cloudinit/sources/DataSourceConfigDrive.py @@ -205,7 +205,14 @@ def read_config_drive_dir(source_dir): raise last_e -def read_config_drive_dir_v2(source_dir, version="latest"): +def read_config_drive_dir_v2(source_dir, version="2012-08-10"): + + if (not os.path.isdir(os.path.join(source_dir, "openstack", version)) and + os.path.isdir(os.path.join(source_dir, "openstack", "latest"))): + LOG.warn("version '%s' not available, attempting to use 'latest'" % + version) + version = "latest" + datafiles = ( ('metadata', "openstack/%s/meta_data.json" % version, True, json.loads), -- cgit v1.2.3