Commit Graph

24 Commits

Author SHA1 Message Date
Zuul
8df76018d9 Merge "Expand validations_logs table with reason of failure" 2022-05-10 00:46:00 +00:00
Zuul
69cd8a4973 Merge "Removed explicit inheritance from object" 2022-04-28 21:27:32 +00:00
Jiri Podivin
5fd83d3ee9 get_status property simplification and optimization
Property was simplified to be more readable
and optimized so it doesn't loop over all stats
if it doesn't need to.

Reference to unsupported return value was removed.

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I887b6e0d1e561b965f1c6d5119c7cb54cf30f1d2
2022-04-21 08:19:14 +00:00
matbu
51bd6ab776 Expand validations_logs table with reason of failure
This patch adds a new col in the result table with the reason
of the failure. It avoid to dig into the logs for each failed
validations.

Example:
https://paste.opendev.org/show/809351/

Change-Id: I4723b87b71390e1364480a8ca93e7dc7b3e654a5
2021-12-13 15:10:54 +00:00
Jiri Podivin
583fad78db Simplification of the log path handling by the ValidationLog class
Redundant checks were removed an branching reduced.
Previously de-facto function _get_content now behaves as
a method should and works with attributes.

Several string processsing snippets were factored out
and are now separate helper methods.

Added check for abs path.

Changed related test to provide absolute path.
Added new test case for absolute path checking.

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I46df7b4befbef36a74b9138961650806c457fc13
2021-07-01 15:02:41 +00:00
Jiri Podivin
eb439a35db Expansion of logging for the show action.
New logging calls on the debug level.

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I3b2f0bfaa9d92e9cc664dea8ba5f7966c6931837
2021-05-31 05:16:00 +00:00
Jiri Podivin
a12c531409 Exceptions now indicate cause where applicable
Potentially helping with debugging
and contributing to faster issue resolution.

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I4b3db6b6416c0b81ce0397e10c833b342dbc2c0e
2021-04-16 16:47:58 +02: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
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
Zuul
e9fe6b5b1b Merge "Bump pre-commit-hooks to v3.3.0" 2020-12-16 19:13:35 +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
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
Mathieu Bultel
21a722adac Show history by play and add get status action
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
2020-07-06 15:10:37 +00:00
Zuul
e1caff945f Merge "Filter get_all_log_file by extension" 2020-06-15 20:16:02 +00:00
Mathieu Bultel
c1d9cb9b92 Filter get_all_log_file by extension
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
2020-06-12 09:19:41 +02:00
Mathieu Bultel
373bdb08d7 Catch value error when extract log info from log name
We need to catch ValueError when we extract log information
from the file name provided by user.
Instead of raising an exception, we just log a warning to the
user. The normal usage can handle None uuid or timestamp or
validation-id.
This will aim to make the ValidationLog class more generic.

Change-Id: Iccc2a37b4c2c911e634a210de253ba1111e5b7e7
2020-06-10 22:14:43 +02:00
Mathieu Bultel
b5cc8dff75 Handle multiple validation logs results
Change-Id: I49d284edc2e1c54fb8c365e52146c656440b5db2
2020-05-18 14:53:52 +02:00
Mathieu Bultel
1477887091 Avoid None value when missing data in ansible log
When missing datas in ansible log for some reasons,
we need to avoid None value, and just ignore it.

Change-Id: Ic6e05bf65bf01eeafd5e9222f3410a4dc5a50c9e
2020-05-14 09:48:31 +00:00
Mathieu Bultel
ade5d57a3e Raise exception if no validation is found
In addition, I have to fix pep8 issue, due to new version

Change-Id: I04728bfdb6473c47c248a4a56bb8df647c51f5ef
2020-05-13 13:50:36 +02: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
e367d62445 Implement validation show history command
Implement validation show history command in validation_actions

Change-Id: I97c9df5e08c2358612704fcdb78cf24cd6f8e421
2020-03-23 22:16:07 +00: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