Skip to content

Commit

Permalink
fix(#5215): Removing duplicated part
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-akim committed Apr 18, 2024
1 parent 852bbe5 commit a0e82bb
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions deployability/modules/testing/tests/helpers/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,42 +368,6 @@ def get_agent_ip_status_and_name_by_id(wazuh_api: WazuhAPI, identifier):
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
Args:
agent_name (str): Agent name.
Returns:
str: Os version.
"""
response = requests.get(f"{wazuh_api.api_url}/agents", headers=wazuh_api.headers, verify=False)
try:
for agent_data in eval(response.text)['data']['affected_items']:
if agent_data.get('name') == agent_name:
return agent_data.get('os', {}).get('version')
except Exception as e:
logger.error(f"Unexpected error: {e}")
return f"Unexpected error: {e}"


def get_agent_os_name_by_name(wazuh_api: WazuhAPI, agent_name):
"""
Get Agent os name by Agent name
Args:
agent_name (str): Agent name.
Returns:
str: Os name.
"""
response = requests.get(f"{wazuh_api.api_url}/agents", headers=wazuh_api.headers, verify=False)
try:
for agent_data in eval(response.text)['data']['affected_items']:
if agent_data.get('name') == agent_name:
return 'suse' if agent_data.get('os', {}).get('name', '').lower() == 'sles' else agent_data.get('os', {}).get('name', '').lower()
except Exception as e:
logger.error(f"Unexpected error: {e}")
return f"Unexpected error: {e}"
return None


def get_agent_ip_status_and_name_by_id(wazuh_api: WazuhAPI, identifier):
"""
Expand Down

0 comments on commit a0e82bb

Please sign in to comment.