diff options
author | Scott Moser <smoser@ubuntu.com> | 2014-10-01 15:09:12 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2014-10-01 15:09:12 -0400 |
commit | 615b484218ef3510f97a5627a996a068b9766f94 (patch) | |
tree | a1d3512d9114adcfe4bf4aa5b3883a936f26a314 | |
parent | f3c8ec58cb2a2d1bce73bec08bae08e16f1b1f99 (diff) | |
download | vyos-cloud-init-615b484218ef3510f97a5627a996a068b9766f94.tar.gz vyos-cloud-init-615b484218ef3510f97a5627a996a068b9766f94.zip |
handle non-dictionary 'swap' input
-rw-r--r-- | cloudinit/config/cc_mounts.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cloudinit/config/cc_mounts.py b/cloudinit/config/cc_mounts.py index 2503ed98..f0571c52 100644 --- a/cloudinit/config/cc_mounts.py +++ b/cloudinit/config/cc_mounts.py @@ -190,6 +190,10 @@ def handle_swapcfg(swapcfg): """handle the swap config, calling setup_swap if necessary. return None or (filename, size) """ + if not isinstance(swapcfg, dict): + LOG.warn("input for swap config was not a dict.") + return None + fname = swapcfg.get('filename', '/swap.img') size = swapcfg.get('size', 0) maxsize = swapcfg.get('maxsize', None) @@ -298,7 +302,7 @@ def handle(_name, cfg, cloud, log, _args): else: actlist.append(x) - swapret = handle_swapcfg(cfg.get('swap')) + swapret = handle_swapcfg(cfg.get('swap'), {}) if swapret: actlist.append([swapret[0], "none", "swap", "sw", "0", "0"]) |