Skip to content

Commit

Permalink
fix(#61): remove library and add become
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-akim committed Nov 22, 2023
1 parent 1ebf890 commit 96dda29
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/wazuh_qa_framework/system/host_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,18 +634,20 @@ def install_package(self, host, package_name, become=None, ignore_errors=False):

return result

def stop_ungracefully_process(self, host, process):
def stop_ungracefully_process(self, host, process, become=None):
"""Stop ungracefully a process.
Args:
host (str): Hostname.
process (str): Name of the process to be stopped.
become (bool): If no value is provided, it will be taken from the inventory. If the inventory does not
provide a value, it will default to False. Defaults None
"""
try:
if self.is_windows(host):
self.run_command(host, f"taskkill /F /IM {process}")
self.run_command(host, f"taskkill /F /IM {process}", become=become)
else:
self.run_command(host, f"pkill -9 {process}")
self.run_command(host, f"pkill -9 {process}", become=become)

except Exception as e:
raise Exception(f"An error occurred while stopping the process. {e}")
Expand Down
1 change: 0 additions & 1 deletion src/wazuh_qa_framework/system/wazuh_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import os
import re
import yaml
from functools import partial
from multiprocessing.pool import ThreadPool

from wazuh_qa_framework.generic_modules.logging.base_logger import BaseLogger
Expand Down

0 comments on commit 96dda29

Please sign in to comment.