diff options
author | Chad Smith <chad.smith@canonical.com> | 2017-10-06 13:22:54 -0600 |
---|---|---|
committer | Chad Smith <chad.smith@canonical.com> | 2017-10-06 13:22:54 -0600 |
commit | 9fd022780ae516df3499b17b2d69b72fc502917c (patch) | |
tree | bc33ac6296f374414ccb15dce233a4293b8633d3 /cloudinit/cmd/devel/parser.py | |
parent | 89630a6658c099d59f2766493a35c2ad266a8f42 (diff) | |
parent | 45d361cb0b7f5e4e7d79522bd285871898358623 (diff) | |
download | vyos-cloud-init-9fd022780ae516df3499b17b2d69b72fc502917c.tar.gz vyos-cloud-init-9fd022780ae516df3499b17b2d69b72fc502917c.zip |
merge from master at 17.1-17-g45d361cb
Diffstat (limited to 'cloudinit/cmd/devel/parser.py')
-rw-r--r-- | cloudinit/cmd/devel/parser.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/cloudinit/cmd/devel/parser.py b/cloudinit/cmd/devel/parser.py new file mode 100644 index 00000000..acacc4ed --- /dev/null +++ b/cloudinit/cmd/devel/parser.py @@ -0,0 +1,26 @@ +# Copyright (C) 2017 Canonical Ltd. +# +# This file is part of cloud-init. See LICENSE file for license information. + +"""Define 'devel' subcommand argument parsers to include in cloud-init cmd.""" + +import argparse +from cloudinit.config.schema import ( + get_parser as schema_parser, handle_schema_args) + + +def get_parser(parser=None): + if not parser: + parser = argparse.ArgumentParser( + prog='cloudinit-devel', + description='Run development cloud-init tools') + subparsers = parser.add_subparsers(title='Subcommands', dest='subcommand') + subparsers.required = True + + parser_schema = subparsers.add_parser( + 'schema', help='Validate cloud-config files or document schema') + # Construct schema subcommand parser + schema_parser(parser_schema) + parser_schema.set_defaults(action=('schema', handle_schema_args)) + + return parser |