diff options
author | Chad Smith <chad.smith@canonical.com> | 2017-08-22 20:06:20 -0600 |
---|---|---|
committer | Chad Smith <chad.smith@canonical.com> | 2017-08-22 20:06:20 -0600 |
commit | cc9762a2d737ead386ffb9f067adc5e543224560 (patch) | |
tree | f8a4bf64b401ed50e53cb807ee12c22fc7f907ab /doc | |
parent | 3395a331c014dd7b83e93a1e2b66bb55b1966d83 (diff) | |
download | vyos-cloud-init-cc9762a2d737ead386ffb9f067adc5e543224560.tar.gz vyos-cloud-init-cc9762a2d737ead386ffb9f067adc5e543224560.zip |
schema cli: Add schema subcommand to cloud-init cli and cc_runcmd schema
This branch does a few things:
- Add 'schema' subcommand to cloud-init CLI for validating
cloud-config files against strict module jsonschema definitions
- Add --annotate parameter to 'cloud-init schema' to annotate
existing cloud-config file content with validation errors
- Add jsonschema definition to cc_runcmd
- Add unit test coverage for cc_runcmd
- Update CLI capabilities documentation
This branch only imports development (and analyze) subparsers when the
specific subcommand is provided on the CLI to avoid adding costly unused
file imports during cloud-init system boot.
The schema command allows a person to quickly validate a cloud-config text
file against cloud-init's known module schemas to avoid costly roundtrips
deploying instances in their cloud of choice. As of this branch, only
cc_ntp and cc_runcmd cloud-config modules define schemas. Schema
validation will ignore all undefined config keys until all modules define
a strict schema.
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 schema --config-file cloud.cfg
$ python -m cloudinit.cmd.main schema --config-file cloud.cfg \
--annotate
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.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/rtd/topics/capabilities.rst | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/doc/rtd/topics/capabilities.rst b/doc/rtd/topics/capabilities.rst index b8034b07..31eaba53 100644 --- a/doc/rtd/topics/capabilities.rst +++ b/doc/rtd/topics/capabilities.rst @@ -51,15 +51,6 @@ described in this document. usage: cloud-init [-h] [--version] [--file FILES] [--debug] [--force] {init,modules,query,single,dhclient-hook,features} ... - positional arguments: - {init,modules,query,single,dhclient-hook,features} - init initializes cloud-init and performs initial modules - modules activates modules using a given configuration key - query query information stored in cloud-init - single run a single module - dhclient-hook run the dhclient hookto record network info - features list defined features - optional arguments: -h, --help show this help message and exit --version, -v show program's version number and exit @@ -69,6 +60,15 @@ described in this document. --force force running even if no datasource is found (use at your own risk) + Subcommands: + {init,modules,single,dhclient-hook,features,analyze,devel} + init initializes cloud-init and performs initial modules + modules activates modules using a given configuration key + single run a single module + dhclient-hook run the dhclient hookto record network info + features list defined features + analyze Devel tool: Analyze cloud-init logs and data + devel Run development tools % cloud-init features NETWORK_CONFIG_V1 |