diff options
author | Guido Günther <agx@sigxcpu.org> | 2014-05-02 17:28:38 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2014-06-28 21:34:51 +0200 |
commit | e1b9e7fe3b1fa6b6e829f7eb5787b67d9894cfd1 (patch) | |
tree | 80c713e5c54872f286cb38c4f726a2377b498c80 /whatmaps/distro.py | |
parent | ac817c1fc37bd7e831b33f32028005b612eb76eb (diff) |
pkg_services: Check if a service is actually installed
So far we returned the full list from pkg_services. This is o.k. for
many to one mappings like apache but not for one to many like openjdk.
To avoid to print out services that aren't installed check that
beforehand.
Diffstat (limited to 'whatmaps/distro.py')
-rw-r--r-- | whatmaps/distro.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/whatmaps/distro.py b/whatmaps/distro.py index e4f417f..5625955 100644 --- a/whatmaps/distro.py +++ b/whatmaps/distro.py @@ -49,12 +49,18 @@ class Distro(object): subprocess.call(klass.restart_service_cmd(service)) @classmethod + def is_service_installed(klass, service): + """Check wether a service exists on the system""" + return True + + @classmethod def pkg_services(klass, pkg): """ List of services that package pkg needs restarted that aren't part of pkg itself """ - return klass._pkg_services.get(pkg.name, []) + return [ s for s in klass._pkg_services.get(pkg.name, []) + if klass.is_service_installed(s) ] @classmethod def pkg_service_blacklist(klass, pkg): |