From f758314abe0c3c4cc2b06ca5a24c7288a0af41ed Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Fri, 11 Jul 2014 17:23:10 +0200 Subject: Add systemd support --- whatmaps/debiandistro.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'whatmaps/debiandistro.py') diff --git a/whatmaps/debiandistro.py b/whatmaps/debiandistro.py index d608d8f..5333a35 100644 --- a/whatmaps/debiandistro.py +++ b/whatmaps/debiandistro.py @@ -34,6 +34,7 @@ import string import distro from . debianpkg import DebianPkg from . pkg import PkgError +from . systemd import Systemd class DebianDistro(distro.Distro): "Debian (dpkg) based distribution" @@ -73,8 +74,12 @@ class DebianDistro(distro.Distro): return DebianPkg(pkg) @classmethod - def restart_service_cmd(klass, name): + def restart_service_cmd(klass, service): """The command that should be used to start a service""" + if Systemd.is_running() and service.endswith('.service'): + name = service[:-len('.service')] + else: + name = service return ['invoke-rc.d', name, 'restart'] @classmethod -- cgit v1.2.3