diff --git a/install b/install index 926c222..88bf2ff 100755 --- a/install +++ b/install @@ -9,7 +9,7 @@ # ------------------------------------------------------------------------- # wget -qO wo wops.cc && sudo bash wo # ------------------------------------------------------------------------- -# Version 3.9.8.10 - 2019-09-04 +# Version 3.9.8.11 - 2019-09-07 # ------------------------------------------------------------------------- # CONTENTS @@ -541,6 +541,7 @@ wo_upgrade_nginx() { sed -i "s/locations-php73.conf/locations-wo.conf/" /etc/nginx/sites-available/* sed -i "s/php.conf/php72.conf/" /etc/nginx/sites-available/* sed -i "s/php7.conf/php72.conf/" /etc/nginx/sites-available/* + sed -i "s/php7.conf/php72.conf/" /etc/nginx/sites-available/* sed -i 's/ssl on;/#ssl on;/' /var/www/*/conf/nginx/ssl.conf # update redis.conf headers @@ -970,10 +971,10 @@ else elif [ "$wo_upgrade" = "1" ]; then wo_lib_echo "WordOps (wo) upgrade to $wo_version_new was succesfull!" echo - wo_lib_echo "To upgrade Nginx use the command:" - wo_lib_echo_info "wo stack upgrade --nginx" + wo_lib_echo "To upgrade WordOps stacks use the command:" + wo_lib_echo_info "wo stack upgrade --all" echo - wo_lib_echo "To update other packages use the command:" + wo_lib_echo "To update all other server packages use the command:" wo_lib_echo_info "wo maintenance" else wo_lib_echo "WordOps (wo) installed successfully" diff --git a/wo/cli/main.py b/wo/cli/main.py index d0c009e..36fbf04 100644 --- a/wo/cli/main.py +++ b/wo/cli/main.py @@ -79,56 +79,55 @@ class WOTestApp(WOApp): # Define the applicaiton object outside of main, as some libraries might wish # to import it as a global (rather than passing it into another class/func) -app = WOApp() - def main(): - try: - global sys - # Default our exit status to 0 (non-error) - code = 0 + with WOApp() as app: + try: + global sys + # Default our exit status to 0 (non-error) + code = 0 - # if not root...kick out - if not os.geteuid() == 0: - print("\nNon-privileged users cant use WordOps. " - "Switch to root or invoke sudo.\n") - app.close(1) + # if not root...kick out + if not os.geteuid() == 0: + print("\nNon-privileged users cant use WordOps. " + "Switch to root or invoke sudo.\n") + app.close(1) - # Setup the application - app.setup() + # Setup the application + app.setup() - # Dump all arguments into wo log - app.log.debug(sys.argv) + # Dump all arguments into wo log + app.log.debug(sys.argv) - # Run the application - app.run() - except exc.WOError as e: - # Catch our application errors and exit 1 (error) - code = 1 - print(e) - except FrameworkError as e: - # Catch framework errors and exit 1 (error) - code = 1 - print(e) - except CaughtSignal as e: - # Default Cement signals are SIGINT and SIGTERM, exit 0 (non-error) - code = 0 - print(e) - except Exception as e: - code = 1 - print(e) - finally: - # Print an exception (if it occurred) and --debug was passed - if app.debug: - import sys - import traceback + # Run the application + app.run() + except exc.WOError as e: + # Catch our application errors and exit 1 (error) + code = 1 + print(e) + except FrameworkError as e: + # Catch framework errors and exit 1 (error) + code = 1 + print(e) + except CaughtSignal as e: + # Default Cement signals are SIGINT and SIGTERM, exit 0 (non-error) + code = 0 + print(e) + except Exception as e: + code = 1 + print(e) + finally: + # Print an exception (if it occurred) and --debug was passed + if app.debug: + import sys + import traceback - exc_type, exc_value, exc_traceback = sys.exc_info() - if exc_traceback is not None: - traceback.print_exc() + exc_type, exc_value, exc_traceback = sys.exc_info() + if exc_traceback is not None: + traceback.print_exc() - # # Close the application - app.close(code) + # # Close the application + app.close(code) def get_test_app(**kw): diff --git a/wo/cli/plugins/stack_pref.py b/wo/cli/plugins/stack_pref.py index 7488f70..3aa4c24 100644 --- a/wo/cli/plugins/stack_pref.py +++ b/wo/cli/plugins/stack_pref.py @@ -780,22 +780,22 @@ def post_pref(self, apt_packages, packages, upgrade=False): with open("/etc/php/7.3/fpm/pool.d/debug.conf", encoding='utf-8', mode='a') as myfile: - myfile.write("php_admin_value[xdebug.profiler_output_dir] " - "= /tmp/ \nphp_admin_value[xdebug.profiler_" - "output_name] = cachegrind.out.%p-%H-%R " - "\nphp_admin_flag[xdebug.profiler_enable" - "_trigger] = on \nphp_admin_flag[xdebug." - "profiler_enable] = off\n") + myfile.write( + "php_admin_value[xdebug.profiler_output_dir] " + "= /tmp/ \nphp_admin_value[xdebug.profiler_" + "output_name] = cachegrind.out.%p-%H-%R " + "\nphp_admin_flag[xdebug.profiler_enable" + "_trigger] = on \nphp_admin_flag[xdebug." + "profiler_enable] = off\n") # Disable xdebug - if not WOShellExec.cmd_exec(self, "grep -q \';zend_extension\'" - " /etc/php/7.3/mods-available" - "/xdebug.ini"): - WOFileUtils.searchreplace(self, "/etc/php/7.3/" - "mods-available/" - "xdebug.ini", - "zend_extension", - ";zend_extension") + if not WOShellExec.cmd_exec( + self, "grep -q \';zend_extension\'" + " /etc/php/7.3/mods-available/xdebug.ini"): + WOFileUtils.searchreplace( + self, "/etc/php/7.3/mods-available/" + "xdebug.ini", + "zend_extension", ";zend_extension") # PHP and Debug pull configuration if not os.path.exists('{0}22222/htdocs/fpm/status/' @@ -892,20 +892,21 @@ def post_pref(self, apt_packages, packages, upgrade=False): if not os.path.isfile("/etc/fail2ban/jail.d/custom.conf"): Log.info(self, "Configuring Fail2Ban") data = dict() - WOTemplate.render(self, - '/etc/fail2ban/jail.d/custom.conf', - 'fail2ban.mustache', - data, overwrite=False) - WOTemplate.render(self, - '/etc/fail2ban/filter.d/' - 'wo-wordpress.conf', - 'fail2ban-wp.mustache', - data, overwrite=False) - WOTemplate.render(self, - '/etc/fail2ban/filter.d/' - 'nginx-forbidden.conf', - 'fail2ban-forbidden.mustache', - data, overwrite=False) + WOTemplate.render( + self, + '/etc/fail2ban/jail.d/custom.conf', + 'fail2ban.mustache', + data, overwrite=False) + WOTemplate.render( + self, + '/etc/fail2ban/filter.d/wo-wordpress.conf', + 'fail2ban-wp.mustache', + data, overwrite=False) + WOTemplate.render( + self, + '/etc/fail2ban/filter.d/nginx-forbidden.conf', + 'fail2ban-forbidden.mustache', + data, overwrite=False) WOGit.add(self, ["/etc/fail2ban"], msg="Adding Fail2ban into Git") @@ -916,22 +917,18 @@ def post_pref(self, apt_packages, packages, upgrade=False): if os.path.isfile("/etc/proftpd/proftpd.conf"): Log.info(self, "Configuring ProFTPd") Log.debug(self, "Setting up Proftpd configuration") - WOFileUtils.searchreplace(self, "/etc/proftpd/" - "proftpd.conf", - "# DefaultRoot", - "DefaultRoot") - WOFileUtils.searchreplace(self, "/etc/proftpd/" - "proftpd.conf", - "# RequireValidShell", - "RequireValidShell") - WOFileUtils.searchreplace(self, "/etc/proftpd/" - "proftpd.conf", - "# PassivePorts " - " " - "49152 65534", - "PassivePorts " - " " - " 49000 50000") + WOFileUtils.searchreplace( + self, "/etc/proftpd/proftpd.conf", + "# DefaultRoot", "DefaultRoot") + WOFileUtils.searchreplace( + self, "/etc/proftpd/proftpd.conf", + "# RequireValidShell", "RequireValidShell") + WOFileUtils.searchreplace( + self, "/etc/proftpd/proftpd.conf", + "# PassivePorts " + "49152 65534", + "PassivePorts " + " 49000 50000") # proftpd TLS configuration if not os.path.isdir("/etc/proftpd/ssl"): WOFileUtils.mkdir(self, "/etc/proftpd/ssl") @@ -1361,9 +1358,10 @@ def post_pref(self, apt_packages, packages, upgrade=False): WOShellExec.cmd_exec(self, 'mysql < {0}22222/htdocs/db' '/anemometer/install.sql' .format(WOVariables.wo_webroot)) - except CommandExecutionError as e: + except Exception as e: Log.debug(self, "{0}".format(e)) - raise SiteError("Unable to import Anemometer database") + Log.error(self, "failed to configure Anemometer", + exit=False) WOMysql.execute(self, 'grant select on' ' *.* to \'anemometer\''