修改tid
This commit is contained in:
parent
f7f016ba98
commit
69972b67b7
|
@ -17,6 +17,7 @@ from Crypto.PublicKey import RSA
|
|||
from Crypto.Cipher import PKCS1_OAEP
|
||||
from json.decoder import JSONDecodeError
|
||||
from dbus.exceptions import DBusException
|
||||
from SystemUpdater.Core.UpdaterConfigParser import UpgradeConfig
|
||||
|
||||
|
||||
LOCALTIDPATH = "/var/lib/kylin-system-updater/system-updater.conf"
|
||||
|
@ -30,6 +31,8 @@ class UpdateMsgCollector():
|
|||
self.convertor = FormatConvert(self)
|
||||
# 发送器
|
||||
self.sender = MessageSend(self)
|
||||
# 配置文件
|
||||
self.configs = UpgradeConfig("/var/lib/kylin-system-updater/", name="tidfile.conf")
|
||||
|
||||
def GenUploadMessage(self, dict_message):
|
||||
UploadMessage = {}
|
||||
|
@ -54,8 +57,8 @@ class UpdateMsgCollector():
|
|||
PackageInfo['messageType'] = str(messageType)
|
||||
PackageInfo['packageName'] = str(packageName)
|
||||
# 获取本地tid
|
||||
localtid = self.updateManager.configs.getWithDefault("TID", "localtid", "")
|
||||
PackageInfo["tid"] = str(localtid)
|
||||
self.sender.GetLocalTid()
|
||||
PackageInfo["tid"] = str(self.sender.localtid)
|
||||
# logging.info("Get local tid:(%s).",localtid)
|
||||
|
||||
json_PackageInfo = self.convertor.dictConvertJson(PackageInfo)
|
||||
|
@ -204,6 +207,12 @@ class MessageSend():
|
|||
result = "Send to server success"
|
||||
logging.info("Sent Status: True - packageName: %s : result: %s.", PackageInfo['packageName'], result)
|
||||
|
||||
def GetLocalTid(self):
|
||||
# 试图获取本地tid
|
||||
try:
|
||||
self.localtid = self.collector.configs.getWithDefault("TID","localtid",default="")
|
||||
except Exception as e:
|
||||
logging.error(str(e))
|
||||
|
||||
def SaveTid(self, localtid):
|
||||
if len(localtid) == 0:
|
||||
|
|
Loading…
Reference in New Issue