分类接口
This commit is contained in:
parent
1f5dc1da59
commit
fd9be88938
|
@ -460,6 +460,37 @@ class UpdateManagerDbusController(dbus.service.Object):
|
|||
logging.error(str(e))
|
||||
return (False)
|
||||
|
||||
# commitpackages
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE,in_signature='as',out_signature='b',sender_keyword='sender')
|
||||
def InstallPackages(self, pkg_list = [], sender=None):
|
||||
try:
|
||||
sender_name = get_proc_from_dbus_name(sender)
|
||||
self._check_prohibit_user(sender_name)
|
||||
logging.info(COLORMETHOR_PREFIX+'Method'+COLORLOG_SUFFIX+' InstallPackages : [%s].', ", ".join(list(pkg_list)))
|
||||
self.parent.start_back_upgrade(pkg_list)
|
||||
except Exception as e:
|
||||
logging.error(str(e))
|
||||
return (False)
|
||||
return True
|
||||
|
||||
#更新的dbus
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE,out_signature='bs',sender_keyword='sender')
|
||||
def UpdateCache(self,sender=None):
|
||||
try:
|
||||
#处于更新和升级中的话 不进行更新
|
||||
if self.parent.now_working != InstallBackend.ACTION_DEFUALT_STATUS:
|
||||
logging.warning('UpdateDetect In the process of Updating or Upgrading...')
|
||||
return False,'In the process of updating or Upgrading...'
|
||||
else:
|
||||
sender_name = get_proc_from_dbus_name(sender)
|
||||
logging.info(COLORMETHOR_PREFIX+'Method'+COLORLOG_SUFFIX+' UpdateCache sender:%s...',sender_name)
|
||||
self._check_prohibit_user(sender_name)
|
||||
self.parent.start_update_backend()
|
||||
return True,'success'
|
||||
except Exception as e:
|
||||
logging.error(str(e))
|
||||
return False,str(e)
|
||||
|
||||
# dbus接口:向数据库display表中插入数据
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE, in_signature='ss', out_signature='b', sender_keyword='sender')
|
||||
def InsertInstallState(self, item, value, sender=None):
|
||||
|
@ -1003,24 +1034,6 @@ class UpdateManagerDbusControllerUtils(dbus.service.Object):
|
|||
if sender_name in prohibit_list:
|
||||
raise dbus.exceptions.DBusException("ERROR: You are not allowed to perform this action.")
|
||||
|
||||
#更新的dbus
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE,out_signature='bs',sender_keyword='sender')
|
||||
def UpdateCache(self,sender=None):
|
||||
try:
|
||||
#处于更新和升级中的话 不进行更新
|
||||
if self.parent.now_working != InstallBackend.ACTION_DEFUALT_STATUS:
|
||||
logging.warning('UpdateDetect In the process of Updating or Upgrading...')
|
||||
return False,'In the process of updating or Upgrading...'
|
||||
else:
|
||||
sender_name = get_proc_from_dbus_name(sender)
|
||||
logging.info(COLORMETHOR_PREFIX+'Method'+COLORLOG_SUFFIX+' UpdateCache sender:%s...',sender_name)
|
||||
self._check_prohibit_user(sender_name)
|
||||
self.parent.start_update_backend()
|
||||
return True,'success'
|
||||
except Exception as e:
|
||||
logging.error(str(e))
|
||||
return False,str(e)
|
||||
|
||||
# # dbus接口: 后端大数据采集
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE, in_signature='ss', out_signature='b')
|
||||
def DataBackendCollect(self, messageType, uploadMessage):
|
||||
|
@ -1030,19 +1043,6 @@ class UpdateManagerDbusControllerUtils(dbus.service.Object):
|
|||
except Exception as e:
|
||||
logging.error(str(e))
|
||||
|
||||
# commitpackages
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE,in_signature='as',out_signature='b',sender_keyword='sender')
|
||||
def InstallPackages(self, pkg_list = [], sender=None):
|
||||
try:
|
||||
sender_name = get_proc_from_dbus_name(sender)
|
||||
self._check_prohibit_user(sender_name)
|
||||
pkg_list = ", ".join(list(pkg_list))
|
||||
logging.info(COLORMETHOR_PREFIX+'Method'+COLORLOG_SUFFIX+' InstallPackages : [%s].', pkg_list)
|
||||
self.parent.start_back_upgrade(pkg_list)
|
||||
except Exception as e:
|
||||
logging.error(str(e))
|
||||
return (False)
|
||||
return True
|
||||
|
||||
# 检查更新
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE, in_signature='as', out_signature='as', sender_keyword='sender')
|
||||
|
@ -1063,7 +1063,7 @@ class UpdateManagerDbusControllerUtils(dbus.service.Object):
|
|||
self.parent.collector.background_upgradable.append(pkg.name)
|
||||
except:
|
||||
logging.error("CheckInstalledOrUpgrade: Failed to obtain package information: %s" % str(i), exc_info=True)
|
||||
# logging.info("All silent upgrade: %s.",pkglist)
|
||||
logging.info("All silent upgrade: %s.",pkglist)
|
||||
return pkglist
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue