Merge branch 'backend_manual' of gitlab2.kylin.com:kylinos-src/update-manager-group/kylin-system-updater into backend_manual

This commit is contained in:
luoxueyi 2022-10-28 13:50:17 +08:00
commit 9b06d4aa81
3 changed files with 67 additions and 12 deletions

View File

@ -89,21 +89,66 @@ class UpgradeStrategiesDbusController(dbus.service.Object):
if status == "enable":
with open(self.P2P_DEDAULT_PATH, 'w+') as configfile:
configfile.write("#enable=true\n")
#第一次进行检查是否已经开启
args = ["systemctl","is-enabled","apt-p2p.service"]
p = subprocess.run(args, stdout=subprocess.PIPE,stderr=subprocess.STDOUT,text=True)
if p.returncode != 0:
logging.info("Apt-p2p service is not runing and will be enable...")
#第二次进行重启
args = ["systemctl","enable","apt-p2p.service"]
p = subprocess.run(args, stdout=subprocess.PIPE,stderr=subprocess.STDOUT,text=True)
if p.returncode == 0:
logging.info("Service Enable Execute successfully")
#第三次进行重启
args = ["systemctl","restart","apt-p2p.service"]
p = subprocess.run(args, stdout=subprocess.PIPE,stderr=subprocess.STDOUT,text=True)
if p.returncode == 0:
logging.info("Restart Execute successfully")
return self.RETURN_SUCCESS_CODE,self.RETURN_SUCCESS_DESC
else:
logging.error(str(p.stdout))
logging.error("Failed to execute reboot")
return self.RETURN_UNKNOWN_CODE,str(p.stdout)
else:
logging.error(str(p.stdout))
logging.error("Failed to execute enable")
return self.RETURN_UNKNOWN_CODE,str(p.stdout)
else:
logging.info("Apt-p2p service has been enabled and not need to reabled...")
return self.RETURN_SUCCESS_CODE,self.RETURN_SUCCESS_DESC
elif status == "disable":
with open(self.P2P_DEDAULT_PATH, 'w+') as configfile:
configfile.write("enable=false\n")
args = ["systemctl","is-enabled","apt-p2p.service"]
p = subprocess.run(args, stdout=subprocess.PIPE,stderr=subprocess.STDOUT,text=True)
if p.returncode == 0:
logging.info("Apt-p2p service is runing and will be disable...")
args = ["systemctl","disable","apt-p2p.service"]
p = subprocess.run(args, stdout=subprocess.PIPE,stderr=subprocess.STDOUT,text=True)
if p.returncode == 0:
logging.info("Service disable Execute successfully")
args = ["systemctl","stop","apt-p2p.service"]
p = subprocess.run(args, stdout=subprocess.PIPE,stderr=subprocess.STDOUT,text=True)
if p.returncode == 0:
logging.info("Stop Execute successfully")
return self.RETURN_SUCCESS_CODE,self.RETURN_SUCCESS_DESC
else:
logging.error(str(p.stdout))
logging.error("Failed to execute Stop")
return self.RETURN_UNKNOWN_CODE,str(p.stdout)
else:
logging.error(str(p.stdout))
logging.error("Failed to execute disable")
return self.RETURN_UNKNOWN_CODE,str(p.stdout)
else:
logging.info("Apt-p2p service has been disabled and not need to redisabled...")
return self.RETURN_SUCCESS_CODE,self.RETURN_SUCCESS_DESC
else:
logging.waring("error: input value _status=%s",status)
args = ["systemctl","restart","apt-p2p.service"]
p = subprocess.run(args, stdout=subprocess.PIPE,stderr=subprocess.STDOUT,text=True)
logging.info(str(p.stdout))
if p.returncode == 0:
logging.info("Execute successfully")
return self.RETURN_SUCCESS_CODE,self.RETURN_SUCCESS_DESC
else:
logging.info("Failed to execute reboot")
return self.RETURN_UNKNOWN_CODE,str(p.stdout)
else:
logging.waring("apt-p2p function is not install...")

View File

@ -351,8 +351,7 @@ class InstallBackendAptdaemon(InstallBackend):
self.window_main.dbusController.UpdateDetectStatusChanged(progress,status)
elif action == self.ACTION_INSTALL:
#50%时候 属于下载状态切换到安装状态的过程 下面的代码只执行一次
#Fix 取消的时候进度会直接跳到100 出现判断错误进入安装状态 所以只有在进度51 - 90 之前的一次进度进入安装态
if progress > 51 and progress < 90 and self.on_install_stage == False:
if progress >= 50 and progress < 90 and self.on_install_stage == False:
logging.info("The process is now in the installtion phase")
self.on_install_stage = True
self.safe_manager.shutdown_safe()

11
debian/changelog vendored
View File

@ -1,3 +1,14 @@
kylin-system-updater (2.0.5.15) v101; urgency=medium
* BUG: #140507 : 【2203自适应升级2209】2107升级到2203再由2203自适应升级至2209-RC6失败
#145229 : 【2203自适应升级2209】升级过程中出现弹窗认证
* 需求号: 无
* 其他改动说明: 无
* 其他改动影响域:系统更新
-- luoxueyi <luoxueyi@kylinos.cn> Thu, 27 Oct 2022 17:31:10 +0800
kylin-system-updater (2.0.5.14) v101; urgency=medium
* BUG: #144937 : 【2203自适应升级2209】自动更新下载报错