diff --git a/deployability/modules/allocation/main.py b/deployability/modules/allocation/main.py index cf6b60b1bb..8a69d380a7 100755 --- a/deployability/modules/allocation/main.py +++ b/deployability/modules/allocation/main.py @@ -2,9 +2,6 @@ import os import sys -project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '../..')) -sys.path.append(project_root) - from modules.allocation import Allocator from modules.allocation.generic.models import InputPayload @@ -21,10 +18,8 @@ def parse_arguments(): parser.add_argument("--working-dir", required=False, default='/tmp/wazuh-qa') return parser.parse_args() - def main(): Allocator.run(InputPayload(**vars(parse_arguments()))) - if __name__ == "__main__": main() diff --git a/deployability/modules/provision/main.py b/deployability/modules/provision/main.py index a222680f78..355461923e 100755 --- a/deployability/modules/provision/main.py +++ b/deployability/modules/provision/main.py @@ -6,9 +6,6 @@ # ---------------- Vars ------------------------ -project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '../..')) -sys.path.append(project_root) - from modules.provision import Provision, models # ---------------- Methods --------------------- diff --git a/deployability/modules/setup.py b/deployability/modules/setup.py index a0ae65eefb..982b78018c 100644 --- a/deployability/modules/setup.py +++ b/deployability/modules/setup.py @@ -22,15 +22,6 @@ def get_version(): version = data['version'] return version -scripts_list = [ - 'models=workflow_engine.models:main', - 'schema_validator=workflow_engine.schema_validator:main', - 'task=workflow_engine.task:main', - 'workflow_processor=workflow_engine.workflow_processor:main', - 'main=workflow_engine.main:main', - 'logging=workflow_engine.logging.logger:main' -] - package_data_list = get_files_from_directory("workflow_engine") setup( @@ -44,7 +35,6 @@ def get_version(): packages=['workflow_engine'], package_dir={'workflow_engine': 'workflow_engine'}, package_data={'workflow_engine': package_data_list}, - entry_points={'console_scripts': scripts_list}, include_package_data=True, zip_safe=False ) \ No newline at end of file diff --git a/deployability/modules/testing/main.py b/deployability/modules/testing/main.py index d7fef49089..10c0c3fe87 100755 --- a/deployability/modules/testing/main.py +++ b/deployability/modules/testing/main.py @@ -2,9 +2,6 @@ import sys import os -project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '../..')) -sys.path.append(project_root) - from modules.testing import Tester, InputPayload def parse_arguments(): diff --git a/deployability/modules/workflow_engine/logging/__init__.py b/deployability/modules/workflow_engine/logger/__init__.py similarity index 100% rename from deployability/modules/workflow_engine/logging/__init__.py rename to deployability/modules/workflow_engine/logger/__init__.py diff --git a/deployability/modules/workflow_engine/logging/config.yaml b/deployability/modules/workflow_engine/logger/config.yaml similarity index 100% rename from deployability/modules/workflow_engine/logging/config.yaml rename to deployability/modules/workflow_engine/logger/config.yaml diff --git a/deployability/modules/workflow_engine/logging/filter.py b/deployability/modules/workflow_engine/logger/filter.py similarity index 99% rename from deployability/modules/workflow_engine/logging/filter.py rename to deployability/modules/workflow_engine/logger/filter.py index 9ef98fa179..099193a3ac 100644 --- a/deployability/modules/workflow_engine/logging/filter.py +++ b/deployability/modules/workflow_engine/logger/filter.py @@ -1,7 +1,6 @@ import logging import threading - class ThreadIDFilter(logging.Filter): """ A filter that uppercases the name of the log record. diff --git a/deployability/modules/workflow_engine/logging/logger.py b/deployability/modules/workflow_engine/logger/logger.py similarity index 99% rename from deployability/modules/workflow_engine/logging/logger.py rename to deployability/modules/workflow_engine/logger/logger.py index a3d46cb1a6..5922e6cc9a 100644 --- a/deployability/modules/workflow_engine/logging/logger.py +++ b/deployability/modules/workflow_engine/logger/logger.py @@ -5,7 +5,6 @@ import yaml - def _load_config() -> None: """ Loads the logging configuration from 'config.yaml' file. diff --git a/deployability/modules/workflow_engine/main.py b/deployability/modules/workflow_engine/main.py index b298176b4e..8a7e9e4f00 100755 --- a/deployability/modules/workflow_engine/main.py +++ b/deployability/modules/workflow_engine/main.py @@ -6,9 +6,6 @@ import sys import argparse -project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '../..')) -sys.path.append(project_root) - from workflow_engine.workflow_processor import WorkflowProcessor from workflow_engine.models import InputPayload diff --git a/deployability/modules/workflow_engine/schema_validator.py b/deployability/modules/workflow_engine/schema_validator.py index 66b51b73ca..ae13a6da9f 100755 --- a/deployability/modules/workflow_engine/schema_validator.py +++ b/deployability/modules/workflow_engine/schema_validator.py @@ -5,8 +5,7 @@ from pathlib import Path from ruamel.yaml import YAML -from workflow_engine.logging.logger import logger - +from workflow_engine.logger.logger import logger class SchemaValidator: """ diff --git a/deployability/modules/workflow_engine/task.py b/deployability/modules/workflow_engine/task.py index 8eb1595c91..ea850f1e05 100755 --- a/deployability/modules/workflow_engine/task.py +++ b/deployability/modules/workflow_engine/task.py @@ -7,8 +7,7 @@ import time from abc import ABC, abstractmethod -from workflow_engine.logging.logger import logger - +from workflow_engine.logger.logger import logger class Task(ABC): """Abstract base class for tasks.""" @@ -17,8 +16,6 @@ class Task(ABC): def execute(self) -> None: """Execute the task.""" pass - - class ProcessTask(Task): """Task for executing a process.""" @@ -73,7 +70,6 @@ def execute(self): message = self.task_parameters.get('message', 'No message provided') logger.info("%s: %s", message, self.task_name, extra={'tag': self.task_name}) - class DummyRandomTask(Task): def __init__(self, task_name, task_parameters): self.task_name = task_name @@ -88,7 +84,6 @@ def execute(self): time.sleep(sleep_time) - TASKS_HANDLERS = { 'process': ProcessTask, 'dummy': DummyTask, diff --git a/deployability/modules/workflow_engine/workflow_processor.py b/deployability/modules/workflow_engine/workflow_processor.py index 0440ab2147..28fa4084b7 100755 --- a/deployability/modules/workflow_engine/workflow_processor.py +++ b/deployability/modules/workflow_engine/workflow_processor.py @@ -11,11 +11,10 @@ from pathlib import Path from itertools import product -from workflow_engine.logging.logger import logger +from workflow_engine.logger.logger import logger from workflow_engine.schema_validator import SchemaValidator from workflow_engine.task import Task, TASKS_HANDLERS - class WorkflowFile: """Class for loading and processing a workflow file.""" schema_path = Path(__file__).parent / 'schemas' / 'schema_v1.json'