diff options
author | Scott Moser <smoser@ubuntu.com> | 2015-03-04 14:49:59 -0500 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2015-03-04 14:49:59 -0500 |
commit | 0ce85f53c15bce21e65a419fe71127c6d94064aa (patch) | |
tree | 7648389fece0a0bd76b11b47e07d4779017a362d /cloudinit/config/cc_grub_dpkg.py | |
parent | 2db45b26d2e5412aa55b33ec924afce7c0dbd12c (diff) | |
download | vyos-cloud-init-0ce85f53c15bce21e65a419fe71127c6d94064aa.tar.gz vyos-cloud-init-0ce85f53c15bce21e65a419fe71127c6d94064aa.zip |
grub-dpkg: allow to be disabled
Diffstat (limited to 'cloudinit/config/cc_grub_dpkg.py')
-rw-r--r-- | cloudinit/config/cc_grub_dpkg.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/cloudinit/config/cc_grub_dpkg.py b/cloudinit/config/cc_grub_dpkg.py index e3219e81..456597af 100644 --- a/cloudinit/config/cc_grub_dpkg.py +++ b/cloudinit/config/cc_grub_dpkg.py @@ -25,15 +25,20 @@ from cloudinit import util distros = ['ubuntu', 'debian'] -def handle(_name, cfg, _cloud, log, _args): - idevs = None - idevs_empty = None +def handle(name, cfg, _cloud, log, _args): - if "grub-dpkg" in cfg: - idevs = util.get_cfg_option_str(cfg["grub-dpkg"], - "grub-pc/install_devices", None) - idevs_empty = util.get_cfg_option_str(cfg["grub-dpkg"], - "grub-pc/install_devices_empty", None) + mycfg = cfg.get("grub_dpkg", cfg.get("grub-dpkg", {})) + if not mycfg: + mycfg = {} + + enabled = mycfg.get('enabled', True) + if util.is_false(enabled): + log.debug("%s disabled by config grub_dpkg/enabled=%s", name, enabled) + return + + idevs = util.get_cfg_option_str(mycfg, "grub-pc/install_devices", None) + idevs_empty = util.get_cfg_option_str(mycfg, + "grub-pc/install_devices_empty", None) if ((os.path.exists("/dev/sda1") and not os.path.exists("/dev/sda")) or (os.path.exists("/dev/xvda1") |