diff options
Diffstat (limited to 'whatmaps/debiandistro.py')
-rw-r--r-- | whatmaps/debiandistro.py | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/whatmaps/debiandistro.py b/whatmaps/debiandistro.py index 4a3d0db..9294c9f 100644 --- a/whatmaps/debiandistro.py +++ b/whatmaps/debiandistro.py @@ -26,16 +26,18 @@ except ImportError: lsb_release = None import logging -import string +import os import subprocess import sys +import string -from . distro import Distro +import whatmaps.distro from . debianpkg import DebianPkg from . pkg import PkgError +from . systemd import Systemd -class DebianDistro(Distro): - "Debian (dpkg) based distribution""" +class DebianDistro(whatmaps.distro.Distro): + "Debian (dpkg) based distribution" id = 'Debian' _pkg_services = { 'apache2-mpm-worker': [ 'apache2' ], @@ -72,10 +74,20 @@ class DebianDistro(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 + def is_service_installed(klass, name): + """Whether the system has this service""" + return os.path.exists('/etc/init.d/%s' % name) + + @classmethod def has_apt(klass): return True |