Commit d9bc9c47 authored by Devaev Maxim's avatar Devaev Maxim

Some calls of execProcess in plugins no longer cause exceptions

parent c69a622f
...@@ -33,7 +33,7 @@ class DateTime(service.FunctionObject) : ...@@ -33,7 +33,7 @@ class DateTime(service.FunctionObject) :
def setUtcTime(self, month, monthday, hour, minute, year, second) : def setUtcTime(self, month, monthday, hour, minute, year, second) :
proc_args = "%s -u %02d%02d%02d%02d%04d.%02d" % ( config.value(SERVICE_NAME, "date_prog_path"), proc_args = "%s -u %02d%02d%02d%02d%04d.%02d" % ( config.value(SERVICE_NAME, "date_prog_path"),
month, monthday, hour, minute, year, second ) month, monthday, hour, minute, year, second )
return tools.execProcess(proc_args)[2] return tools.execProcess(proc_args, False)[2]
@service.functionMethod(SYSTEM_CLOCK_METHODS_NAMESPACE, out_signature="iiiiii") @service.functionMethod(SYSTEM_CLOCK_METHODS_NAMESPACE, out_signature="iiiiii")
def utcTime(self) : def utcTime(self) :
...@@ -108,7 +108,7 @@ class DateTime(service.FunctionObject) : ...@@ -108,7 +108,7 @@ class DateTime(service.FunctionObject) :
@service.functionMethod(HARDWARE_CLOCK_METHODS_NAMESPACE, out_signature="i") @service.functionMethod(HARDWARE_CLOCK_METHODS_NAMESPACE, out_signature="i")
def syncWithSystem(self) : def syncWithSystem(self) :
return tools.execProcess("%s --systohc" % (config.value(SERVICE_NAME, "hwclock_prog_path")))[0] return tools.execProcess("%s --systohc" % (config.value(SERVICE_NAME, "hwclock_prog_path")), False)[0]
##### Public classes ##### ##### Public classes #####
......
...@@ -25,26 +25,26 @@ class Machine(service.FunctionObject) : ...@@ -25,26 +25,26 @@ class Machine(service.FunctionObject) :
@service.functionMethod(POWER_METHODS_NAMESPACE, out_signature="i") @service.functionMethod(POWER_METHODS_NAMESPACE, out_signature="i")
def shutdown(self) : def shutdown(self) :
return tools.execProcess("%s -h now" % (config.value(SERVICE_NAME, "shutdown_prog_path")))[2] return tools.execProcess("%s -h now" % (config.value(SERVICE_NAME, "shutdown_prog_path")), False)[2]
@service.functionMethod(POWER_METHODS_NAMESPACE, out_signature="i") @service.functionMethod(POWER_METHODS_NAMESPACE, out_signature="i")
def reboot(self) : def reboot(self) :
return tools.execProcess("%s -r now" % (config.value(SERVICE_NAME, "shutdown_prog_path")))[2] return tools.execProcess("%s -r now" % (config.value(SERVICE_NAME, "shutdown_prog_path")), False)[2]
@service.functionMethod(POWER_METHODS_NAMESPACE, out_signature="i") @service.functionMethod(POWER_METHODS_NAMESPACE, out_signature="i")
def suspend(self) : def suspend(self) :
return tools.execProcess(config.value(SERVICE_NAME, "pm_suspend_prog_path"))[2] return tools.execProcess(config.value(SERVICE_NAME, "pm_suspend_prog_path"), False)[2]
@service.functionMethod(POWER_METHODS_NAMESPACE, out_signature="i") @service.functionMethod(POWER_METHODS_NAMESPACE, out_signature="i")
def hibernate(self) : def hibernate(self) :
return tools.execProcess(config.value(SERVICE_NAME, "pm_hibernate_prog_path"))[2] return tools.execProcess(config.value(SERVICE_NAME, "pm_hibernate_prog_path"), False)[2]
### ###
@service.functionMethod(RUNLEVELS_METHODS_NAMESPACE, in_signature="i", out_signature="i") @service.functionMethod(RUNLEVELS_METHODS_NAMESPACE, in_signature="i", out_signature="i")
def switchTo(self, level) : def switchTo(self, level) :
proc_args = "%s %s" % (config.value(SERVICE_NAME, "telinit_prog_path"), validators.validRange(str(level), RUNLEVELS)) proc_args = "%s %s" % (config.value(SERVICE_NAME, "telinit_prog_path"), validators.validRange(str(level), RUNLEVELS))
return tools.execProcess(proc_args)[2] return tools.execProcess(proc_args, False)[2]
@service.functionMethod(RUNLEVELS_METHODS_NAMESPACE, out_signature="i") @service.functionMethod(RUNLEVELS_METHODS_NAMESPACE, out_signature="i")
def currentLevel(self) : def currentLevel(self) :
......
...@@ -74,16 +74,19 @@ class SystemService(service.FunctionObject) : ...@@ -74,16 +74,19 @@ class SystemService(service.FunctionObject) :
@service.functionMethod(SYSTEM_SERVICE_METHODS_NAMESPACE, out_signature="i") @service.functionMethod(SYSTEM_SERVICE_METHODS_NAMESPACE, out_signature="i")
def start(self) : def start(self) :
logger.verbose("{mod}: Request to start service \"%s\"" % (self.__system_service_name)) logger.verbose("{mod}: Request to start service \"%s\"" % (self.__system_service_name))
return tools.execProcess("%s start" % (os.path.join(config.value(SERVICE_NAME, "initd_dir_path"), self.__system_service_name)))[2] return tools.execProcess("%s start" % ( os.path.join(config.value(SERVICE_NAME, "initd_dir_path"),
self.__system_service_name) ), False)[2]
@service.functionMethod(SYSTEM_SERVICE_METHODS_NAMESPACE, out_signature="i") @service.functionMethod(SYSTEM_SERVICE_METHODS_NAMESPACE, out_signature="i")
def stop(self) : def stop(self) :
logger.verbose("{mod}: Request to stop service \"%s\"" % (self.__system_service_name)) logger.verbose("{mod}: Request to stop service \"%s\"" % (self.__system_service_name))
return tools.execProcess("%s stop" % (os.path.join(config.value(SERVICE_NAME, "initd_dir_path"), self.__system_service_name)))[2] return tools.execProcess("%s stop" % ( os.path.join(config.value(SERVICE_NAME, "initd_dir_path"),
self.__system_service_name) ), False)[2]
@service.functionMethod(SYSTEM_SERVICE_METHODS_NAMESPACE, out_signature="i") @service.functionMethod(SYSTEM_SERVICE_METHODS_NAMESPACE, out_signature="i")
def status(self) : def status(self) :
return tools.execProcess("%s status" % (os.path.join(config.value(SERVICE_NAME, "initd_dir_path"), self.__system_service_name)))[2] return tools.execProcess("%s status" % ( os.path.join(config.value(SERVICE_NAME, "initd_dir_path"),
self.__system_service_name) ), False)[2]
### Private ### ### Private ###
......
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