17 Commits

Author SHA1 Message Date
Jiri Podivin
5a23115811 Expanding logging facilities to rest of the framework
Logger was introduced in If8ed6510dad16dc8495717789bb132b957828e0d
and so far has been performing admirably.

We can now expand it to the rest of the library and remove leftovers
from the original setup. This way we can establish proper monitoring
of code execution across our tool and provide operators with
more actionable information.

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I3dd296c8b8b9a33f87a451dd7bef68b38ba60af7
2022-11-23 09:16:18 +00:00
Zuul
69cd8a4973 Merge "Removed explicit inheritance from object" 2022-04-28 21:27:32 +00:00
apetrich
5ba9c429d5 Add the community validation paths
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>
2021-11-18 09:55:30 +01:00
Gael Chamoulaud (Strider)
c46c90394c Add Products metadata key management
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>
2021-07-27 07:01:05 +00:00
Gael Chamoulaud (Strider)
3928305329 Add Categories metadata key management
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>
2021-07-27 07:00:47 +00:00
Jiri Podivin
a9515a3182 get_formatted_data optimization
The property previously used multiple loops and nested
conditions for making a dictionary copy with formatted keys.

Now it uses just one.
Could be reduced further assuming substitution of 'Id' for 'ID'.

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I6ef708b6d39ac56354881b89421ff4c0771c6ab5
2021-06-17 15:01:31 +02:00
Zuul
fbcce5894c Merge "Fix the syntax for groups in documentation." 2021-03-15 21:05:12 +00:00
Daniel Bengtsson
01103d6739 Refactor the groups property in Validation class.
Improve the code and remove the condition to check the groups. Use the
default value from the get method.

Co-authored-by: Owen McGonagle <omcgonag@redhat.com>
Change-Id: I693ba3699ab2c1b50f92b4f60f309d8c529a23c4
2021-03-04 00:21:06 +01:00
Daniel Bengtsson
7754b368c5 Fix the syntax for groups in documentation.
The groups list must be in the metadata.

Change-Id: Id64f71ad8fc02db84a18a27923919b9b03072bb3
2021-03-03 11:18:51 +01:00
Zuul
f47226349a Merge "OrderedDict can be constructed directly from dict instance" 2021-02-02 23:40:25 +00:00
Jiri Podivin
a68b40af2d Removed explicit inheritance from object
All python classes already inherit from object implicitly.
There is no need to keep it there.

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: Ic56242fc20ef27e4b96b09319280e87db130e4cb
2021-01-22 16:07:43 +01: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
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
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
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
fd95a175b7 Implement Validation Show Parameters
Change-Id: Ie3366f4f32dd87871315cc9f95f7c2335df25e4b
2020-03-20 13:45:12 +00:00
Mathieu Bultel
95edef7a8c Move validation data as object
Change-Id: I1b82f3ef24b80d55f96bd76c17278b988e4b611d
2020-03-20 13:21:13 +00:00