From 8830c69e483e965ad5c39c8b92fbc5be12edaa51 Mon Sep 17 00:00:00 2001 From: Jiri Podivin Date: Wed, 12 May 2021 15:09:35 +0200 Subject: [PATCH] Expansion of logging for the run action. Logging statements related to the run action in validation_actions.py were expanded. New debug level logging statements introduced. One of the testing constants in the fakes.py was altered as it was not accurate representation of real data, and as such was breaking the new logging statements during unit test runs. Signed-off-by: Jiri Podivin Change-Id: Ic308a76f4f6af6e7fe64930e84360bfb4ed587be --- validations_libs/tests/fakes.py | 6 +++--- validations_libs/validation_actions.py | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/validations_libs/tests/fakes.py b/validations_libs/tests/fakes.py index 325c8457..a0f46d2c 100644 --- a/validations_libs/tests/fakes.py +++ b/validations_libs/tests/fakes.py @@ -43,9 +43,9 @@ VALIDATION_LIST_RESULT = (('ID', 'Name', 'Groups'), ['prep', 'pre-introspection'])]) GROUPS_LIST = [ - ('group1', 'Group1 description'), - ('group2', 'Group2 description'), - ('group3', 'Group3 description'), + 'group1', + 'group2', + 'group3' ] BAD_VALIDATIONS_LOGS_CONTENTS_LIST = [{ diff --git a/validations_libs/validation_actions.py b/validations_libs/validation_actions.py index c13e70ee..4b9c90c0 100644 --- a/validations_libs/validation_actions.py +++ b/validations_libs/validation_actions.py @@ -332,7 +332,9 @@ class ValidationActions(object): validations_dir = (validations_dir if validations_dir else self.validation_path) if group: - self.log.debug('Getting the validations list by group') + self.log.debug( + 'Getting the validations from groups {}'.format( + ','.join(group))) try: validations = v_utils.parse_all_validations_on_disk( validations_dir, group) @@ -341,6 +343,10 @@ class ValidationActions(object): except Exception as e: raise(e) elif validation_name: + self.log.debug( + "Getting the {} validation.".format( + validation_name)) + validation_name = v_utils.convert_data(validation_name) playbooks = v_utils.get_validations_playbook(validations_dir, @@ -362,7 +368,12 @@ class ValidationActions(object): raise RuntimeError("No validations found") log_path = v_utils.create_log_dir(log_path) - self.log.debug('Running the validations with Ansible') + + self.log.debug(( + 'Running the validations with Ansible.\n' + 'Gathered playbooks:\n -{}').format( + '\n -'.join(playbooks))) + results = [] for playbook in playbooks: # Check if playbook should be skipped and on which hosts