From 3b27ab49f19fe1805204b5bdda4dbf9677d6aa27 Mon Sep 17 00:00:00 2001 From: Eric Callahan Date: Fri, 14 Jan 2022 18:23:52 -0500 Subject: [PATCH] update_manager: use the machine component to restart services Signed-off-by: Eric Callahan --- moonraker/components/update_manager/app_deploy.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/moonraker/components/update_manager/app_deploy.py b/moonraker/components/update_manager/app_deploy.py index 36acde5..65ffa9f 100644 --- a/moonraker/components/update_manager/app_deploy.py +++ b/moonraker/components/update_manager/app_deploy.py @@ -23,6 +23,7 @@ from typing import ( if TYPE_CHECKING: from confighelper import ConfigHelper from .update_manager import CommandHelper + from ..machine import Machine CHANNEL_TO_TYPE = { "stable": "zip", @@ -173,9 +174,9 @@ class AppDeploy(BaseDeploy): async def _do_restart(self) -> None: self.notify_status("Restarting Service...") + machine: Machine = self.server.lookup_component("machine") try: - await self.cmd_helper.run_cmd( - f"sudo systemctl restart {self.name}") + await machine.do_service_action("restart", self.name) except Exception: if self.name == "moonraker": # We will always get an error when restarting moonraker