Invalid write_files format doesn't make the cloud-init fail
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Expired
|
Medium
|
Unassigned |
Bug Description
If the cloud config file format is not correct (see example below), the write_files module fails, but the cloud-init status is done
Cloud-config file:
```
#cloud-config
write_files:
- content: |
line below is badly indented
ouch!
path: /tmp/cloud-
```
Extract of cloud-init-
```
2020-03-18 13:54:05,321 - util.py[WARNING]: Failed loading yaml blob. Invalid format at line 6 column 1: "while scanning a simple key
in "<unicode string>", line 6, column 1:
ouch!
^
could not found expected ':'
in "<unicode string>", line 8, column 9:
path: /tmp/cloud-
^"
2020-03-18 13:54:05,337 - util.py[WARNING]: Failed loading yaml blob. Invalid format at line 6 column 1: "while scanning a simple key
in "<unicode string>", line 6, column 1:
ouch!
^
could not found expected ':'
in "<unicode string>", line 8, column 9:
path: /tmp/cloud-
^"
2020-03-18 13:54:05,337 - util.py[WARNING]: Failed at merging in cloud config part from part-001
```
cloud-init status:
```
status: done
```
Changed in cloud-init: | |
importance: | Undecided → Medium |
status: | New → Confirmed |
reproduces with:
$ cat ud.yaml
#cloud-config
runcmd:
- "echo hi world | tee /run/runcmd.log"
- "echo this is indented one space more, making bad yaml"
$ ud=$(cat ud.yaml) user.user- data="$ ud"
$ lxc launch ubuntu-daily:bionic btest --config=
$ lxc exec btest -- cloud-init status --wait ; echo $?
status: done
0
$ lxc exec btest /bin/bash cloud-init. log init/result. json init/status. json
root@btest:~# grep WARN /var/log/
2020-03-18 15:31:29,490 - util.py[WARNING]: Failed loading yaml blob. Invalid format at line 2 column 1: "while parsing a block mapping
2020-03-18 15:31:29,499 - util.py[WARNING]: Failed loading yaml blob. Invalid format at line 2 column 1: "while parsing a block mapping
2020-03-18 15:31:29,499 - util.py[WARNING]: Failed at merging in cloud config part from part-001
root@btest:~# grep errors /run/cloud-
"errors": []
root@btest:~# grep errors /run/cloud-
"errors": [],
"errors": [],
"errors": [],
"errors": [],
"errors": [],