diff --git a/deployability/modules/testing/tests/helpers/__init__.py b/deployability/modules/testing/tests/helpers/__init__.py index 6249db074a..f0b9ffca40 100755 --- a/deployability/modules/testing/tests/helpers/__init__.py +++ b/deployability/modules/testing/tests/helpers/__init__.py @@ -2,6 +2,6 @@ # Created by Wazuh, Inc. . # This program is a free software; you can redistribute it and/or modify it under the terms of GPLv2 -from .agent import WazuhAgent from .generic import HostConfiguration, HostInformation, HostMonitor, CheckFiles +from .agent import WazuhAgent from .manager import WazuhManager diff --git a/deployability/modules/testing/tests/helpers/utils.py b/deployability/modules/testing/tests/helpers/utils.py index 2e133dc0f5..dbf73e34af 100644 --- a/deployability/modules/testing/tests/helpers/utils.py +++ b/deployability/modules/testing/tests/helpers/utils.py @@ -10,7 +10,6 @@ import winrm from modules.testing.utils import logger -from .generic import HostInformation paramiko_logger = logging.getLogger("paramiko") paramiko_logger.setLevel(logging.CRITICAL) @@ -48,7 +47,19 @@ def check_inventory_connection(inventory_path, attempts=10, sleep=30) -> bool: password = inventory_data.get('ansible_password', None) - os_type = HostInformation.get_os_type(inventory_path) + try: + with open(inventory_path.replace('inventory', 'track'), 'r') as file: + data = yaml.safe_load(file) + if 'platform' in data: + os_type = data['platform'] + else: + raise KeyError("The 'platform' key was not found in the YAML file.") + except FileNotFoundError: + logger.error(f"The YAML file '{inventory_path}' was not found.") + except yaml.YAMLError as e: + logger.error(f"Error while loading the YAML file: {e}") + except Exception as e: + logger.error(f"An unexpected error occurred: {e}") if os_type == 'linux': ssh = paramiko.SSHClient()