Skip to content

Commit

Permalink
fix(#46): Fixes after linter
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-akim committed Jun 15, 2023
1 parent 75bb26a commit cc9476b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/wazuh_qa_framework/system/wazuh_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ def get_agent_id(self, host, agent):
Return:
str: agent_id
"""
host_list = WazuhAPI(address = self.get_host_variables(host)['ip']).list_agents()['affected_items']
host_list = WazuhAPI(address=self.get_host_variables(host)['ip']).list_agents()['affected_items']
for host in host_list:
if host.get('ip') == self.get_host_variables(agent)['ip']:
return host.get('id')
Expand Down Expand Up @@ -830,7 +830,8 @@ def remove_agents_from_manager(self, agent_list, manager=None, method='cmd', par
logs (str): Remove logs (ossec.log, api.log) from agents. Defaults to False.
restart (str): Restart agents. Defaults to False.
"""
if manager is None: manager = 'manager1'
if manager is None:
manager = 'manager1'

# Getting agent_ids list
agent_ids = []
Expand All @@ -849,15 +850,15 @@ def remove_agents_from_manager(self, agent_list, manager=None, method='cmd', par
else:
self.logger.info(f'Removing agents {agent_list} using API')
agent_string = ','.join(agent_ids)
endpoint=f'/agents?pretty=true&older_than=0s&agents_list={agent_string}&status=all'
endpoint = f'/agents?pretty=true&older_than=0s&agents_list={agent_string}&status=all'
request = WazuhAPIRequest(endpoint=endpoint, method='DELETE')
request.send(WazuhAPI(address = self.get_host_variables(manager)['ip']))
request.send(WazuhAPI(address=self.get_host_variables(manager)['ip']))

# Remove logs
if logs and parallel == False:
if logs and not parallel:
for agent in agent_list:
self.clean_logs(agent)
if logs and parallel == True:
if logs and parallel:
self.pool.map(self.clean_logs, agent_list)

# Restarting agents
Expand Down

0 comments on commit cc9476b

Please sign in to comment.