修改返回值

This commit is contained in:
wangsong 2022-10-20 17:20:44 +08:00
parent b1e3606f4a
commit a720289995
1 changed files with 8 additions and 3 deletions

View File

@ -46,6 +46,11 @@ class UpgradeStrategiesDbusController(dbus.service.Object):
""" this is a helper to provide the UpdateManagerIFace """
P2P_DEDAULT_PATH = "/etc/default/apt-p2p"
RETURN_SUCCESS_CODE = 0
RETURN_SUCCESS_DESC = ""
RETURN_UNKNOWN_CODE = -1
RETURN_UNKNOWN_DESC = ""
def __init__(self, parent, bus_name,
object_path=UPDATER_DBUS_PATH):
@ -74,7 +79,7 @@ class UpgradeStrategiesDbusController(dbus.service.Object):
logging.debug("Exit")
## dbus接口: 开启或关闭预下载功能
@dbus.service.method(UPDATER_DBUS_INTERFACE, in_signature='s', out_signature='b',sender_keyword='sender')
@dbus.service.method(UPDATER_DBUS_INTERFACE, in_signature='s', out_signature='is',sender_keyword='sender')
def ChangingP2PStatus(self,_status,sender = None):
status = str(_status)
sender_name = get_proc_from_dbus_name(sender)
@ -95,10 +100,10 @@ class UpgradeStrategiesDbusController(dbus.service.Object):
logging.info(str(p.stdout))
if p.returncode == 0:
logging.info("Execute successfully")
return True
return self.RETURN_SUCCESS_CODE,self.RETURN_SUCCESS_DESC
else:
logging.info("Failed to execute reboot")
return False
return self.RETURN_UNKNOWN_CODE,str(p.stdout)
else:
logging.waring("apt-p2p function is not install...")