You need to sign in or sign up before continuing.
Commit c3e215de authored by Дмитрий Никулин's avatar Дмитрий Никулин Committed by Никита Ефремов

Support for system service statuses on Ubuntu

parent 432bf812
...@@ -92,7 +92,9 @@ class SystemService(service.FunctionObject) : ...@@ -92,7 +92,9 @@ class SystemService(service.FunctionObject) :
@service.functionMethod(SYSTEM_SERVICE_METHODS_NAMESPACE, out_signature="i") @service.functionMethod(SYSTEM_SERVICE_METHODS_NAMESPACE, out_signature="i")
def status(self) : def status(self) :
proc_args_list = ["serv", self.__system_service_name, "status"] proc_args_list = [
config.value(SERVICE_NAME, "serv_mgr_command"), self.__system_service_name, "status"
]
return tools.process.execProcess(proc_args_list, fatal_flag = False)[2] return tools.process.execProcess(proc_args_list, fatal_flag = False)[2]
...@@ -189,7 +191,8 @@ class Service(service.Service, pyinotify.ThreadedNotifier) : ...@@ -189,7 +191,8 @@ class Service(service.Service, pyinotify.ThreadedNotifier) :
def options(self) : def options(self) :
return [ return [
(SERVICE_NAME, "initd_dir", "/etc/rc.d/init.d", str), (SERVICE_NAME, "initd_dir", "/etc/rc.d/init.d", str),
(SERVICE_NAME, "chkconfig_bin", "/sbin/chkconfig", str) (SERVICE_NAME, "chkconfig_bin", "/sbin/chkconfig", str),
(SERVICE_NAME, "serv_mgr_command", "serv", str)
] ]
......
...@@ -37,8 +37,8 @@ def execProcess(proc_args_list, proc_input = None, fatal_flag = True, ...@@ -37,8 +37,8 @@ def execProcess(proc_args_list, proc_input = None, fatal_flag = True,
error_text = "Error while execute \"%s\"\nStdout: %s\nStderr: %s\nStdin: %s\nReturn code: %d" % ( error_text = "Error while execute \"%s\"\nStdout: %s\nStderr: %s\nStdin: %s\nReturn code: %d" % (
str(proc_args_list), proc_stdout.strip(), proc_stderr.strip(), proc_input, proc.returncode ) str(proc_args_list), proc_stdout.strip(), proc_stderr.strip(), proc_input, proc.returncode )
if fatal_flag : if fatal_flag :
logger.error("{submod}: "+error_text)
raise SubprocessFailure(error_text) raise SubprocessFailure(error_text)
logger.error("{submod}: "+error_text)
logger.debug("{submod}: Child process \"%s\" finished, return_code=%d" % (str(proc_args_list), proc.returncode)) logger.debug("{submod}: Child process \"%s\" finished, return_code=%d" % (str(proc_args_list), proc.returncode))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment