From 568d15d7fb239e609fb70cc7c7a08205e640bf25 Mon Sep 17 00:00:00 2001 From: Ryan Harper Date: Wed, 2 Mar 2016 13:23:55 -0600 Subject: Fix logic error in lxd config check If the cloud-config does not contain and lxd dictionary then we should not attempt to install the package. Change the latter half of the check to negate the dictionary type check. This fix prevents us from always installing lxd, rather than only installing when we have a config. Fix pyflakes check on init_cfg dict error message. --- cloudinit/config/cc_lxd.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cloudinit/config') diff --git a/cloudinit/config/cc_lxd.py b/cloudinit/config/cc_lxd.py index aaafb643..7d8a0202 100644 --- a/cloudinit/config/cc_lxd.py +++ b/cloudinit/config/cc_lxd.py @@ -38,7 +38,7 @@ from cloudinit import util def handle(name, cfg, cloud, log, args): # Get config lxd_cfg = cfg.get('lxd') - if not lxd_cfg and isinstance(lxd_cfg, dict): + if not lxd_cfg and not isinstance(lxd_cfg, dict): log.debug("Skipping module named %s, not present or disabled by cfg") return @@ -59,7 +59,7 @@ def handle(name, cfg, cloud, log, args): if init_cfg: if not isinstance(init_cfg, dict): log.warn("lxd/init config must be a dictionary. found a '%s'", - type(f)) + type(init_cfg)) return cmd = ['lxd', 'init', '--auto'] for k in init_keys: -- cgit v1.2.3