Skip to content

Commit

Permalink
feat(#46): More changes after linter
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-akim committed Jun 9, 2023
1 parent f5c1621 commit b15ad7e
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/wazuh_qa_framework/system/wazuh_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,15 +596,13 @@ def clean_logs(self, hosts):
if 'master' == host_type or 'worker' == host_type:
self.truncate_file(host, f'{logs_path}/cluster.log', recreate=True, become=True, ignore_errors=False)


def clean_agents(self, agents=None):
"""Stop agents, remove them from manager and clean their client keys
Args:
agents (_type_, agents_list): Agents list. Defaults to None.
"""
pass


def restart_agents(self, agent_list):
"""Restart agents
Args:
Expand All @@ -618,8 +616,7 @@ def restart_agents(self, agent_list):
else:
self.run_command(agent, f"service wazuh-agent restart", become=True, ignore_errors=False)


def remove_agents_from_manager(self, agent_list, manager=None, method='cmd', parallel=True , logs=False,
def remove_agents_from_manager(self, agent_list, manager=None, method='cmd', parallel=True, logs=False,
restart=False):
"""Remove agents from manager
Expand All @@ -631,8 +628,8 @@ def remove_agents_from_manager(self, agent_list, manager=None, method='cmd', par
logs (str): Remove logs from agents. Defaults to False.
restart (str): Restart agents. Defaults to False.
"""
if manager is None: manager = 'manager1'
if method == 'api': parallel = False
manager = 'manager1' if manager is None else manager
parallel = False if method == 'api' else parallel

# Getting agent_ids list
agent_ids = self.get_agents_id(agent_list)
Expand All @@ -650,8 +647,8 @@ def remove_agent_cmd(id):
remove_agent_cmd(id)
else:
agent_string = ','.join(agent_ids)
self.make_api_call('manager1', port=55000, method='DELETE',
endpoint=f'/agents?pretty=true&older_than=0s&agents_list={agent_string}&status=all',
self.make_api_call('manager1', port=55000, method='DELETE',
endpoint=f'/agents?pretty=true&older_than=0s&agents_list={agent_string}&status=all',
request_body=None, token=None, check=False)

# Remove logs
Expand Down

0 comments on commit b15ad7e

Please sign in to comment.