This parameter was deprecates, this patch clean the log path parameter
in the ValidationAction function.
Change-Id: I92bc1bdc7341308fd1989f78601e491f72f9bf6c
Introduces two new exceptions for Validation Framework
to be raised within appropriate context.
ValidationRunException - signifying incorrect behavior of the Run action code
ValidationShowException - signifying incorrect behavior of the Show actions code
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I87f315e7bb2e28a8572982a71fbe2be4432ff2c0
Callback plugins were transferred from validations-common
repository to validations-libs.
Necessary adjustments were made to the module structure,
requierements, as well as installation and documentation generator config.
Associated tests were moved as well, with removal of superfluous inheritance
and imports included.
Demonstration http server module for communication with `http_json`
callback was moved with directory structure preserved.
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I31768375430a2f29da71aae8f3db3882c373ced5
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
When using the custom callback feature through the run CLI subcommand,
by passing --extra-env-vars ANSIBLE_STDOUT_CALLBACK=default, the spinner
makes the output a bit ugly.
This patch disables the spinner in non quiet mode.
Change-Id: I9f92894fe446f4881e0234b1577e49f9e7091b7b
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
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>
The default value of the validation_path parameter
is now handled properly, without unnecessary conditional.
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I4cc16732ea9d98ec47c2dc616105944bdd6106f0
The skip list feature was available only via the API, this patch
allow the user to pass a file with the list of the validations
which he wants to skip during the run, example:
check-ram: hosts: all
reason: Wrong ram value
lp: https://lp.fake.net
check-cpu: hosts: undercloud
reason: Unstable validation
lp: https://lp.fake.net
Change-Id: I04059f9339085e0dcef1f018cad1be511ee7d3c7
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
The 'ValidationActions.group_information' method was refactored
to reflect new signature of the 'utils.parse_all_validations_on_disk' function.
Tests were adjusted accordingly.
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: Ic2ca556441169594792d7d5835ea057e9256a7a9
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>
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>
This patch removes the convert_data function which has been introduced
with the first one and deprecated Command Line Interface. The
--validation and --group arguments were sending comma-separated strings
instead of list. The new Command Line Interface is now enforcing this by
using its own CommaList Parser Action and only accepting List of groups
or validation names.
This function is now useless and can be removed safely. Tests and usages
have been modified accordingly.
Change-Id: Ief9459e914ea73fbd59a85c07a55c26078e0126a
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
Implementing a Spinner class and utilizing it around a run action. This
will add a moving icon that animates in place until output is reached,
letting the operator know that things are happening.
The interactive TTY test is included to ensure that during some unknown
usage such as logging to disk this feature doesn't spew unnecessary
clutter.
Change-Id: Ieef256a5c12b238008e9250c0ee182d80a2b6dfb
Validations logging now has several documented fallbacks.
constants.py now includes constant default path,
in order to improve readability and provide reference.
Tests are included.
Complementary patch for validations_commons callbacks
is optional, as the behavior should stay largely the same.
Co-Authored-By: mbu <mat.bultel@gmail.com>
Change-Id: Iab5f246f22fa6998ea6cec578eec6ebb5de13ad4
Two new logging calls for the list action on the
info and debbug level.
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I56044c93b03531159953c323f8e530d833819a5f
Removed unused imports.
Fixed up typos in help strings.
Replaced loop with list comprehesion in the `list_validations`
method of the `ValidationActions`.
Docstrings ammended to reflect actual state of the code.
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: Ie8deccf4c9c60872418a9c29da39f0d5baaad0bf
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
New optional parameter for the CLI limiting
number of validation results returned by history subcommand.
Resolves: rhbz#1944872
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: Ie79062e85351ed545c33001866773bf38fdf8517
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
The callback_whitelist is not usable via the Run action for now.
The patch allow users to pass a list of callbacks to whitelist
during the validation run.
Altered docstrings to include changed type spec.
Change-Id: I37eb369701ccbd1d3fd4a7601a5e626d5867381d
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Signed-off-by: Mathieu Bultel <mat.bultel@gmail.com>
Performance improvement is purely hypothetical.
However, the altered code is more readable.
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: Iaa85213a439ee4222c3d7fa6fc513458095b8ac3
All python classes already inherit from object implicitly.
There is no need to keep it there.
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: Ic56242fc20ef27e4b96b09319280e87db130e4cb
This patch depends on the callback modifcation which
allow to give other custom or default/standard callback
for the stdout from the user.
With the current situation, when passing another callback
than validation_json it breaks the VF logging.
We need to separate logging and stdout.
Change-Id: I1566d9763212f9538fea1c0885208db6b949023f
The current conversion works pretty well when passing a simple string
of validation or group names. But don't work when passing multiple
validation or group name.
```
>>> groups = "check-cpu"
>>> groups = [groups]
>>> print(groups)
['check-cpu']
>>> groups = "check-cpu,check-ram"
>>> groups = [groups]
>>> print(groups)
['check-cpu,check-ram']
```
This patch brings a better conversion when multiple validations or
groups are sent through a string.
Change-Id: Iba023a704dd873ea2df75c8cc6d78f929ef45bc2
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
This patch also adds unittests and docstrings for the
show_validations_parameters method.
Change-Id: I7da1ef5607f6a7b164f87dace3a49a14e6cbf06f
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
In some case we might get string instead of list - instead of failing,
just do a simple convertion and go on.
We also support both notation, either playbook name (foo.yaml) and
validation name (foo) in the search of valid content.
Co-Authored-By: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
Change-Id: I8d0288dae3cab131a8bc65e3d0b986dc6b9aec67
Closes-Bug: #1901676
This patch fixes multiple things:
* from validations_libs.validation_actions import show_validations_parameters
The generated file was containing the validations names and their
existing parameters as returned by the get_validations_parameters
method. But the file should only contains the parameters.
* from validations_libs.utils import get_validations_playbook
This method was supposed to get a list of validations playbooks
abs. path either by their names or their groups. This method was working
only when giving validation names but not with groups.
This patch fixes all the problems above and make the parameters
management work again.
Change-Id: Iec30cccade1234a127ef406ed13604cce45a72fd
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
When executing multiple validations with at least one unknown
validation, the CLI was executing only the existing ones but was not
informing the user that he/she typed one or more wrong validations.
This patch fixes that issue by detecting which validations are wrong and
inform the user.
Depends-On: https://review.opendev.org/758821
Change-Id: I4910043df07f32539793a2bc464377603fe2b02f
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
Some environment still use python2.7 and so /usr/bin/python
interpreter for ansible.
In that case, Ansible will fail to execute.
This option allow the user to pass a specific python interpeter
for the remote.
In None python_interpreter, and connection local is set we use
the local sys.executable, if both are None we use the default.
Change-Id: I4bd25ed50091a963d0b1e5e3a727ece19b90747e
Show history filtered by plays to get a better view
if a log file contains a lot of playbooks.
Add get_status action in order to get debug information
of a given validation failure
Change-Id: I29ab90647d9ef9c86546065ca16a62c401be1969
Removing playbook parameters from run_validation function
since its overlap validation_name functionality and make it
confusing.
Change-Id: Ifff9bdb327b38db07df6cac328cbd387f2bc46f1
Since the user can provide a path to a directory which can
be polute by undesirable files, filter by extension can avoid
parsing wrong files
Change-Id: I378b32d58cd1ec3a5688bba0831716bf94f18f05