diff options
author | Guido Günther <agx@sigxcpu.org> | 2014-07-11 20:53:45 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2014-07-11 20:53:45 +0200 |
commit | 0b81cf5d788a1432f4f553a7ea18c5cc48f4eb96 (patch) | |
tree | 8f2189bf38f65adb90b2b2d49c959de5bec48f53 /whatmaps/debiandistro.py | |
parent | c6168dff875c9488a26f6931b9da52080a022b9b (diff) | |
parent | 5e9df7763328f998805b28aff874b56b67d1bd88 (diff) |
Merge tag 'v0.0.8' into debian/master
whatmaps 0.0.8
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 |