summaryrefslogtreecommitdiff
path: root/cloudinit/util.py
diff options
context:
space:
mode:
authorBrett Holman <bpholman5@gmail.com>2021-10-07 14:08:13 -0600
committerGitHub <noreply@github.com>2021-10-07 15:08:13 -0500
commit725a7f7f19eb39b472e1f24b447fc9a596bf1748 (patch)
tree0fdb2a30b27a7ad06c13b24e8403f6f267d18f5b /cloudinit/util.py
parentfd595774f64f22384ec9229bde176df5cb2fd4c6 (diff)
downloadvyos-cloud-init-725a7f7f19eb39b472e1f24b447fc9a596bf1748.tar.gz
vyos-cloud-init-725a7f7f19eb39b472e1f24b447fc9a596bf1748.zip
Allow comments in runcmd and report failed commands correctly (#1049)
Allow comments in runcmd and report failed commands correctly A `runcmd` script may fail to parse properly, but does not mark `runcmd` as failed when that occurs. Additionally `shellify()` fails to correctly parse scripts that contain a comment line. Rectify both issues and add unit tests to verify correct behavior. LP: #1853146
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r--cloudinit/util.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 22d8917e..1b4384e1 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -2031,6 +2031,9 @@ def shellify(cmdlist, add_header=True):
elif isinstance(args, str):
content = "%s%s\n" % (content, args)
cmds_made += 1
+ # Yaml parsing of a comment results in None
+ elif args is None:
+ pass
else:
raise TypeError(
"Unable to shellify type '%s'. Expected list, string, tuple. "