diff options
Diffstat (limited to 'cloudinit/sources/DataSourceEc2.py')
-rw-r--r-- | cloudinit/sources/DataSourceEc2.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cloudinit/sources/DataSourceEc2.py b/cloudinit/sources/DataSourceEc2.py index 0108954f..c2c3b9b7 100644 --- a/cloudinit/sources/DataSourceEc2.py +++ b/cloudinit/sources/DataSourceEc2.py @@ -198,13 +198,15 @@ class DataSourceEc2(sources.DataSource): # 'ephemeral0': '/dev/sdb', # 'root': '/dev/sda1'} found = None - for (entname, device) in self.metadata['block-device-mapping'].iteritems(): + bdm_items = self.metadata['block-device-mapping'].iteritems() + for (entname, device) in bdm_items: if entname == name: found = device break # LP: #513842 mapping in Euca has 'ephemeral' not 'ephemeral0' if entname == "ephemeral" and name == "ephemeral0": found = device + if found is None: LOG.debug("Unable to convert %s to a device", name) return None @@ -212,6 +214,7 @@ class DataSourceEc2(sources.DataSource): ofound = found if not found.startswith("/"): found = "/dev/%s" % found + if os.path.exists(found): return found |