12 Commits

Author SHA1 Message Date
Jiri Podivin
3de8f4ddc9 Validation help improvement
New formatter prints text with proper line breaks
as well as the argument defaults.

Larger, and more frequently used, help strings were moved
to the validations_libs.cli.constants module.

Test was added for the conditional import of the cliff help formatter.

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I26648b495e075fb0e6f9741693eca2feed3fc140
2022-05-10 09:45:04 +02:00
Jiri Podivin
b24d4ce792 Validation actions refactor
Unused workdir argument of the run_validations method removed.

Host and playbook skipping simplified.

Docstrings adjusted, including some of the more important
inline code examples.

Test sensitivity to API changes was increased.
More strict assertions have been put on the calls made in CLI.

Logging statements related to the run action
in validation_actions.py were expanded.

New debug level logging statements introduced.

One of the testing constants in the fakes.py was altered
as it was not accurate representation of the real data,
and as such was breaking the new logging statements
during unit test runs.

Deprecation notice for 'log_path' and 'groups' arguments,
in both docstring and logging.

Redundant conditionals for argument types were removed.

The checks of the arguments are implemented
in the function called in the subsequent statement.

As there is no scenario in which one set of these checks
passes, while the other fails with the same values,
we can consider one of them to be redundant.

Helper function 'get_validations_details' without active references
was removed from utils submodule.

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I781f6a6f9fc4bd558af56b648f0e0ee9f165dfab
2022-01-21 13:33:22 +01:00
Zuul
1b94c03ee7 Merge "Add the community validation paths" 2021-11-18 19:39:23 +00:00
apetrich
5ba9c429d5 Add the community validation paths
The validation framework now respect and look for community
validation on the path. There config setting for
enable_community_validations is respected.

The community validations appear on validations list,
can be called by group, category, id and so on seamless
like any other validation.

Change-Id: I4a6230ac5433028c7297fa88f77728c87d60173d
Signed-off-by: Adriano Petrich (apetrich) <apetrich@redhat.com>
2021-11-18 09:55:30 +01:00
matbu
399d29059e Refactor set_argument_parser to fix shell regression
Openstack Client and Validation Shell is hitting a regression
due to set_argument_parser calling directly parse_known_args
from argparse.
This patch fix the regression and avoid the need to call
parse_known_args directly.

Closes-Bug: #1949596
Change-Id: Ic9a682e7c3d5431e8779064947bd379c00aba584
2021-11-17 00:02:58 +00:00
matbu
11488cd88d Add validation config file mechanism
Introduce validation config file.
The config default location of the config file will be stored
in /etc/validation.cfg

The variables precedence will be the following:
* user's cli args
* config file
* default interval values

Change-Id: I05c54a43bc0a03878793cca3f51e23f4a8b63a23
2021-08-20 08:12:16 +00:00
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
9db02ebefd Fix a regression in the ShowGroup sub-command
The ShowGroup sub-command was not working anymore due
to a regression introduced by the new CLI next generation
commit[1].

This patch fixes the ShowGroup sub-command by addressing the
following points:
  * The ValidationActions.group_information method should take
    the absolute path of the groups.yaml file by default.
  * Using cliff.lister.Lister base class instead of
    cliff.show.ShowOne base class for the ShowGroup class.

     Resolves: rhbz#1972155
[1] - 5fad1a4d18

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: Ia5aa3e96e8b5a6634a709ce8677f90108c80dfd3
2021-06-22 14:35:33 +02:00
Jiri Podivin
b2e87ca49a Refactoring of the cli show module
New logging statements for the action and related
method call of 'ValidationActions' class.

Expanded exception handling for the 'show_validations_parameters'
method of the 'ValidationActions' class.

Removal of superfluous imports.

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I2ad5a212dcd4cdb40ca04f7cce3d18c7527f63b2
2021-05-31 05:09:04 +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