diff options
-rw-r--r-- | cloudinit/DataSourceNoCloud.py | 21 | ||||
-rw-r--r-- | cloudinit/util.py | 4 |
2 files changed, 23 insertions, 2 deletions
diff --git a/cloudinit/DataSourceNoCloud.py b/cloudinit/DataSourceNoCloud.py index fa64f2e5..6c744b82 100644 --- a/cloudinit/DataSourceNoCloud.py +++ b/cloudinit/DataSourceNoCloud.py @@ -23,6 +23,7 @@ import cloudinit.DataSource as DataSource from cloudinit import seeddir as base_seeddir from cloudinit import log import cloudinit.util as util +import errno class DataSourceNoCloud(DataSource.DataSource): @@ -64,6 +65,26 @@ class DataSourceNoCloud(DataSource.DataSource): found.append(self.seeddir) log.debug("using seeded cache data in %s" % self.seeddir) + fslist = util.find_devs_with("TYPE=vfat") + fslist.extend(util.find_devs_with("TYPE=iso9660")) + + label_list = util.find_devs_with("LABEL=cidata") + devlist = list(set(fslist) & set(label_list)) + devlist.sort(reverse=True) + + for dev in devlist: + try: + (newmd, newud) = util.mount_callback_umount(dev, + util.read_seeded) + md = util.mergedict(newmd, md) + ud = newud + log.debug("using data from %s" % dev) + found.append(dev) + break + except OSError, e: + if e.errno != errno.ENOENT: + raise + # there was no indication on kernel cmdline or data # in the seeddir suggesting this handler should be used. if len(found) == 0: diff --git a/cloudinit/util.py b/cloudinit/util.py index b53aa5fe..0a691dcf 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -681,7 +681,7 @@ def mount_callback_umount(device, callback, data=None): umount = False if device in mounted: - mountpoint = mounted[device][2] + mountpoint = "%s/" % mounted[device][2] else: tmpd = tempfile.mkdtemp() @@ -695,7 +695,7 @@ def mount_callback_umount(device, callback, data=None): print exc.output[1] raise mountFailedError(exc.output[1]) - mountpoint = tmpd + mountpoint = "%s/" % tmpd try: if data == None: |