diff --git a/_modules/get_services.py b/_modules/get_services.py deleted file mode 100644 index daf73a10..00000000 --- a/_modules/get_services.py +++ /dev/null @@ -1,11 +0,0 @@ -from __future__ import absolute_import -import psutil - - -def get_services(): - try: - svc = [x.as_dict() for x in psutil.win_service_iter()] - except Exception: - svc = {"error": "error getting services"} - finally: - return svc diff --git a/_modules/run_python.py b/_modules/win_agent.py similarity index 73% rename from _modules/run_python.py rename to _modules/win_agent.py index 5bfedf88..ade4a9d1 100644 --- a/_modules/run_python.py +++ b/_modules/win_agent.py @@ -1,6 +1,12 @@ +from __future__ import absolute_import +import psutil import os +def get_services(): + return [svc.as_dict() for svc in psutil.win_service_iter()] + + def run_python_script(filename, timeout): python_bin = os.path.join("c:\\salt\\bin", "python.exe") file_path = os.path.join("c:\\windows\\temp", filename) diff --git a/api/tacticalrmm/services/views.py b/api/tacticalrmm/services/views.py index 9d1e452d..73ac67b4 100644 --- a/api/tacticalrmm/services/views.py +++ b/api/tacticalrmm/services/views.py @@ -29,7 +29,7 @@ def get_refreshed_services(request, pk): agent = get_object_or_404(Agent, pk=pk) try: resp = agent.salt_api_cmd( - hostname=agent.salt_id, timeout=30, func="get_services.get_services" + hostname=agent.salt_id, timeout=30, func="win_agent.get_services" ) data = resp.json() except Exception: