summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2014-03-19 13:29:27 -0400
committerScott Moser <smoser@ubuntu.com>2014-03-19 13:29:27 -0400
commit2025632daf5b202dbe6424a112d8689a1f93d9ac (patch)
treee402e585fe6572cfeb9c03582d3416dbcd7ea965 /cloudinit
parente91fd55890922d9054523afab4d7e4b268c1be64 (diff)
downloadvyos-cloud-init-2025632daf5b202dbe6424a112d8689a1f93d9ac.tar.gz
vyos-cloud-init-2025632daf5b202dbe6424a112d8689a1f93d9ac.zip
minor changes: be more careful about umount and warn on fail
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/sources/DataSourceAzure.py29
1 files changed, 16 insertions, 13 deletions
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
index 256e0539..ffb4ff87 100644
--- a/cloudinit/sources/DataSourceAzure.py
+++ b/cloudinit/sources/DataSourceAzure.py
@@ -269,25 +269,28 @@ def support_new_ephemeral(cfg):
if file_count >= 1:
LOG.debug("fabric prepared ephemeral0.1 will be preserved")
return None
- else:
- with util.unmounter(device):
- LOG.debug("unmounted fabric prepared ephemeral0.1")
+ elif device in util.mounted():
+ try:
+ util.subp(['umount', device])
+ except util.ProcessExecutionError as e:
+ LOG.warn("Failed to unmount %s, will not reformat", device)
+ return None
LOG.debug("cloud-init will format ephemeral0.1 this boot.")
LOG.debug("setting disk_setup and mounts modules 'always' for this boot")
cc_modules = cfg.get('cloud_config_modules')
- if cc_modules:
- mod_list = []
- for mod in cc_modules:
- if mod in ("disk_setup", "mounts"):
- mod_list.append([mod, PER_ALWAYS])
- LOG.debug("set module '%s' to 'always' for this boot" % mod)
- else:
- mod_list.append(mod)
- return mod_list
+ if not cc_modules:
+ return None
- return None
+ mod_list = []
+ for mod in cc_modules:
+ if mod in ("disk_setup", "mounts"):
+ mod_list.append([mod, PER_ALWAYS])
+ LOG.debug("set module '%s' to 'always' for this boot" % mod)
+ else:
+ mod_list.append(mod)
+ return mod_list
def handle_set_hostname(enabled, hostname, cfg):