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
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
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
Performance improvement is purely hypothetical.
However, the altered code is more readable.
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: Iaa85213a439ee4222c3d7fa6fc513458095b8ac3
The condition checking existence ansible_artifact_path was redundant.
Similar, but more comprehensive, check is performed previously in the method,
along with missing path resolution.
Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: Icf5de856ddbc877dfdd19354b102197fefe40eec
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
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
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>
This patch also adds new unittests.
Change-Id: I6f299db1b22d98fdabc148e297098e023cf863bd
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
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>
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>
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
In order to override the constants base dir value easily
for ansible, the base_dir param can be passed to the run
function
Change-Id: I8727ac442cd1bb08b1c8587e3e9e8d9be1def358
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