diff options
author | Scott Moser <smoser@brickies.net> | 2016-11-08 16:19:26 -0500 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2016-11-08 17:10:27 -0500 |
commit | 847fda8353759e6eddee5a7478c9078b617a7837 (patch) | |
tree | c77c92b3abe656f18c6da44ee4225018d5f36e25 /cloudinit/sources/DataSourceEc2.py | |
parent | 45aac92596a7615d93c7d5efe72d68995b18e597 (diff) | |
download | vyos-cloud-init-847fda8353759e6eddee5a7478c9078b617a7837.tar.gz vyos-cloud-init-847fda8353759e6eddee5a7478c9078b617a7837.zip |
Ec2: protect against non-dictionary in block-device-mapping.
Oracle public cloud has the string 'unavailable' in its metadata
service for 'block-device-mapping'. The change here is to return
None in device_name_to_device if that is the case.
Diffstat (limited to 'cloudinit/sources/DataSourceEc2.py')
-rw-r--r-- | cloudinit/sources/DataSourceEc2.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cloudinit/sources/DataSourceEc2.py b/cloudinit/sources/DataSourceEc2.py index bc84ef5d..bb6d6fd7 100644 --- a/cloudinit/sources/DataSourceEc2.py +++ b/cloudinit/sources/DataSourceEc2.py @@ -151,6 +151,10 @@ class DataSourceEc2(sources.DataSource): # 'root': '/dev/sda1'} found = None bdm = self.metadata['block-device-mapping'] + if not isinstance(bdm, dict): + LOG.debug("block-device-mapping not a dictionary: '%s'", bdm) + return None + for (entname, device) in bdm.items(): if entname == name: found = device |