Invalid runcmd script format makes it ignored without marking cloud init as failed
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Fix Released
|
Medium
|
Brett Holman |
Bug Description
Info :
- cloud-init version `/usr/bin/
Issue:
If user-data script contains a malformed runcmd script, cloud-init fails to parse it but do not mark cloud-init as failed.
Example:
```
runcmd:
- echo "begin runcmd"
- # empty
- echo "end"
```
The second line is empty, and causes the following warning in `/var/log/
```
2019-11-19 12:39:10,124 - helpers.py[DEBUG]: Running config-runcmd using lock (<FileLock using file '/var/lib/
2019-11-19 12:39:10,124 - schema.py[DEBUG]: Ignoring schema validation. python-jsonschema is not present
2019-11-19 12:39:10,124 - util.py[WARNING]: Failed to shellify ['echo "begin runcmd"', None, 'echo "end"'] into file /var/lib/
2019-11-19 12:39:10,124 - util.py[DEBUG]: Failed to shellify ['echo "begin runcmd"', None, 'echo "end"'] into file /var/lib/
Traceback (most recent call last):
File "/usr/lib/
content = util.shellify(cmd)
File "/usr/lib/
"Got: %s" % (type_utils.
TypeError: Unable to shellify type 'NoneType'. Expected list, string, tuple. Got: None
2019-11-19 12:39:10,154 - handlers.py[DEBUG]: finish: modules-
```
There is no error log in `/var/log/
But cloud-init status is "done"
I expect the status to be "error"
summary: |
- Invalid runcmd script format make it ignored without marking cloud init + Invalid runcmd script format makes it ignored without marking cloud init as failed |
Changed in cloud-init: | |
assignee: | nobody → Brett Holman (holmanb) |
Changed in cloud-init: | |
status: | Confirmed → Fix Committed |
Thanks for filing the bug.
As it turns out, this results in a null entry in the list, which cloud-init fails to "shellify" when rendering this list of commands to a shell script. This results in not writing any of the commands which is why you don't see an failure in the module status.
That's clearly a bug; so we'll need to make a change so that
we handle null or other entries where shellify fails as errors and log them.