Skip to content

Commit

Permalink
fix(#61): fixes done after review
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-akim committed Jul 28, 2023
1 parent ab390ad commit 1d588e9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/wazuh_qa_framework/system/wazuh_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,17 +580,16 @@ def stop_agent(self, host, gracefully=True):
self.logger.debug(f'Stopping {type} {host}')
service_name = WAZUH_AGENT_WINDOWS_SERVICE_NAME if self.is_windows(host) else 'wazuh-agent'
if self.is_agent(host):
if gracefully:
self.control_service(host, service_name, 'stopped')

if not gracefully:
process = 'wazuh-agent.exe' if self.is_windows(host) else 'wazuh-agent'
self.stop_ungracefully_process(host, process)

else:
self.control_service(host, service_name, 'stopped')
self.logger.info(f'Agent {host} stopped {type}')

else:
raise ValueError(f'Host {host} is not an Agent')
raise ValueError(f'Host {host} is not an agent')

def stop_agents(self, agent_list=None, parallel=True, gracefully=True):
"""Stop agents.
Expand All @@ -606,6 +605,7 @@ def stop_agents(self, agent_list=None, parallel=True, gracefully=True):
else:
for agent in agent_list:
self.stop_agent(agent, gracefully)
self.logger.info(f'Agents stopped successfully: {agent_list}')

def stop_manager(self, host):
"""Stop manager
Expand Down Expand Up @@ -737,7 +737,7 @@ def stop_environment(self, parallel=True):
self.pool.map(self.stop_agent, agent_list)
else:
self.logger.info(message='Stopping environment: Managers')
for manager in agent_list:
for manager in manager_list:
self.stop_manager(manager)

self.logger.info(message='Stopping environment: Agents')
Expand Down

0 comments on commit 1d588e9

Please sign in to comment.