Cloudinit modules should provide schema validation to better alert consumers to unsupported config
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Fix Released
|
Medium
|
Chad Smith | ||
cloud-init (Ubuntu) |
Fix Released
|
Medium
|
Unassigned | ||
Xenial |
Fix Released
|
Medium
|
Unassigned | ||
Zesty |
Fix Released
|
Medium
|
Unassigned |
Bug Description
=== Begin SRU Template ===
[Impact]
New feature to validate and log invalid schema warnings from cc_ntp cloud-config module.
[Test Case]
if [ ! -f lxc-proposed-
wget https:/
chmod 755 lxc-proposed-
fi
cat <<EOF > valid.conf
#cloud-config
ntp:
EOF
cat <<EOF > invalid.conf
#cloud-config
ntp: -1
EOF
for release in xenial zesty; do
echo "$release START --------------";
lxc init $ref test-$release;
lxc start test-$release;
sleep 10;
lxc exec test-$release -- sudo apt update;
lxc file push valid.conf test-$release/
lxc file push invalid.conf test-$release/
lxc exec test-$release -- python3 /usr/lib/
lxc exec test-$release -- apt-cache depends cloud-init | grep jsonschema # should be empty;
# invalid.conf will not generate errors when jsonschema is not present
lxc exec test-$release -- python3 /usr/lib/
lxc exec test-$release -- sudo apt install python3-jsonschema
# invalid.conf *will* generate errors when jsonschema is not present
lxc exec test-$release -- python3 /usr/lib/
done;
[Regression Potential]
We don't want to introduce a mandatory jsonschema dependency in older series.
Validate that older releases can run without errors when jsonschema is *not* installed.
[Other Info]
Upstream commit at
https:/
=== End SRU Template ===
cloudinit needs a mechanism to parse and validate a strict schema definition for modules that parse user created #cloud-config yaml files.
Related branches
- Server Team CI bot: Approve (continuous-integration)
- Scott Moser: Approve
-
Diff: 757 lines (+657/-7)7 files modifiedcloudinit/config/cc_ntp.py (+67/-2)
cloudinit/config/schema.py (+222/-0)
requirements.txt (+3/-0)
tests/unittests/helpers.py (+1/-5)
tests/unittests/test_handler/test_handler_ntp.py (+109/-0)
tests/unittests/test_handler/test_schema.py (+220/-0)
tools/cloudconfig-schema (+35/-0)
Changed in cloud-init: | |
importance: | Undecided → Medium |
Changed in cloud-init (Ubuntu): | |
status: | New → Fix Released |
Changed in cloud-init: | |
status: | In Progress → Fix Committed |
Changed in cloud-init (Ubuntu): | |
importance: | Undecided → Medium |
description: | updated |
description: | updated |
description: | updated |
Changed in cloud-init: | |
status: | Fix Committed → Fix Released |
Changed in cloud-init: | |
status: | Fix Released → Fix Committed |
Changed in cloud-init (Ubuntu Xenial): | |
status: | New → Confirmed |
Changed in cloud-init (Ubuntu Zesty): | |
status: | New → Confirmed |
Changed in cloud-init (Ubuntu Xenial): | |
importance: | Undecided → Medium |
Changed in cloud-init (Ubuntu Zesty): | |
importance: | Undecided → Medium |
description: | updated |
description: | updated |
potential valid and invalid ntp cloud-config files