Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add QACTL logging #1791

Merged
merged 9 commits into from
Aug 27, 2021
Merged

Add QACTL logging #1791

merged 9 commits into from
Aug 27, 2021

Conversation

jmv74211
Copy link
Contributor

Related issue
close #1713

Description

The goal of this PR is to add custom logging to QACTL, replacing all vagrant and ansible output by default.

This PR makes the following changes:

  • Create new custom logging module
  • Create new QACTLConfiguration module for managing custom configuration
  • Add new config section in QACTL configuration file for managing custom configuration like logging...
  • Add QACTL modules logging to:
    • Deployment module
    • Provision module
    • Run test module
  • Handle an error when creating docker networks
  • Add config section of configuration file schema validation

Now we can organize the output by the following levels

An example of logging with INFO level is the following:

2021-08-26 16:32:09,292 - INFO - qa_infraestructure - Running 3 instances deployment...
2021-08-26 16:32:41,377 - INFO - qa_provisioning - Checking hosts SSH connection...
2021-08-26 16:32:59,524 - INFO - qa_provisioning - Provisioning 3 instances...
2021-08-26 16:37:00,603 - INFO - qa_test_runner - Launching 3 tests...
2021-08-26 16:37:00,606 - INFO - qa_test_runner - Waiting until tests finish...
2021-08-26 16:37:01,884 - INFO - pytest - Running /tmp/wazuh-qa/tests/integration/test_vulnerability_detector/test_general_settings/test_general_settings_enabled.py test on ['172.16.1.90'] hosts...
2021-08-26 16:37:01,910 - INFO - pytest - Running /tmp/wazuh-qa/tests/integration/test_vulnerability_detector/test_general_settings/test_general_settings_enabled.py test on ['172.16.1.70'] hosts...
2021-08-26 16:37:01,923 - INFO - pytest - Running /tmp/wazuh-qa/tests/integration/test_vulnerability_detector/test_general_settings/test_general_settings_enabled.py test on ['172.16.1.80'] hosts...
2021-08-26 16:37:11,971 - INFO - qa_test_runner - Tests have been finished...

We can configure this logging in the new configuration section:

deployment:
  ...
provision:
  ....
tests:
  ...
config:
    vagrant_output: <boolean>
    ansible_output: <boolean>
    logging:
        enable: <boolean>
        level: "DEBUG|INFO|WARNING|ERROR|CRITICAL"
        file: <string>

@jmv74211 jmv74211 self-assigned this Aug 26, 2021
@jmv74211 jmv74211 merged commit d14177c into 1533-qa-ctl Aug 27, 2021
@jmv74211 jmv74211 deleted the 1713-development branch August 27, 2021 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants