update_manager: use the machine component to restart services

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2022-01-14 18:23:52 -05:00 committed by Eric Callahan
parent be338ad039
commit 3b27ab49f1
1 changed files with 3 additions and 2 deletions

View File

@ -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