[services-openrc] Log failures

- If the rc-update command fails for some reason, log that
   failure instead of skipping it completely silently.
 - Fix syntax error as well
This commit is contained in:
Adriaan de Groot 2018-06-27 09:39:30 -04:00
parent 5a2ae7a250
commit dbcc419218

View File

@ -53,13 +53,16 @@ class OpenrcController:
service_path = self.root + self.initdDir + "/" + name
runlevel_path = self.root + self.runlevelsDir + "/" + runlevel
if exists(service_path):
if exists(runlevel_path):
target_env_call(["rc-update", state, name, runlevel])
ec = target_env_call(["rc-update", state, name, runlevel])
if ec != 0:
warning("Could not {} service {} in {}, error {!s}".format(state, name, runlevel, ec))
else:
warning("Target runlevel {} does not exist for {}.".format(runlevel, name))
else:
warning("Target service {} does not exist int {}.".format(name, self.initDir))
warning("Target service {} does not exist in {}.".format(name, self.initdDir))
def run(self):