Prompt user before WordOps update

This commit is contained in:
VirtuBox
2022-11-14 15:15:04 +01:00
parent bb981dab85
commit 5dc6b1ec30

View File

@@ -59,6 +59,7 @@ class WOUpdateController(CementBaseController):
install_args = install_args + "--travis " install_args = install_args + "--travis "
wo_branch = "updating-configuration" wo_branch = "updating-configuration"
# check if WordOps already up-to-date
if ((not pargs.force) and (not pargs.travis) and if ((not pargs.force) and (not pargs.travis) and
(not pargs.mainline) and (not pargs.beta) and (not pargs.mainline) and (not pargs.beta) and
(not pargs.branch)): (not pargs.branch)):
@@ -70,6 +71,17 @@ class WOUpdateController(CementBaseController):
.format(wo_latest)) .format(wo_latest))
self.app.close(0) self.app.close(0)
# prompt user before starting upgrade
if not pargs.force:
Log.info(
self, "WordOps changelog available on "
"https://github.com/WordOps/WordOps/releases/tag/{0}"
.format(wo_latest))
start_upgrade = input("Do you want to continue:[y/N]")
if start_upgrade not in ("Y", "y"):
Log.error(self, "Not starting WordOps update")
# download the install/update script
if not os.path.isdir('/var/lib/wo/tmp'): if not os.path.isdir('/var/lib/wo/tmp'):
os.makedirs('/var/lib/wo/tmp') os.makedirs('/var/lib/wo/tmp')
WODownload.download(self, [["https://raw.githubusercontent.com/" WODownload.download(self, [["https://raw.githubusercontent.com/"
@@ -78,6 +90,7 @@ class WOUpdateController(CementBaseController):
"/var/lib/wo/tmp/{0}".format(filename), "/var/lib/wo/tmp/{0}".format(filename),
"update script"]]) "update script"]])
# launch install script
if os.path.isfile('install'): if os.path.isfile('install'):
Log.info(self, "updating WordOps from local install\n") Log.info(self, "updating WordOps from local install\n")
try: try: