Skip to content

Commit

Permalink
fix(#5229): Circular reference fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-akim committed May 2, 2024
1 parent b1712ec commit 1a1bb8a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion deployability/modules/testing/tests/helpers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# Created by Wazuh, Inc. <[email protected]>.
# 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
15 changes: 13 additions & 2 deletions deployability/modules/testing/tests/helpers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 1a1bb8a

Please sign in to comment.