From 615b484218ef3510f97a5627a996a068b9766f94 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Wed, 1 Oct 2014 15:09:12 -0400 Subject: handle non-dictionary 'swap' input --- cloudinit/config/cc_mounts.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cloudinit') 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"]) -- cgit v1.2.3