157 Commits

Author SHA1 Message Date
Zuul
c54307403a Merge "show command now properly uses list of validations" 2021-02-18 16:51:15 +00:00
Zuul
58c757cdee Merge "Add skip list option in order to provide a black list for validation" 2021-02-18 09:03:46 +00:00
Mathieu Bultel
618cde0569 Add skip list option in order to provide a black list for validation
Should be formed as:
{'xyz':
  {'hosts': 'ALL',
   'reason': None,
   'lp': None}
}

Change-Id: I030344ad3ec117548b78284cb4f12265a0719c3a
2021-02-17 16:36:41 +01:00
Zuul
ee8e9ec7d9 Merge "One of the two nested calls of os.path.join was redundant." 2021-02-16 22:32:05 +00:00
Jiri Podivin
f60caf8e66 show command now properly uses list of validations
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: Iced465a7380acc2bd7065c1fc2dc34e6ddcd9b15
2021-02-15 14:03:55 +01:00
Zuul
e4eaf3fda1 Merge "Add new test for the parse_all_validations_on_disk" 2021-02-03 12:59:31 +00:00
Zuul
f47226349a Merge "OrderedDict can be constructed directly from dict instance" 2021-02-02 23:40:25 +00:00
Zuul
448be63525 Merge "Secondary loop removed. params_only dict now uses update method." 2021-02-02 23:40:12 +00:00
Owen McGonagle
aa54ac2c6f Add new test for the parse_all_validations_on_disk
Add a new test to raise exeception if you have no groups in your playbook.

Co-authored-by: Daniel Bengtsson <dbengt@redhat.com>
Change-Id: I984304ec22511709370e36f4b4fb6a43100b043c
2021-02-02 11:44:01 -05:00
Owen McGonagle
e21f6f11f8 Add an error message when groups is not found in the playbook
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
2021-01-27 13:20:38 -05:00
Jiri Podivin
c29636eab5 One of the two nested calls of os.path.join was redundant.
os.path.join can accept arbitrary number of path likes,
nesting the calls is therefore unnecessary.

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I19010de832b2dd0b7f1b4940c9f770929d041053
2021-01-27 17:38:56 +01:00
Jiri Podivin
45b8600a1a Secondary loop removed. params_only dict now uses update method.
Performance improvement is purely hypothetical.
However, the altered code is more readable.

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: Iaa85213a439ee4222c3d7fa6fc513458095b8ac3
2021-01-25 17:52:44 +01:00
Zuul
528c44b4e7 Merge "Local vars were redefining builtins" 2021-01-22 17:12:53 +00:00
Jiri Podivin
4b9dff2671 OrderedDict can be constructed directly from dict instance
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I7a49a8e4cc45076de090d979eabc4fef7fb0f043
2021-01-22 15:36:25 +01:00
Mathieu Bultel
a0db6e4892 Allow to provide different stdout callback to the libs
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
2021-01-18 07:53:19 +01:00
Jiri Podivin
8dc1549ddd Local vars were redefining builtins
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: Iecdcae0be0d8363668f77f9de4f8a431a8162f5e
2021-01-14 12:54:39 +01:00
Mathieu Bultel
5d43279cc4 Dockerfile for installing Validation Framework in a CentOS container
Change-Id: I72b36d24fff0c621c7b97d93533a593ab68207e0
2021-01-07 09:06:56 +00:00
Gael Chamoulaud (Strider)
276c20d88c
Fix typo in validations_libs/ansible.py
s/validagions-libs-ansible/validations-libs-ansible/

Change-Id: Id8f9b8f85a7bed0f39c81650eceea0334dc5d816
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
2021-01-04 09:19:51 +01:00
Mathieu Bultel
87e4917f1b Move ansible-runner version to 1.4.0
Upstream requirements in stable/train is under ansible-runner 1.4.0.
This patch move the version to 1.4.0 according to openstack/requirements.
It changes the backward compat version according to this version in
validations_libs/ansible.py

Change-Id: I311d077c13a7d95314eb83072f5652646fef1bf8
2020-12-17 10:52:18 +01:00
Zuul
e9fe6b5b1b Merge "Bump pre-commit-hooks to v3.3.0" 2020-12-16 19:13:35 +00:00
Zuul
3e6434afe2 Merge "Handle dynamically the ansible artifacts dir path" 2020-12-16 12:59:15 +00:00
Mathieu Bultel
fd226ce290 Handle dynamically the ansible artifacts dir path
Change-Id: Ic28afceca1decc6f5bf3bdd5a2630c1a44138e5a
2020-12-11 13:13:19 +00:00
Gael Chamoulaud (Strider)
5d55cfde1d
Make the measuring code coverage test working
Change-Id: I9e28b3b08685ea7a7ae1ed73888d8160728f5ded
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
2020-12-11 10:23:15 +01:00
Kevin Carter
bd122295ef The lower constraint file has been removed
This file, and its tests, are not useful for tripleo so we're
removing because they're now becoming problematic.

Change-Id: Ibba148d3763fcf54988241a33c7d2c2c67c6ef9a
Signed-off-by: Kevin Carter <kecarter@redhat.com>
2020-12-08 15:19:58 -06:00
Zuul
551abb5ece Merge "Update TOX_CONSTRAINTS_FILE" 2020-12-01 18:47:24 +00:00
Gael Chamoulaud (Strider)
99071ee1c8
Bump pre-commit-hooks to v3.3.0
This patch also uses pycqa/flake8 instead of the default one proposed by
pre-commit and which is deprecated.

Change-Id: Iba243abc1ec01912edb4b3645f8ccce95e0f2e88
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
2020-11-26 12:42:21 +01:00
Mathieu Bultel
0641b17a5a Handle unreachable case in the log statistics
The unreachable status is a fail state that should be treat.

