def UpdateServerInfo(self, si): return self.sendAndWaitRsp({ "update_server": { "cookie": DataModel.Instance().GetCookie(), "si": si } })
def DeleteServers(self, rids): return self.sendAndWaitRsp({ "delete_servers": { "cookie": DataModel.Instance().GetCookie(), "rids": rids } })
def QueryPms(self): try: return self.sendAndWaitRsp( {"query_pms": { "cookie": DataModel.Instance().GetCookie() }}) except Exception as e: print(e) return None
def QueryServerInfo(self, rids): try: return self.sendAndWaitRsp({ "query_server": { "cookie": DataModel.Instance().GetCookie(), "rids": rids } }) except Exception as e: traceback.print_exc()
def QueryUpdateDetail(self, prj, module, ver): try: return self.sendAndWaitRsp({ "query_update_detail": { "cookie": DataModel.Instance().GetCookie(), "project": prj, "module": module, "version": ver } }) except Exception as e: traceback.print_exc()
def QueryMi(self, prj, module): try: return self.sendAndWaitRsp({ "query_mi": { "cookie": DataModel.Instance().GetCookie(), "project": prj, "module": module } }) except Exception as e: traceback.print_exc() return None
def onClieckLogin(self): rlt = RestfulApiClient().Login(self.editUsr.text(),self.editPassword.text()) if not rlt or rlt["login_result"]["result"] != "success": self.failedTimes += 1 self.labelToolTip.show() self.labelToolTip.setStyleSheet("color:red;font-size:18px") self.labelToolTip.setText("login failed, please input again") self.adjustSize() if self.failedTimes > 3: return self.reject() else: DataModel.Instance().UpdateUser(rlt["login_result"]) return self.accept()
def Publish(self, prj, module, ver, gids, detail, code, hash, url): return self.sendAndWaitRsp({ "publish": { "cookie": DataModel.Instance().GetCookie(), "project": prj, "module": module, "version": ver, "gids": gids, "detail": detail, "code": code, "hash": hash, "url": url } })
cfg = { "usr": "******", # 登录UI用账号 "password": "******", # 登录UI用密码 "pubUrl": "http://192.168.221.134:8210/", # 发布后下载url路径 "pubTopic": "publish", # "sftpAddr": [("192.168.221.134", 22, 'root', 'Baidu.com22')], # sftp上传ip、端口、账号、密码 "prjs": [ # 项目名,模块名,发布版本号,待发布文件目录,待发布文件名称前缀,发布描述 ("aods", "aods-x64-win", "0.0.0.0001", ".\\aods-x64-win\\", "aods-x64-win", "fix the bug .1.023,1"), ("aods", "aodc-x64-win", "0.0.0.0001", ".\\aodc-x64-win\\", "aodc-x64-win", "fix the bug .1.023,1") ] } rlt = RestfulApiClient().Login(cfg['usr'], cfg['password']) # 修改为api发布消息 if not rlt or rlt["login_result"]["result"] != "success": Log(LOG_ERROR, "Publish", "Failed to login") sys.exit(1) DataModel.Instance().UpdateUser(rlt["login_result"]) p = Publish(cfg["sftpAddr"], cfg["pubUrl"]) for (prj, mn, ver, folder, pubFileName, detail) in cfg["prjs"]: if not p.Publish(prj, mn, ver, folder, pubFileName, detail): os.system("pause") sys.exit(1) print("执行结束......") time.sleep(20.0)