Skip to content

Commit

Permalink
refac: Remove vagrant import when qa-ctl is running in a docker conta…
Browse files Browse the repository at this point in the history
…iner #1533
  • Loading branch information
jmv74211 committed Oct 7, 2021
1 parent 5dd3f78 commit 46339b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# Created by Wazuh, Inc. <info@wazuh.com>.
# This program is free software; you can redistribute it and/or modify it under the terms of GPLv2
import os
import vagrant
import sys

from shutil import rmtree

import wazuh_testing.qa_ctl.deployment.vagrantfile as vfile
if 'RUNNING_ON_DOCKER_CONTAINER' not in os.environ:
import vagrant

import wazuh_testing.qa_ctl.deployment.vagrantfile as vfile
from wazuh_testing.qa_ctl.deployment.instance import Instance
from wazuh_testing.qa_ctl import QACTL_LOGGER
from wazuh_testing.tools.logging import Logging
Expand Down
9 changes: 5 additions & 4 deletions deps/wazuh_testing/wazuh_testing/scripts/qa_ctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
PROVISION_KEY = 'provision'
TEST_KEY = 'tests'
WAZUH_QA_FILES = os.path.join(gettempdir(), 'qa_ctl', 'wazuh-qa')
RUNNING_ON_DOCKER_CONTAINER = True if 'RUNNING_ON_DOCKER_CONTAINER' in os.environ else False

qactl_logger = Logging(QACTL_LOGGER)
_data_path = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), 'data')
Expand Down Expand Up @@ -114,7 +115,7 @@ def set_environment(parameters):
"""
# Create the qa_ctl temporary folder
recursive_directory_creation(os.path.join(gettempdir(), 'qa_ctl'))

if parameters.run_test:
# Download wazuh-qa repository locally to run qa-docs tool and get the tests info
local_actions.download_local_wazuh_qa_repository(branch=parameters.qa_branch, path=os.path.join(gettempdir(), 'qa_ctl'))
Expand Down Expand Up @@ -223,7 +224,7 @@ def get_script_parameters():
def main():
configuration_data = {}
instance_handler = None
configuration_file = None
configuration_file = None

arguments = get_script_parameters()

Expand Down Expand Up @@ -269,7 +270,7 @@ def main():

# Run QACTL modules
try:
if DEPLOY_KEY in configuration_data and not arguments.skip_deployment:
if DEPLOY_KEY in configuration_data and not arguments.skip_deployment and not RUNNING_ON_DOCKER_CONTAINER:
deploy_dict = configuration_data[DEPLOY_KEY]
instance_handler = QAInfraestructure(deploy_dict, qactl_configuration)
instance_handler.run()
Expand Down Expand Up @@ -300,7 +301,7 @@ def main():
if arguments.run_test and launched['config_generator']:
config_generator.destroy()
else:
if 'RUNNING_ON_DOCKER_CONTAINER' not in os.environ:
if not RUNNING_ON_DOCKER_CONTAINER:
qactl_logger.info(f"Configuration file saved in {config_generator.config_file_path}")

if __name__ == '__main__':
Expand Down

0 comments on commit 46339b8

Please sign in to comment.