27 Commits

Author SHA1 Message Date
Jiri Podivin
12cd88dfe2 Fixes string formatting of the error msg log
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
2021-03-10 09:13:39 +01:00
Daniel Bengtsson
28e069f170 Remove the condition to check the groups.
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
2021-03-04 17:35:45 +01: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
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
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
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
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
c0de9faa41 Format output in json or yaml for validations show param
Change-Id: I93b35cd1619e2c2b4a3b1294171dddf56033e94f
2020-04-16 08:26:04 +00:00
Mathieu Bultel
c940a0c30d Add unit tests coverage for validation, group and logs classes
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
2020-04-02 09:41:30 +00:00
Mathieu Bultel
1daa430f9a Fix behavior for Show command to stick to tripleoclient
The behavior of the Show command wasn't exactly as tripleoclient
This review aims to fix it

Change-Id: I4e1af84675bfe722e232217f15c29fbc3d006333
2020-03-26 14:58:34 +01:00
Mathieu Bultel
c98ea9195a Add get validation playbook function and cleanup
Remove unsed function and add get validation playbook function

Change-Id: I5fbcbab7a402dd1149fa6df718f530a3ee5c6af2
2020-03-24 00:01:22 +01:00
Mathieu Bultel
bcd72301f6 Add validation log object representation
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
2020-03-23 21:54:21 +00:00
Mathieu Bultel
fd95a175b7 Implement Validation Show Parameters
Change-Id: Ie3366f4f32dd87871315cc9f95f7c2335df25e4b
2020-03-20 13:45:12 +00:00
Mathieu Bultel
491a27b53c Add validation_actions class and group info implementation
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
2020-03-20 13:44:53 +00:00
Mathieu Bultel
95edef7a8c Move validation data as object
Change-Id: I1b82f3ef24b80d55f96bd76c17278b988e4b611d
2020-03-20 13:21:13 +00:00
Mathieu Bultel
132735a697 Remove unused classes for PushD and Tempdir
Change-Id: I169036ef7556e7d259c0b84dd357eba7230d9313
2020-03-17 16:10:17 +01:00
Mathieu Bultel
d2c91c8080 Add validations show functions
This review add functionnalities to parse and show
validations output as dict with the required format

Change-Id: I57ca3d18397c7fbdb084b06224d7cab3d4592d30
2020-03-17 09:54:28 +00:00
Gael Chamoulaud (Strider)
84aa2b6846
Improve the way we log on the file system
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>
2020-03-11 17:07:56 +01:00
Mathieu Bultel
07e56863b9 remove untested get_result functions from this PR 2020-03-09 14:44:24 +01:00
Mathieu Bultel
32d15b6a1b Add unit tests for ansible runner library 2020-03-09 14:21:03 +01:00
Mathieu Bultel
0a71d73e4e fix nits 2020-03-04 15:26:35 +01:00
Mathieu Bultel
9e308dbae4 fix pep8 lint 2020-03-04 10:50:14 +01:00
Mathieu Bultel
138ef53e5b Add run and ansible_runner execution 2020-03-04 10:50:14 +01:00
Mathieu Bultel
ec9c986de8 fix module import 2020-03-03 18:57:40 +01:00
Mathieu Bultel
8cce4bfd64 Add utils functions and validations List object 2020-03-03 16:55:20 +01:00