Skip to content

Commit

Permalink
fix(#5229): camel_case to snake_case
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-akim committed May 2, 2024
1 parent e2a5722 commit b1712ec
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 6 deletions.
25 changes: 23 additions & 2 deletions deployability/modules/testing/tests/helpers/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,8 @@ def assert_results(result, params = None) -> None:

assert result[category][action] == [], logger.error(f'{result[category][action]} was found in: {category} {action}')

def areAgent_processes_active(agent_params):
@staticmethod
def are_agent_processes_active(agent_params):
"""
Check if agent processes are active
Expand Down Expand Up @@ -419,7 +420,7 @@ def areAgent_processes_active(agent_params):
else:
return False


@staticmethod
def is_agent_port_open(inventory_path):
"""
Check if agent port is open
Expand Down Expand Up @@ -510,6 +511,26 @@ def get_agent_ip_status_and_name_by_id(wazuh_api: WazuhAPI, identifier):
return [None, None, None]


def get_agent_ip_status_and_name_by_id(wazuh_api: WazuhAPI, identifier):
"""
Get IP status and name by ID.
Args:
identifier (str): Agent ID.
Returns:
List: IP, name, and status of the agent.
"""
try:
agents_information = wazuh_api.get_agents_information()
for element in agents_information:
if element['id'] == identifier:
return [element['ip'], element['name'], element['status']]
except Exception as e:
logger.error(f"Unexpected error: {e}")
return [None, None, None]


def get_agent_os_version_by_name(wazuh_api: WazuhAPI, agent_name):
"""
Get Agent os version by Agent name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@ def test_port(wazuh_params):

def test_processes(wazuh_params):
for _, agent_params in wazuh_params['agents'].items():
assert WazuhAgent.areAgent_processes_active(agent_params), logger.error('Agent processes are not active')
assert WazuhAgent.are_agent_processes_active(agent_params), logger.error('Agent processes are not active')
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ def test_port(wazuh_params):

def test_processes(wazuh_params):
for _, agent_params in wazuh_params['agents'].items():
assert WazuhAgent.areAgent_processes_active(agent_params), logger.error('Agent processes are not active')
assert WazuhAgent.are_agent_processes_active(agent_params), logger.error('Agent processes are not active')
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@ def test_port(wazuh_params):

def test_processes(wazuh_params):
for _, agent_params in wazuh_params['agents'].items():
assert not WazuhAgent.areAgent_processes_active(agent_params), logger.error('Agent processes are still active')
assert not WazuhAgent.are_agent_processes_active(agent_params), logger.error('Agent processes are still active')
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,4 @@ def test_port(wazuh_params):

def test_processes(wazuh_params):
for _, agent_params in wazuh_params['agents'].items():
assert not WazuhAgent.areAgent_processes_active(agent_params), logger.error('Agent processes are still active')
assert not WazuhAgent.are_agent_processes_active(agent_params), logger.error('Agent processes are still active')

0 comments on commit b1712ec

Please sign in to comment.