Fix missing --force and cleanup code
This commit is contained in:
2
install
2
install
@@ -497,7 +497,7 @@ wo_upgrade_nginx() {
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
/usr/local/bin/wo stack upgrade --nginx
|
/usr/local/bin/wo stack upgrade --nginx --force
|
||||||
fi
|
fi
|
||||||
# restore sites and configuration
|
# restore sites and configuration
|
||||||
[ -f /etc/nginx/htpasswd-ee ] && { mv /etc/nginx/htpasswd-ee /etc/nginx/htpasswd-wo; }
|
[ -f /etc/nginx/htpasswd-ee ] && { mv /etc/nginx/htpasswd-ee /etc/nginx/htpasswd-wo; }
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ class WOStackController(CementBaseController):
|
|||||||
def install(self, packages=[], apt_packages=[], disp_msg=True):
|
def install(self, packages=[], apt_packages=[], disp_msg=True):
|
||||||
"""Start installation of packages"""
|
"""Start installation of packages"""
|
||||||
self.msg = []
|
self.msg = []
|
||||||
|
empty_packages = []
|
||||||
pargs = self.app.pargs
|
pargs = self.app.pargs
|
||||||
try:
|
try:
|
||||||
# Default action for stack installation
|
# Default action for stack installation
|
||||||
@@ -395,25 +396,25 @@ class WOStackController(CementBaseController):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
Log.debug(self, "{0}".format(e))
|
Log.debug(self, "{0}".format(e))
|
||||||
|
|
||||||
if (apt_packages) or (packages):
|
if (apt_packages):
|
||||||
Log.debug(self, "Calling pre_pref")
|
Log.debug(self, "Calling pre_pref")
|
||||||
pre_pref(self, apt_packages)
|
pre_pref(self, apt_packages)
|
||||||
if (apt_packages):
|
# meminfo = (os.popen('/bin/cat /proc/meminfo '
|
||||||
# meminfo = (os.popen('/bin/cat /proc/meminfo '
|
# '| grep MemTotal').read()).split(":")
|
||||||
# '| grep MemTotal').read()).split(":")
|
# memsplit = re.split(" kB", meminfo[1])
|
||||||
# memsplit = re.split(" kB", meminfo[1])
|
# wo_mem = int(memsplit[0])
|
||||||
# wo_mem = int(memsplit[0])
|
# if (wo_mem < 4000000):
|
||||||
# if (wo_mem < 4000000):
|
# WOSwap.add(self)
|
||||||
# WOSwap.add(self)
|
Log.info(self, "Updating apt-cache, please wait...")
|
||||||
Log.info(self, "Updating apt-cache, please wait...")
|
WOAptGet.update(self)
|
||||||
WOAptGet.update(self)
|
Log.info(self, "Installing packages, please wait...")
|
||||||
Log.info(self, "Installing packages, please wait...")
|
WOAptGet.install(self, apt_packages)
|
||||||
WOAptGet.install(self, apt_packages)
|
post_pref(self, apt_packages, empty_packages)
|
||||||
if (packages):
|
if (packages):
|
||||||
Log.debug(self, "Downloading following: {0}".format(packages))
|
Log.debug(self, "Downloading following: {0}".format(packages))
|
||||||
WODownload.download(self, packages)
|
WODownload.download(self, packages)
|
||||||
Log.debug(self, "Calling post_pref")
|
Log.debug(self, "Calling post_pref")
|
||||||
post_pref(self, apt_packages, packages)
|
post_pref(self, empty_packages, packages)
|
||||||
|
|
||||||
if disp_msg:
|
if disp_msg:
|
||||||
if (self.msg):
|
if (self.msg):
|
||||||
|
|||||||
@@ -49,6 +49,9 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
(['--no-prompt'],
|
(['--no-prompt'],
|
||||||
dict(help="Upgrade Packages without any prompt",
|
dict(help="Upgrade Packages without any prompt",
|
||||||
action='store_true')),
|
action='store_true')),
|
||||||
|
(['--force'],
|
||||||
|
dict(help="Force Packages upgrade without any prompt",
|
||||||
|
action='store_true')),
|
||||||
]
|
]
|
||||||
|
|
||||||
@expose(hide=True)
|
@expose(hide=True)
|
||||||
@@ -157,17 +160,15 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
Log.error(self, "Composer isn't installed")
|
Log.error(self, "Composer isn't installed")
|
||||||
|
|
||||||
if len(packages) or len(apt_packages):
|
if len(packages) or len(apt_packages):
|
||||||
|
|
||||||
Log.info(self, "During package update process non nginx-cached"
|
|
||||||
" parts of your site may remain down")
|
|
||||||
# Check prompt
|
|
||||||
if (not pargs.no_prompt):
|
|
||||||
start_upgrade = input("Do you want to continue:[y/N]")
|
|
||||||
if start_upgrade != "Y" and start_upgrade != "y":
|
|
||||||
Log.error(self, "Not starting package update")
|
|
||||||
|
|
||||||
Log.info(self, "Updating packages, please wait...")
|
|
||||||
if len(apt_packages):
|
if len(apt_packages):
|
||||||
|
Log.info(self, "Your site may be down for few seconds if "
|
||||||
|
"you are upgrading Nginx, PHP-FPM, MariaDB or Redis")
|
||||||
|
# Check prompt
|
||||||
|
if ((not pargs.no_prompt) and (not pargs.force)):
|
||||||
|
start_upgrade = input("Do you want to continue:[y/N]")
|
||||||
|
if start_upgrade != "Y" and start_upgrade != "y":
|
||||||
|
Log.error(self, "Not starting package update")
|
||||||
|
Log.info(self, "Updating APT packages, please wait...")
|
||||||
# apt-get update
|
# apt-get update
|
||||||
WOAptGet.update(self)
|
WOAptGet.update(self)
|
||||||
if set(WOVariables.wo_php).issubset(set(apt_packages)):
|
if set(WOVariables.wo_php).issubset(set(apt_packages)):
|
||||||
@@ -180,16 +181,6 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
WOAptGet.install(self, apt_packages)
|
WOAptGet.install(self, apt_packages)
|
||||||
post_pref(self, apt_packages, empty_packages)
|
post_pref(self, apt_packages, empty_packages)
|
||||||
# Post Actions after package updates
|
# Post Actions after package updates
|
||||||
if (set(WOVariables.wo_nginx).issubset(set(apt_packages))):
|
|
||||||
WOService.restart_service(self, 'nginx')
|
|
||||||
if set(WOVariables.wo_php).issubset(set(apt_packages)):
|
|
||||||
WOService.restart_service(self, 'php7.2-fpm')
|
|
||||||
if set(WOVariables.wo_php73).issubset(set(apt_packages)):
|
|
||||||
WOService.restart_service(self, 'php7.3-fpm')
|
|
||||||
if set(WOVariables.wo_mysql).issubset(set(apt_packages)):
|
|
||||||
WOService.restart_service(self, 'mysql')
|
|
||||||
if set(WOVariables.wo_redis).issubset(set(apt_packages)):
|
|
||||||
WOService.restart_service(self, 'redis-server')
|
|
||||||
|
|
||||||
if len(packages):
|
if len(packages):
|
||||||
if pargs.wpcli:
|
if pargs.wpcli:
|
||||||
|
|||||||
Reference in New Issue
Block a user