summaryrefslogtreecommitdiff
path: root/cloudinit/config
diff options
context:
space:
mode:
authorRyan Harper <ryan.harper@canonical.com>2016-03-02 13:23:55 -0600
committerRyan Harper <ryan.harper@canonical.com>2016-03-02 13:23:55 -0600
commit568d15d7fb239e609fb70cc7c7a08205e640bf25 (patch)
tree4f757f31484e4290d9f084f3a745e346eaaca1fa /cloudinit/config
parent3b773f7919c86a58956e2fc493512bb2c1ce31a8 (diff)
downloadvyos-cloud-init-568d15d7fb239e609fb70cc7c7a08205e640bf25.tar.gz
vyos-cloud-init-568d15d7fb239e609fb70cc7c7a08205e640bf25.zip
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.
Diffstat (limited to 'cloudinit/config')
-rw-r--r--cloudinit/config/cc_lxd.py4
1 files changed, 2 insertions, 2 deletions
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: