From 1ebf89058de3b4a0eae192c0ede83285e0480140 Mon Sep 17 00:00:00 2001 From: Antonio Date: Thu, 16 Nov 2023 18:48:46 +0100 Subject: [PATCH] fix(#60): Fixes after review --- src/wazuh_qa_framework/system/host_manager.py | 4 ++-- src/wazuh_qa_framework/system/wazuh_handler.py | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/wazuh_qa_framework/system/host_manager.py b/src/wazuh_qa_framework/system/host_manager.py index c5916d5..7124830 100644 --- a/src/wazuh_qa_framework/system/host_manager.py +++ b/src/wazuh_qa_framework/system/host_manager.py @@ -643,9 +643,9 @@ def stop_ungracefully_process(self, host, process): """ try: if self.is_windows(host): - self.run_command(host, f'taskkill /F /IM {process}') + self.run_command(host, f"taskkill /F /IM {process}") else: - self.run_command(host, f'pkill -9 {process}') + self.run_command(host, f"pkill -9 {process}") except Exception as e: raise Exception(f"An error occurred while stopping the process. {e}") diff --git a/src/wazuh_qa_framework/system/wazuh_handler.py b/src/wazuh_qa_framework/system/wazuh_handler.py index d46bd37..0c2183d 100644 --- a/src/wazuh_qa_framework/system/wazuh_handler.py +++ b/src/wazuh_qa_framework/system/wazuh_handler.py @@ -707,7 +707,7 @@ def stop_agent(self, host, gracefully=True): else: self.control_service(host, service_name, 'stopped') - self.logger.info(f'Agent {host} stopped {type}') + self.logger.info(f"Agent {host} stopped {type}") else: raise ValueError(f"Host {host} is not an agent") @@ -721,8 +721,7 @@ def stop_agents(self, agent_list=None, parallel=True, gracefully=True): gracefully (bool): Stop gracefully. Defaults to True. """ if parallel: - stop_agent_with_type = partial(self.stop_agent, gracefully=gracefully) - self.pool.map(stop_agent_with_type, agent_list) + self.pool.starmap(self.stop_agent, [(agent, gracefully) for agent in agent_list]) else: for agent in agent_list: self.stop_agent(agent, gracefully)