Improve wo update

This commit is contained in:
VirtuBox
2019-10-24 22:04:52 +02:00
parent 85e68b1fc6
commit b3cf601879
3 changed files with 26 additions and 19 deletions

View File

@@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Sysctl tweaks are applied during stack install and removed from install script - Sysctl tweaks are applied during stack install and removed from install script
- Nginx systemd tweaks during Nginx install/upgrade and removed from install script - Nginx systemd tweaks during Nginx install/upgrade and removed from install script
- Initial creation of .gitconfig is displayed the first time you run the command `wo` - Initial creation of .gitconfig is displayed the first time you run the command `wo`
- Added `/var/lib/php/sessions/` to open_basedir to allow php sessions storage
#### Fixed #### Fixed

View File

@@ -22,12 +22,17 @@ class WOUpdateController(CementBaseController):
arguments = [ arguments = [
(['--force'], (['--force'],
dict(help='Force WordOps update', action='store_true')), dict(help='Force WordOps update', action='store_true')),
(['--preserve'],
dict(help='Preserve current Nginx configuration',
action='store_true')),
(['--beta'], (['--beta'],
dict(help='Update WordOps to latest beta release', dict(help='Update WordOps to latest mainline release '
'(same than --mainline)',
action='store_true')), action='store_true')),
(['--mainline'],
dict(help='Update WordOps to latest mainline release',
action='store_true')),
(['--branch'],
dict(help="Update WordOps from a specific repository branch ",
action='store' or 'store_const',
const='develop', nargs='?')),
(['--travis'], (['--travis'],
dict(help='Argument used only for WordOps development', dict(help='Argument used only for WordOps development',
action='store_true')), action='store_true')),
@@ -38,17 +43,15 @@ class WOUpdateController(CementBaseController):
def default(self): def default(self):
pargs = self.app.pargs pargs = self.app.pargs
filename = "woupdate" + time.strftime("%Y%m%d-%H%M%S") filename = "woupdate" + time.strftime("%Y%m%d-%H%M%S")
install_args = ""
if pargs.beta: if pargs.mainline or pargs.beta:
wo_branch = "beta" wo_branch = "mainline"
install_args = "" elif pargs.branch:
wo_branch = pargs.branch
else: else:
wo_branch = "master" wo_branch = "master"
install_args = ""
if pargs.force: if pargs.force:
install_args = install_args + "--force " install_args = install_args + "--force "
if pargs.preserve:
install_args = install_args + "--preserve "
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')
@@ -59,13 +62,14 @@ class WOUpdateController(CementBaseController):
"update script"]]) "update script"]])
if pargs.travis: if pargs.travis:
try: if os.path.isfile('install'):
Log.info(self, "updating WordOps, please wait...") try:
os.system("/bin/bash install --travis " Log.info(self, "updating WordOps, please wait...")
"-b $TRAVIS_BRANCH --force") os.system("/bin/bash install --travis "
except OSError as e: "--force")
Log.debug(self, str(e)) except OSError as e:
Log.error(self, "WordOps update failed !") Log.debug(self, str(e))
Log.error(self, "WordOps update failed !")
else: else:
try: try:
Log.info(self, "updating WordOps, please wait...") Log.info(self, "updating WordOps, please wait...")
@@ -76,6 +80,8 @@ class WOUpdateController(CementBaseController):
Log.debug(self, str(e)) Log.debug(self, str(e))
Log.error(self, "WordOps update failed !") Log.error(self, "WordOps update failed !")
os.remove("/var/lib/wo/tmp/{0}".format(filename))
def load(app): def load(app):
# register the plugin class.. this only happens if the plugin is enabled # register the plugin class.. this only happens if the plugin is enabled

View File

@@ -20,4 +20,4 @@ listen.backlog = 32768
catch_workers_output = yes catch_workers_output = yes
{{#openbasedir}}php_admin_value[open_basedir] = "/var/www/:/usr/share/php/:/tmp/:/var/run/nginx-cache/:/dev/urandom:/dev/shm"{{/openbasedir}} {{#openbasedir}}php_admin_value[open_basedir] = "/var/www/:/usr/share/php/:/tmp/:/var/run/nginx-cache/:/dev/urandom:/dev/shm:/var/lib/php/sessions/"{{/openbasedir}}