summaryrefslogtreecommitdiff
path: root/cloudinit/util.py
diff options
context:
space:
mode:
authorBen Howard <ben.howard@canonical.com>2013-10-03 16:15:56 -0600
committerBen Howard <ben.howard@canonical.com>2013-10-03 16:15:56 -0600
commitecf2a600e41a9632ad305eb6a8cd5665908f31fb (patch)
treedd8539cba663a5662187d7b68b49252d9877ca3e /cloudinit/util.py
parentc3daa2fa160c930084509f4ef5abfbb562b7059d (diff)
downloadvyos-cloud-init-ecf2a600e41a9632ad305eb6a8cd5665908f31fb.tar.gz
vyos-cloud-init-ecf2a600e41a9632ad305eb6a8cd5665908f31fb.zip
Moved ephemeralX.Y handling from Datasource into the cc_disk_setup, which makes it cloud agnostic.
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r--cloudinit/util.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 14519586..053e1efc 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -1869,7 +1869,7 @@ def map_device_alias(device, partition=None, alias=None):
"""
if not device:
- return None
+ raise Exception("Device cannot be undefined!")
if not partition and not alias:
raise Exception("partition or alias is required")
@@ -1877,9 +1877,9 @@ def map_device_alias(device, partition=None, alias=None):
if alias:
partition = map_partition(alias)
- # if the partition doesn't map, return the device
- if not partition:
- return device
+ # if the partition doesn't map, return the device
+ if not partition:
+ return device
short_name = device.split('/')[-1]
sys_path = "/sys/block/%s" % short_name
@@ -1898,6 +1898,9 @@ def map_device_alias(device, partition=None, alias=None):
dev_path = "/dev/%s" % cdisk.split('/')[-1]
if os.path.exists(dev_path):
return dev_path
+ else:
+ LOG.warn("Specificed parition %s does not exist on %s" % (
+ partition, device))
return None