[services-openrc] Log configuration failures

- If services don't exist, or runlevels don't exist,
   log them instead of failing completely silently.
main
Adriaan de Groot 8 years ago
parent cd640bda9f
commit 8f0db9dc74

@ -23,7 +23,7 @@
import libcalamares import libcalamares
from libcalamares.utils import target_env_call from libcalamares.utils import target_env_call, warning
from os.path import exists, join from os.path import exists, join
@ -47,12 +47,17 @@ class OpenrcController:
is called with @p state as the command as well. is called with @p state as the command as well.
""" """
for svc in self.services[state]: for svc in self.services.get(state, []):
if exists(self.root + self.initdDir + "/" + svc["name"]): service_path = self.root + self.initdDir + "/" + svc["name"]
if exists(self.root + self.runlevelsDir + "/" + svc["runlevel"]): runlevel_path = self.root + self.runlevelsDir + "/" + svc["runlevel"]
target_env_call( if exists(service_path):
["rc-update", state, svc["name"], svc["runlevel"]] if exists(runlevel_path):
) target_env_call(["rc-update", state, svc["name"], svc["runlevel"]])
else:
warning("Target runlevel {} does not exist for {}.".format(svc["runlevel"], svc["name"]))
else:
warning("Target service {} does not exist int {}.".format(svc["name"], self.initDir))
def run(self): def run(self):
"""Run the controller """Run the controller

Loading…
Cancel
Save