diff options
author | Scott Moser <smoser@ubuntu.com> | 2013-01-16 19:46:30 -0500 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2013-01-16 19:46:30 -0500 |
commit | e561742aeab1e8090467f0fa304ee06e82e85f2c (patch) | |
tree | 8ab8cc494cbd2929b95f2563a6d78940999521f8 /cloudinit/util.py | |
parent | 0c38be4ae18e08640269e2f45e9243ea4867153c (diff) | |
download | vyos-cloud-init-e561742aeab1e8090467f0fa304ee06e82e85f2c.tar.gz vyos-cloud-init-e561742aeab1e8090467f0fa304ee06e82e85f2c.zip |
DataSourceConfigDrive: consider CD rom as valid config-drive source.
previously, there was an attempt in the config drive source to limit
the source device to a "full block device" rather than a partition.
This was done by a simplistic approach of checking that the last
character of the name was not a number. That was filtering out
CD-rom devices (sr0).
Now, we have a bit more sophisticated approach to that same problem.
We filter out block devices that have a 'partition' entry in
/sys/class/block/DEVICE_NAME/partition .
LP: #1100545
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r-- | cloudinit/util.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py index ab918433..c0ea8d91 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -1553,3 +1553,10 @@ def keyval_str_to_dict(kvstring): val = True ret[key] = val return ret + + +def is_partition(device): + if device.startswith("/dev/"): + device = device[5:] + + return os.path.isfile("/sys/class/block/%s/partition" % device) |