diff options
author | Scott Moser <smoser@ubuntu.com> | 2014-09-10 15:37:09 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2014-09-10 15:37:09 -0400 |
commit | c4b09a27239bc88bcf6b4ec536410bcc02cdf11c (patch) | |
tree | 72a637f7a20ccc0d11e8ccd313e1745f15d66238 /cloudinit/sources/DataSourceConfigDrive.py | |
parent | 0ea631a556522060f5075496adbac5f5637e7597 (diff) | |
download | vyos-cloud-init-c4b09a27239bc88bcf6b4ec536410bcc02cdf11c.tar.gz vyos-cloud-init-c4b09a27239bc88bcf6b4ec536410bcc02cdf11c.zip |
make BaseReader select latest supported version
Diffstat (limited to 'cloudinit/sources/DataSourceConfigDrive.py')
-rw-r--r-- | cloudinit/sources/DataSourceConfigDrive.py | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/cloudinit/sources/DataSourceConfigDrive.py b/cloudinit/sources/DataSourceConfigDrive.py index 83cc6b25..b8c16361 100644 --- a/cloudinit/sources/DataSourceConfigDrive.py +++ b/cloudinit/sources/DataSourceConfigDrive.py @@ -167,17 +167,13 @@ def get_ds_mode(cfgdrv_ver, ds_cfg=None, user=None): return "net" -def read_config_drive(source_dir): - excps = [] - finders = [] +def read_config_drive(source_dir, version=None): reader = openstack.ConfigDriveReader(source_dir) - - # openstack.OS_VERSIONS is stored in chronological order, so to check the - # newest first, use reversed() - for version in reversed(openstack.OS_VERSIONS): - finders.append((reader.read_v2, [], {'version': version})) - finders.append((reader.read_v1, [], {})) - + finders = [ + (reader.read_v2, [], {'version': version}), + (reader.read_v1, [], {}), + ] + excps = [] for (functor, args, kwargs) in finders: try: return functor(*args, **kwargs) |