Merge branch 'backend_dev' of gitlab2.kylin.com:kylin-desktop/update-manager-group/kylin-system-updater into backend_dev

This commit is contained in:
wangsong 2021-12-13 15:42:38 +08:00
commit 6a1c3edbfa
3 changed files with 30 additions and 3 deletions

View File

@ -4,6 +4,7 @@
#!/usr/bin/python3 #!/usr/bin/python3
import json import json
import dbus import dbus
import uuid
import base64 import base64
import hashlib import hashlib
import logging import logging
@ -16,6 +17,7 @@ from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_OAEP from Crypto.Cipher import PKCS1_OAEP
from json.decoder import JSONDecodeError from json.decoder import JSONDecodeError
from dbus.exceptions import DBusException from dbus.exceptions import DBusException
from SystemUpdater.Core.UpdaterConfigParser import UpgradeConfig
LOCALTIDPATH = "/var/lib/kylin-system-updater/system-updater.conf" LOCALTIDPATH = "/var/lib/kylin-system-updater/system-updater.conf"
@ -29,6 +31,8 @@ class UpdateMsgCollector():
self.convertor = FormatConvert(self) self.convertor = FormatConvert(self)
# 发送器 # 发送器
self.sender = MessageSend(self) self.sender = MessageSend(self)
# 配置文件
self.configs = UpgradeConfig("/var/lib/kylin-system-updater/", name="tidfile.conf")
def GenUploadMessage(self, dict_message): def GenUploadMessage(self, dict_message):
UploadMessage = {} UploadMessage = {}
@ -38,6 +42,7 @@ class UpdateMsgCollector():
for key in dict_message.keys(): for key in dict_message.keys():
if "packageName" != key: if "packageName" != key:
UploadMessage[key] = dict_message[key] UploadMessage[key] = dict_message[key]
UploadMessage['UUID'] = str(uuid.uuid1())
except Exception as e: except Exception as e:
logging.error(str(e)) logging.error(str(e))
@ -52,8 +57,8 @@ class UpdateMsgCollector():
PackageInfo['messageType'] = str(messageType) PackageInfo['messageType'] = str(messageType)
PackageInfo['packageName'] = str(packageName) PackageInfo['packageName'] = str(packageName)
# 获取本地tid # 获取本地tid
localtid = self.updateManager.configs.getWithDefault("TID", "localtid", "") self.sender.GetLocalTid()
PackageInfo["tid"] = str(localtid) PackageInfo["tid"] = str(self.sender.localtid)
# logging.info("Get local tid:(%s).",localtid) # logging.info("Get local tid:(%s).",localtid)
json_PackageInfo = self.convertor.dictConvertJson(PackageInfo) json_PackageInfo = self.convertor.dictConvertJson(PackageInfo)
@ -202,6 +207,12 @@ class MessageSend():
result = "Send to server success" result = "Send to server success"
logging.info("Sent Status: True - packageName: %s : result: %s.", PackageInfo['packageName'], result) 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): def SaveTid(self, localtid):
if len(localtid) == 0: if len(localtid) == 0:

View File

@ -169,7 +169,14 @@
- `示例:` - `示例:`
```sh ```sh
messageType = "update-infos", uploadMessage = "{\"packageName\":\"kylin-system-updater\",\"author\":\"Xueyi Luo\" ...}" messageType = "UpdateInfos", uploadMessage = "{\"packageName\":\"kylin-system-updater\",\"source\":\"kylin-system-updater\",\"status\":\"True\",\"errorCode\":\"\",\"versionOld\":\"1.2.13.2kord\",\"versionNew\":\"1.2.17.1kord\"}"
messageType: 消息埋点(string) "UpdateInfos"、"InstallInfos"、"RemoveInfos"...
source: 安装来源 "kylin-installer"、"unattented-upgrade"、"kylin-software-center"、"kylin-system-updater"...
status: 安装或卸载状态 "True"/"False"
errorCode: 错误信息 ""/"..."
versionOld: 旧版本号 "1.2.13.2kord"
versionNew: 新版本号 "1.2.17.1kord"
``` ```

9
debian/changelog vendored
View File

@ -1,3 +1,12 @@
kylin-system-updater (1.2.17.3kord) v101; urgency=medium
* BUG: #95760:  【更新升级-需求-9002】【系统更新】控制面板更新提示更新失败-软件包错误,实际已经安装成功
* 需求号: 无
* 其他改动说明: 修改大数据采集后端dbus接口
* 其他改动影响域:系统更新多维数据采集
-- luoxueyi <luoxueyi@kylinos.cn> Mon, 13 Dec 2021 10:23:39 +0800
kylin-system-updater (1.2.17.2kord) v101; urgency=medium kylin-system-updater (1.2.17.2kord) v101; urgency=medium
* BUG: 无 * BUG: 无