cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #03102
[Merge] ~chad.smith/cloud-init:schema-subcommand into cloud-init:master
The proposal to merge ~chad.smith/cloud-init:schema-subcommand into cloud-init:master has been updated.
Description changed to:
schema cli: Add schema subcommand to cloud-init cli and cc_runcmd schema
This branch adds an jsonschema definition for the cc_runcmd module. cc_ntp is the only other module with a schema defined currently. Since jsonschema isn't a mandatory requirement, schema validation will only result in schema warnings at cloud-init runtime if python-jsonschema is installed. Otherwise it's a no-op for existing systems.
The branch also publishes "devel" subcommand from which "schema" can be called to validate the schema of a cloud-config file locally instead of having to actually deploy an instance. We also move "analyze" under devel subcommand and only optionally import devel subparser to save file load cycles when devel is not specified.
To perform validation of runcmd and ntp sections of a cloud-config file:
$ cat > cloud.cfg <<EOF
runcmd: bogus
EOF
$ python -m cloudinit.cmd.main devel schema --config-file cloud.cfg
Once jsonschema is defined for all ~55 cc modules, we will move this schema subcommand up as a proper subcommand of the cloud-init CLI.
To test:
$ cat > invalid-cloud.cfg <<EOF
runcmd: bogus
EOF
$ python -m cloudinit.cmd.main devel schema --config-file invalid-cloud.cfg
# print docs as manpages
$ python -m cloudinit.cmd.main devel schema --doc | rst2man | man -l -
# generate docs and check modules topic
tox -e doc
For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/329233
--
Your team cloud-init commiters is requested to review the proposed merge of ~chad.smith/cloud-init:schema-subcommand into cloud-init:master.
References