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>
Presently, the operator(s) can only execute the official and supported
validations coming from tripleo-validations and validations-common.
Community validations enable a sysadmin to create and execute
validations unique to their environment.
This patch introduces the new Command Line Interface sub command to
create a new community validation skeleton. First, this latter will
check if there is an existing role or a playbook either in the community
validations catalog or the official validations catalog. And it will
create an Ansible role (with ansible-galaxy[1]) and a playbook in the
~/community-validations directory.
By default, the community validations feature is enabled but may be
disabled by setting [DEFAULT].enable_community_validations to ``False``
in the validation configuration file.
Example:
[stack@localhost]$ validation init my-new-validation
Validation config file found: /etc/validation.cfg
New role created successfully in /home/stack/community-validations/roles/my_new_validation
New playbook created successfully in /home/stack/community-validations/playbooks/my-new-validation.yaml
For a full demo of this new CLI sub command, please take a look at this
asciinema[2].
[1] - https://docs.ansible.com/ansible/latest/cli/ansible-galaxy.html
[2] - https://asciinema.org/a/445105
Change-Id: I8fb16e3456696187d4a9d3820740a7639a96e315
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
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
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>
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)
The patch f2830c52446b1bd57383e91e6eb3da84cfdab1c7 introduced
several potentially breaking bugs, which have to be fixed.
Namely, several of the termination conditionals lacked proper
return statements.
In addition to the fix of the previously describe issues
the following changes are included to prevent more arising in
the future.
Every major behavioral branch now has a dedicated log statement.
Test coverage included.
Expanded docstrings.
Increased expressiveness of var names.
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: Ie7471361acf1f4ae197e76b22eb7ba4d3f62fe92
Paths in the constants.py are now formatted
using a single function, the os.path.join.
This both normalizes the code and reduces
chance of errors and confusion arising
from nonstandard paths.
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I761c4449579590b9081a78627eeac754d6b04e2a
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
Apart from incomplete output the incorrect formatting
causes followup exception further obfuscating the original issue.
Minor issue related to:
BGZ:1895045
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: Ibed0bc4b78be957819205bed76073e72820ab2a1
The code of the groups property in the Validation class changed. Before
the code didn't check if the key groups was there. You can see the
change[1] to have more information.
[1] eb62054a33
Closes-bug: #1917785
Co-authored-by: Owen McGonagle <omcgonag@redhat.com>
Change-Id: Ib11fd1b829bd56c19f82081d53440b4dd8237f3f
If there are no groups in the playbook, we currently get a python error
when running command 'openstack tripleo validator group info'
Change-Id: Ice089c33d566e90bea55e18fe7f77f9d33fe81f3
This patch also adds new unittests for the following functions:
- from validations_libs.utils import get_validations_data
> test_get_validations_data_wrong_type(..)
- from validations_libs.utils import get_validations_details
> test_get_validations_details_wrong_type(..)
Change-Id: Iac9ba971a73ed09b26d3e41efb38ad72dd942bbc
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
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>
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>
Increase the unit tests coverage for recent code:
validation, group and logs classes.
(Increase of 54 unit tests)
Move per action files into one test file:
test_validation_actions
Change-Id: I7a1a8b0681c13ebd758a5686b2398a0a9e87a4eb
Create two classes for Log and Logs in order to get
a simpler representation of the validation Log and
provide easy way to manage the log data informations
Change-Id: I743355cef943e43492264d4c4700bebbeab9a37d
Move all validation actions into a ValidationActions class
in order to have one object with several validations actions
Add group info implementation
And add group object like validation object to have
a simpler representation of the validation group.
Change-Id: Idc7a55e26de20968f0a6a90f2a005d21a30c9e70
This review add functionnalities to parse and show
validations output as dict with the required format
Change-Id: I57ca3d18397c7fbdb084b06224d7cab3d4592d30
Improve the way we log on the file system and share
the same uuid for callback logging and ansible
runner and artifact logging
This patch also adds zuul.d directory:
* Adds zuul.d/layout.yaml
* Adds .gitreview file
* Fixes ansible-runner requirements issue
Co-Authored-By: Gael Chamoulaud <gchamoul@redhat.com>
Change-Id: I4da8c1974362029754aa5b09cd8e6c7d6a27dd0d
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>