Change-Id: Ia610448421196572909567deb144d9a490be27a0
2020-11-26 10:43:27 +01:00
wu.shiming
671e3221e9 Update TOX_CONSTRAINTS_FILE
UPPER_CONSTRAINTS_FILE is old name and deprecated
-https://zuul-ci.org/docs/zuul-jobs/python-roles.html#rolevar-tox.tox_constraints_file
This allows to use lower-constraints file as more
readable way instead of UPPER_CONSTRAINTS_FILE=<lower-constraints file>.

Change-Id: I07c39901744580a45f26f19ce60a54510c10d701
2020-11-19 17:27:03 +08:00
Gael Chamoulaud (Strider)
be5a95d4e0
Add Docstrings to validations_libs/ansible.py file
Change-Id: I97ed9705ba4e8678609af661c704e957aa907872
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
2020-11-18 12:24:25 +01:00
Gael Chamoulaud (Strider)
9f644f0dd7
Add Docstrings to validations_libs/validations_logs.py file
This patch also adds new unittests.

Change-Id: I6f299db1b22d98fdabc148e297098e023cf863bd
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
2020-11-18 12:24:06 +01:00
Gael Chamoulaud (Strider)
c1115710c7
Add Docstrings to validations_libs/validation_action.py file
Change-Id: I69fc8bc37ff0009e9bbc4d0fe32ea444174ca9e7
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
2020-11-18 12:23:39 +01:00
Gael Chamoulaud (Strider)
10e9a19f22
Add Docstrings to validations_libs/group.py file
Change-Id: I857a54eb2b42acbcad19f3b16b1aa9e6922dc1b9
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
2020-11-18 12:21:28 +01:00
Gael Chamoulaud (Strider)
eb62054a33
Enforce the way we encapsulate a Validation
This patch ensures that the playbook is respecting the minimal structure
of a validation. This patch also adds DocStrings to the Validation class
and new unittests according to the enforcement changes.

Change-Id: I0809163cbd661cbd24705ed348281c7818a944b4
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
2020-11-13 09:35:50 +01:00
Gael Chamoulaud (Strider)
a6271afa38
Add docstrings to utils.py
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>
2020-11-09 15:03:08 +01:00
Gael Chamoulaud (Strider)
484d7a9a78
Remove output format test in utils.get_validations_parameters
This is now done in validation_actions.show_validations_parameters(..)
[1].

[1] https://opendev.org/openstack/validations-libs/src/branch/master/validations_libs/validation_actions.py#L206-L209

Change-Id: I9f90ba97758422a35280b91e6d3edae624564728
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
2020-11-09 14:11:12 +01:00
Gael Chamoulaud (Strider)
63e30c744c
Add better conversion of string parameters into a list
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>
2020-11-04 14:05:11 +01:00
Gael Chamoulaud (Strider)
9192d5826c
Don't rely on parameter file extension for downloading
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>
2020-11-04 09:48:08 +01:00
Zuul
410c03c88e Merge "add Vagrantfile for Validation Framework dev work" 2020-10-28 11:01:29 +00:00
Cédric Jeanneret
6d0d1ce06d Ensure we're using proper types for validation_name and _id
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
2020-10-27 15:12:40 +01:00
Zuul
0c7eda82d3 Merge "Fix parameters management" 2020-10-26 12:46:02 +00:00
Zuul
5d372338f6 Merge "[Validator Run] Detect unknown validations from the command-line" 2020-10-26 12:36:36 +00:00
Gael Chamoulaud (Strider)
d79245eb82
Fix parameters management
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>
2020-10-22 17:26:40 +02:00
David J Peacock
c59ea3016f add Vagrantfile for Validation Framework dev work
Added a development environment shortcut by way of Vagrantfiles for
CentOS and Ubuntu; also updated README.rst to indicate usage.

Change-Id: I561ecd6cede3c5cdb7605e368d2b031b05612133
2020-10-21 17:44:05 +00:00
Zuul
c727b7c2ac Merge "Remove CI roles from validations-libs" 2020-10-21 12:52:53 +00:00
Gael Chamoulaud (Strider)
87114686ae
[Validator Run] Detect unknown validations from the command-line
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>
2020-10-21 12:29:01 +02:00
Mathieu Bultel
2c2b71a3fa Remove CI roles from validations-libs
The CI roles are stored on both repos:
validations-common and validations-libs.
We need to stored those roles only in one place.

This review removed the roles from validations-libs
and used it from validations-common

Change-Id: Ia343509716f0a7769c8edcd502a678927935b419
2020-10-21 07:50:29 +00:00
Zuul
96cf2f27c2 Merge "Fix show validation stats with correct number" 2020-10-19 13:03:44 +00:00
Mathieu Bultel
cba2ce087d Add parameters values to the validation show command
The parameters was missing to the validation show output.

Change-Id: I1d2ebeb3fbe8a1438e8acec77d3a15b2816f786f
2020-10-14 07:47:09 +02:00
Mathieu Bultel
0e46a5b710 Fix show validation stats with correct number
Change-Id: I48a09cac03bd5dea69e216babc7f4332ad47f52b
2020-10-13 16:05:55 +02:00
Sébastien Boyron
22a90ed09c Add ansible dependency
In order to install new ansible roles in /usr/share/ansible/roles
ansible is required as rpm dependency.
refers to review I0198834772323504f69244664307fbb8dfe7dd7c

RPM depencies are sync to projects requirements in order to keep
it clean this dependency should be added

Version tooked from  tripleo-ansible requirements.txt

Change-Id: I52afb89fe5f5a0824a5808c7623087257aa23c0a
2020-10-07 14:49:17 +02:00