5 Commits

Author SHA1 Message Date
apetrich
1c89a4d7ce Fix community init to respect cfg paths
The validation init did not respect the paths set on the
config file. Now it does.

Resolves: rhbz#2031069

Change-Id: Ia492b53f170d65f712a182a545ef09217449648c
2022-01-19 22:55:38 +01:00
matbu
17e689536f Add backward compatibility for python pathlib module
Pathlib is only available in python 3.6, this patch allow to run
lower version of python with pathlib2.

Change-Id: I36c3560815624eb3f4bc3d427d9549d73c449198
2022-01-06 20:24:58 +01:00
apetrich
68adc1fe16 Convert fstrings to .format to facilitate porting
Fstrings are a python 3.6 feature, in order to faciliate porting
to early architectures the fstrings were converted to .format

Change-Id: Ib23097c149ec8ff06cc70bb873b53ee45645ff15
2022-01-06 10:53:45 +01:00
Gael Chamoulaud (Strider)
53b573230a
Enforce existing roles and playbooks checks
This patch enforces the roles and playbooks checks when creating a new
community validation by checking first if the ANSIBLE_ROLES_DIR and
ANSIBLE_VALIDATION_DIR are existing in the host.

It avoids getting error message like:
  - [Errno 2] No such file or directory: '/usr/share/ansible/roles'
when validations-common and tripleo-validations are not installed.

It also adjusts the unittests in order to avoid leaving leftovers such
as community-validations directory during the test execution.

Change-Id: I6facca59c2ca9db2b5b1e7905ad8c9be68fff0b4
Signed-off-by: Gael Chamoulaud (Strider) <gchamoul@redhat.com>
2021-11-16 15:22:34 +01:00
Gael Chamoulaud (Strider)
1bbf282356
Add new CLI sub command to create community validations
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>
2021-10-29 15:39:39 +02:00