11 Commits

Author SHA1 Message Date
Gael Chamoulaud (Strider)
e4b5dc3ea7 Add CLI auto generated documentation using Cliff
This patch adds the Cliff Sphinx Extension support for auto documenting
the `validation` Command Line Interface. It also standardizes the
`metavar` description for all the --group, --category and --product
arguments by using <group_id>, <category_id> and <product_id>.

Moreover, it removes usage example(s) in the arguments helpers which are often
duplicated with the `metavar`.

Change-Id: I3009337e8afadd705bbee5b89d9022c78093cdc8
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
2021-07-27 07:01:19 +00:00
Gael Chamoulaud (Strider)
c46c90394c Add Products metadata key management
This patch adds the management of the new `products` metadata key in the
validation playbooks. We can now filter the validations by their groups,
by their categories or by their products while listing or running them.

The `list` sub command has now a new --product argument. When filtering
by groups, by categories or by products (see the example below), the
`list` sub command will return all the validation playbooks belonging to
the 'prep' group OR all the validation playbooks belonging to the 'os'
and/or 'system' categories OR all the validation playbooks to the
'tripleo' product:

$ validation list -h
$ validation list --group prep --category os,system --product tripleo

The `run` sub command has also its new --product argument. Note that
this new argument is mutually exclusive with the --validation, --group
and --category arguments:

$ validation run -h
$ validation run --product tripleo --inventory /etc/ansible/hosts

The `show parameter` sub command has the same new argument which is also
mutually exclusive with the --validation, --group and the --category
arguments:

$ validation show parameter -h
$ validation show parameter --product tripleo

Change-Id: Ief13e506c2bee18da47b31f1c2d5c0dbb1ad1ecf
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
2021-07-27 07:01:05 +00:00
Gael Chamoulaud (Strider)
3928305329 Add Categories metadata key management
This patch adds the management of the new `categories` metadata key in
the validation playbooks. We can now filter the validations by their
groups and/or by their categories while listing or running them.

The `list` sub command has now a new --category argument. When filtering
by groups and by categories (see the example below), the `list` sub
command will return all the validation playbooks belonging to the prep
group OR all the validation playbooks belonging to the os and/or system
categories:

$ validation list -h
$ validation list --group prep --category os,system

The `run` sub command has also its new --category argument. Note that
this new argument is mutually exclusive with the --validation and
--group arguments:

$ validation run -h
$ validation run --category networking --inventory /etc/ansible/hosts

The `show parameter` sub command has the same new argument which is also
mutually exclusive with the --validation and --group arguments:

$ validation show parameter -h
$ validation show parameter --category os,system,hardware,ram

Change-Id: I4297f83355bdd209d21518fbadb17d1343fd4680
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
2021-07-27 07:00:47 +00:00
Jiri Podivin
4d1df7b0e7 New optional param for log path
As we now have a mechanism for falling back to
a default directory for logs and artifacts, we can allow
the customers to specify their own.

This patch add the argument to the CLI along with
minimum necessary information about the usage.

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: Id31a7ce2dfc4d9a132fea7d600e8beb8adc0739b
(cherry picked from commit 7876cab41586157a1b5e8fd426deb16d79567a52)
2021-06-10 14:07:10 +02:00
matbu
29b147e431 Override cliff command parser to handle argparser conflict_handler
The argparse conflict_handler is hardcoded in Cliff, this patch
override the command.Command().get_parser from Cliff in order
to change the value.

The conflict_handler from argparse is important for the VF because
it's allow callers to override VF CLI args.

Change-Id: I72524eeb3fc1ac0f384dcef25de61089ff15f67f
2021-06-04 12:14:55 +02:00
Jiri Podivin
e206da0933 Refactoring of the cli run module
Removal of unnecessary imports.
Minor stylistic adjustements.
New string format function.

Logging expansion for the extra vars loading.

Extra vars file handling factored out.

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I744f1f215750eb5b0bc3cb7005d4a81a35612fe9
2021-05-31 10:47:22 +02:00
Gael Chamoulaud (Strider)
f2e37b0f27 Make Python Interpreter option for Ansible Validation Run
This patch adds the --python-interpreter argument to the run
subcommand and allows the user to specify their own python interpreter.

Change-Id: Ie76d0238f117a48b2f919cd5bdc4dfae8b47ac5e
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
2021-05-20 04:39:33 +00:00
Gael Chamoulaud (Strider)
3e29d44743
Disable quiet mode run when using an Ansible Custom Callback
This patch disables the Ansible execution quiet mode when running
validations with a different Callback by passing --extra-env-vars
ANSIBLE_STDOUT_CALLBACK=default in the command line.

Change-Id: Ied50aaea240943b1eeba0c3c35b74bc7ccdb454c
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
2021-05-11 10:49:56 +02:00
Luigi Toscano
efca0653aa Add support for JUnitXML output (optional)
The support rely on junit_xml, which is also used by the junit
ansible callback plugin.

Change-Id: Ie484445e1b8602780c0faaeaf991b2de27032f3b
2021-05-05 11:03:26 +02:00
matbu
6329e3b63a Raise exception if result is empty
If results is empty in cli/run.py then we should raise
a RuntimeError otherwise, it will returns 0 without any
information.

Change-Id: Ic38690bd719658fe02a30691d112f3429523802a
2021-04-23 13:50:00 +00:00
matbu
5fad1a4d18 Create dedicated CLI for the Validation Framework
This review adds a CLI for the Validation Framework which will become
the only entry point to run the Validation Framework.

It will deprecate the tripleo_validatior.py CLI and the
validation.py script.

This patch uses python cliff library to provide nice helpers, shell
and output formats.

Change-Id: I66800ad51cc50f4eb37efabe85fb553dce008101
2021-04-20 11:52:35 +02:00