From 245e455e4e95804cf41b7ae614381c1633f37d8f Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 22 May 2015 10:54:43 +0530 Subject: [PATCH 1/9] Fixes service name that showing error while restarting PHP during ee stack upgrade, fixes #550 #551 --- ee/cli/plugins/stack_upgrade.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ee/cli/plugins/stack_upgrade.py b/ee/cli/plugins/stack_upgrade.py index 3743a11f..cfd01390 100644 --- a/ee/cli/plugins/stack_upgrade.py +++ b/ee/cli/plugins/stack_upgrade.py @@ -203,7 +203,7 @@ class EEStackUpgradeController(CementBaseController): EEService.restart_service(self, 'nginx') if set(EEVariables.ee_php).issubset(set(apt_packages)): - EEService.restart_service(self, 'php') + EEService.restart_service(self, 'php5-fpm') if set(EEVariables.ee_hhvm).issubset(set(apt_packages)): EEService.restart_service(self, 'hhvm') if set(EEVariables.ee_postfix).issubset(set(apt_packages)): From f116bd07ad8e9789ecba3516e008e9c28ee4c6a0 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 22 May 2015 14:18:58 +0530 Subject: [PATCH 2/9] Improved MySQL check to detect while ee stack services --- ee/cli/plugins/stack_services.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/ee/cli/plugins/stack_services.py b/ee/cli/plugins/stack_services.py index 723522f7..a2f40c54 100644 --- a/ee/cli/plugins/stack_services.py +++ b/ee/cli/plugins/stack_services.py @@ -115,7 +115,10 @@ class EEStackStatusController(CementBaseController): Log.info(self, "PHP5-FPM is not installed") if self.app.pargs.mysql: - if EEVariables.ee_mysql_host is "localhost": + if (EEVariables.ee_mysql_host is "localhost" and + (EEAptGet.is_installed(self, 'mysql-server') or + EEAptGet.is_installed(self, 'percona-server-server-5.6') or + EEAptGet.is_installed(self, 'mariadb-server'))): services = services + ['mysql'] else: Log.warn(self, "Remote MySQL found," @@ -179,7 +182,10 @@ class EEStackStatusController(CementBaseController): Log.info(self, "PHP5-FPM is not installed") if self.app.pargs.mysql: - if EEVariables.ee_mysql_host is "localhost": + if (EEVariables.ee_mysql_host is "localhost" and + (EEAptGet.is_installed(self, 'mysql-server') or + EEAptGet.is_installed(self, 'percona-server-server-5.6') or + EEAptGet.is_installed(self, 'mariadb-server'))): services = services + ['mysql'] else: Log.warn(self, "Remote MySQL found," @@ -243,7 +249,10 @@ class EEStackStatusController(CementBaseController): Log.info(self, "PHP5-FPM is not installed") if self.app.pargs.mysql: - if EEVariables.ee_mysql_host is "localhost": + if (EEVariables.ee_mysql_host is "localhost" and + (EEAptGet.is_installed(self, 'mysql-server') or + EEAptGet.is_installed(self, 'percona-server-server-5.6') or + EEAptGet.is_installed(self, 'mariadb-server'))): services = services + ['mysql'] else: Log.warn(self, "Remote MySQL found," @@ -306,7 +315,10 @@ class EEStackStatusController(CementBaseController): Log.info(self, "PHP5-FPM is not installed") if self.app.pargs.mysql: - if EEVariables.ee_mysql_host is "localhost": + if (EEVariables.ee_mysql_host is "localhost" and + (EEAptGet.is_installed(self, 'mysql-server') or + EEAptGet.is_installed(self, 'percona-server-server-5.6') or + EEAptGet.is_installed(self, 'mariadb-server'))): services = services + ['mysql'] else: Log.warn(self, "Remote MySQL found," From 7b8ce6a98fa77a12dd6e24ea4279df3982138450 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 22 May 2015 14:35:47 +0530 Subject: [PATCH 3/9] Improved MySQL service check --- ee/cli/plugins/stack_services.py | 74 +++++++++++++++++++------------- 1 file changed, 43 insertions(+), 31 deletions(-) diff --git a/ee/cli/plugins/stack_services.py b/ee/cli/plugins/stack_services.py index a2f40c54..24f4a11b 100644 --- a/ee/cli/plugins/stack_services.py +++ b/ee/cli/plugins/stack_services.py @@ -115,14 +115,17 @@ class EEStackStatusController(CementBaseController): Log.info(self, "PHP5-FPM is not installed") if self.app.pargs.mysql: - if (EEVariables.ee_mysql_host is "localhost" and - (EEAptGet.is_installed(self, 'mysql-server') or - EEAptGet.is_installed(self, 'percona-server-server-5.6') or - EEAptGet.is_installed(self, 'mariadb-server'))): - services = services + ['mysql'] - else: - Log.warn(self, "Remote MySQL found," - "Unable to stop MySQL service") + if (EEVariables.ee_mysql_host is "localhost"): + if (EEAptGet.is_installed(self, 'mysql-server') or + EEAptGet.is_installed(self, 'percona-server-server-5.6') or + EEAptGet.is_installed(self, 'mariadb-server')): + services = services + ['mysql'] + else: + Log.info(self, "MySQL is not installed") + else: + Log.warn(self, "Remote MySQL found, " + "Unable to check MySQL service status") + if self.app.pargs.postfix: if EEAptGet.is_installed(self, 'postfix'): services = services + ['postfix'] @@ -182,14 +185,17 @@ class EEStackStatusController(CementBaseController): Log.info(self, "PHP5-FPM is not installed") if self.app.pargs.mysql: - if (EEVariables.ee_mysql_host is "localhost" and - (EEAptGet.is_installed(self, 'mysql-server') or - EEAptGet.is_installed(self, 'percona-server-server-5.6') or - EEAptGet.is_installed(self, 'mariadb-server'))): - services = services + ['mysql'] - else: - Log.warn(self, "Remote MySQL found," - "Unable to restart MySQL service") + if (EEVariables.ee_mysql_host is "localhost"): + if (EEAptGet.is_installed(self, 'mysql-server') or + EEAptGet.is_installed(self, 'percona-server-server-5.6') or + EEAptGet.is_installed(self, 'mariadb-server')): + services = services + ['mysql'] + else: + Log.info(self, "MySQL is not installed") + else: + Log.warn(self, "Remote MySQL found, " + "Unable to check MySQL service status") + if self.app.pargs.postfix: if EEAptGet.is_installed(self, 'postfix'): services = services + ['postfix'] @@ -249,14 +255,17 @@ class EEStackStatusController(CementBaseController): Log.info(self, "PHP5-FPM is not installed") if self.app.pargs.mysql: - if (EEVariables.ee_mysql_host is "localhost" and - (EEAptGet.is_installed(self, 'mysql-server') or - EEAptGet.is_installed(self, 'percona-server-server-5.6') or - EEAptGet.is_installed(self, 'mariadb-server'))): - services = services + ['mysql'] - else: - Log.warn(self, "Remote MySQL found," + if (EEVariables.ee_mysql_host is "localhost"): + if (EEAptGet.is_installed(self, 'mysql-server') or + EEAptGet.is_installed(self, 'percona-server-server-5.6') or + EEAptGet.is_installed(self, 'mariadb-server')): + services = services + ['mysql'] + else: + Log.info(self, "MySQL is not installed") + else: + Log.warn(self, "Remote MySQL found, " "Unable to check MySQL service status") + if self.app.pargs.postfix: if EEAptGet.is_installed(self, 'postfix'): services = services + ['postfix'] @@ -315,14 +324,17 @@ class EEStackStatusController(CementBaseController): Log.info(self, "PHP5-FPM is not installed") if self.app.pargs.mysql: - if (EEVariables.ee_mysql_host is "localhost" and - (EEAptGet.is_installed(self, 'mysql-server') or - EEAptGet.is_installed(self, 'percona-server-server-5.6') or - EEAptGet.is_installed(self, 'mariadb-server'))): - services = services + ['mysql'] - else: - Log.warn(self, "Remote MySQL found," - "Unable to reload MySQL service") + if (EEVariables.ee_mysql_host is "localhost"): + if (EEAptGet.is_installed(self, 'mysql-server') or + EEAptGet.is_installed(self, 'percona-server-server-5.6') or + EEAptGet.is_installed(self, 'mariadb-server')): + services = services + ['mysql'] + else: + Log.info(self, "MySQL is not installed") + else: + Log.warn(self, "Remote MySQL found, " + "Unable to check MySQL service status") + if self.app.pargs.postfix: if EEAptGet.is_installed(self, 'postfix'): services = services + ['postfix'] From 93fc360df42ae2064aea121379da8dd1772e96cd Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 22 May 2015 14:49:18 +0530 Subject: [PATCH 4/9] Improved MySQL localhost check --- ee/cli/plugins/stack_services.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ee/cli/plugins/stack_services.py b/ee/cli/plugins/stack_services.py index 24f4a11b..634c6d4a 100644 --- a/ee/cli/plugins/stack_services.py +++ b/ee/cli/plugins/stack_services.py @@ -115,7 +115,8 @@ class EEStackStatusController(CementBaseController): Log.info(self, "PHP5-FPM is not installed") if self.app.pargs.mysql: - if (EEVariables.ee_mysql_host is "localhost"): + if ((EEVariables.ee_mysql_host is "localhost") or + (EEVariables.ee_mysql_host is "127.0.0.1")): if (EEAptGet.is_installed(self, 'mysql-server') or EEAptGet.is_installed(self, 'percona-server-server-5.6') or EEAptGet.is_installed(self, 'mariadb-server')): @@ -185,7 +186,8 @@ class EEStackStatusController(CementBaseController): Log.info(self, "PHP5-FPM is not installed") if self.app.pargs.mysql: - if (EEVariables.ee_mysql_host is "localhost"): + if ((EEVariables.ee_mysql_host is "localhost") or + (EEVariables.ee_mysql_host is "127.0.0.1")): if (EEAptGet.is_installed(self, 'mysql-server') or EEAptGet.is_installed(self, 'percona-server-server-5.6') or EEAptGet.is_installed(self, 'mariadb-server')): @@ -255,7 +257,8 @@ class EEStackStatusController(CementBaseController): Log.info(self, "PHP5-FPM is not installed") if self.app.pargs.mysql: - if (EEVariables.ee_mysql_host is "localhost"): + if ((EEVariables.ee_mysql_host is "localhost") or + (EEVariables.ee_mysql_host is "127.0.0.1")): if (EEAptGet.is_installed(self, 'mysql-server') or EEAptGet.is_installed(self, 'percona-server-server-5.6') or EEAptGet.is_installed(self, 'mariadb-server')): @@ -324,7 +327,8 @@ class EEStackStatusController(CementBaseController): Log.info(self, "PHP5-FPM is not installed") if self.app.pargs.mysql: - if (EEVariables.ee_mysql_host is "localhost"): + if ((EEVariables.ee_mysql_host is "localhost") or + (EEVariables.ee_mysql_host is "127.0.0.1")): if (EEAptGet.is_installed(self, 'mysql-server') or EEAptGet.is_installed(self, 'percona-server-server-5.6') or EEAptGet.is_installed(self, 'mariadb-server')): From 378bcd46aca6b3a5a4cf1417a1bf3c8626b00833 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 22 May 2015 15:34:55 +0530 Subject: [PATCH 5/9] Fixed issue in ee stack start --mysql --- ee/cli/plugins/stack_services.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ee/cli/plugins/stack_services.py b/ee/cli/plugins/stack_services.py index 634c6d4a..7536db74 100644 --- a/ee/cli/plugins/stack_services.py +++ b/ee/cli/plugins/stack_services.py @@ -51,11 +51,18 @@ class EEStackStatusController(CementBaseController): Log.info(self, "PHP5-FPM is not installed") if self.app.pargs.mysql: - if EEVariables.ee_mysql_host is "localhost": - services = services + ['mysql'] + if ((EEVariables.ee_mysql_host is "localhost") or + (EEVariables.ee_mysql_host is "127.0.0.1")): + if (EEAptGet.is_installed(self, 'mysql-server') or + EEAptGet.is_installed(self, 'percona-server-server-5.6') or + EEAptGet.is_installed(self, 'mariadb-server')): + services = services + ['mysql'] + else: + Log.info(self, "MySQL is not installed") else: - Log.warn(self, "Remote MySQL found," - "Unable to start MySQL service") + Log.warn(self, "Remote MySQL found, " + "Unable to check MySQL service status") + if self.app.pargs.postfix: if EEAptGet.is_installed(self, 'postfix'): services = services + ['postfix'] From 22a4f7341589d8a67e0b1ddecffeebb237b86a5c Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 22 May 2015 16:20:15 +0530 Subject: [PATCH 6/9] Added check service config before restart/start --- ee/core/services.py | 43 ++++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/ee/core/services.py b/ee/core/services.py index a32a7ecf..0e4e8758 100644 --- a/ee/core/services.py +++ b/ee/core/services.py @@ -18,9 +18,14 @@ class EEService(): Similar to `service xyz start` """ try: + if service_name in ['nginx', 'php5-fpm']: + service_cmd = ('{0} -t && service {0} start' + .format(service_name)) + else: + service_cmd = ('service {0} start'.format(service_name)) + Log.info(self, "Start : {0:10}" .format(service_name), end='') - retcode = subprocess.getstatusoutput('service {0} start' - .format(service_name)) + retcode = subprocess.getstatusoutput(service_cmd) if retcode[0] == 0: Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + "]") return True @@ -60,9 +65,14 @@ class EEService(): Similar to `service xyz restart` """ try: + if service_name in ['nginx', 'php5-fpm']: + service_cmd = ('{0} -t && service {0} restart' + .format(service_name)) + else: + service_cmd = ('service {0} restart'.format(service_name)) + Log.info(self, "Restart : {0:10}".format(service_name), end='') - retcode = subprocess.getstatusoutput('service {0} restart' - .format(service_name)) + retcode = subprocess.getstatusoutput(service_cmd) if retcode[0] == 0: Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + "]") return True @@ -82,26 +92,13 @@ class EEService(): """ try: if service_name in ['nginx', 'php5-fpm']: - Log.info(self, "Reload : {0:10}".format(service_name), - end='') - retcode = subprocess.getstatusoutput('{0} -t &&' - ' service {0} reload' - .format(service_name)) - if retcode[0] == 0: - # print(retcode[0]) - # subprocess.getstatusoutput('service {0} reload' - # .format(service_name)) - Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + - "]") - return True - else: - Log.debug(self, "{0}".format(retcode[1])) - Log.info(self, "[" + Log.FAIL + "Failed" + - Log.OKBLUE+"]") - return False + service_cmd = ('{0} -t && service {0} reload' + .format(service_name)) + else: + service_cmd = ('service {0} reload'.format(service_name)) + Log.info(self, "Reload : {0:10}".format(service_name), end='') - retcode = subprocess.getstatusoutput('service {0} reload' - .format(service_name)) + retcode = subprocess.getstatusoutput(service_cmd) if retcode[0] == 0: Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + "]") return True From 0b3dc8e12bc7a75484bc5444fc8d6bc5cc02aaeb Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 22 May 2015 17:14:57 +0530 Subject: [PATCH 7/9] Added check for HHVM unsupported systems --- ee/cli/plugins/site_functions.py | 3 +++ ee/cli/plugins/stack.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/ee/cli/plugins/site_functions.py b/ee/cli/plugins/site_functions.py index d082a6e3..0b1a45b5 100644 --- a/ee/cli/plugins/site_functions.py +++ b/ee/cli/plugins/site_functions.py @@ -17,6 +17,7 @@ import sys import getpass import glob import re +import platform class SiteError(Exception): @@ -604,6 +605,8 @@ def site_package_check(self, stype): "/usr/bin/wp", "WP-CLI"]] if self.app.pargs.hhvm: + if platform.architecture()[0] is '32bit': + Log.error(self, "HHVM is not supported by 32bit system") Log.debug(self, "Setting apt_packages variable for HHVM") if not EEAptGet.is_installed(self, 'hhvm'): apt_packages = apt_packages + EEVariables.ee_hhvm diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index a1e9b3c5..9ab47bca 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -25,6 +25,7 @@ import os import pwd import grp import codecs +import platform from ee.cli.plugins.stack_services import EEStackStatusController from ee.cli.plugins.stack_migrate import EEStackMigrateController from ee.cli.plugins.stack_upgrade import EEStackUpgradeController @@ -1494,6 +1495,8 @@ class EEStackController(CementBaseController): if self.app.pargs.hhvm: Log.debug(self, "Setting apt packages variable for HHVM") + if platform.architecture()[0] is '32bit': + Log.error(self, "HHVM is not supported by 32bit system") if not EEAptGet.is_installed(self, 'hhvm'): apt_packages = apt_packages + EEVariables.ee_hhvm else: From 155f169f90d8f2ab86715edc8c8465e8a73029dc Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 22 May 2015 17:36:18 +0530 Subject: [PATCH 8/9] Version Dump 3.1.8 --- ee/core/variables.py | 2 +- install | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ee/core/variables.py b/ee/core/variables.py index 54fd4154..b88d15f9 100644 --- a/ee/core/variables.py +++ b/ee/core/variables.py @@ -12,7 +12,7 @@ class EEVariables(): """Intialization of core variables""" # EasyEngine version - ee_version = "3.1.7" + ee_version = "3.1.8" # EasyEngine packages versions ee_wp_cli = "0.19.1" diff --git a/install b/install index be6a81cb..41f06b0e 100644 --- a/install +++ b/install @@ -48,7 +48,7 @@ fi # Define variables for later use ee_branch=$1 readonly ee_version_old="2.2.3" -readonly ee_version_new="3.1.7" +readonly ee_version_new="3.1.8" readonly ee_log_dir=/var/log/ee/ readonly ee_install_log=/var/log/ee/install.log readonly ee_linux_distro=$(lsb_release -i | awk '{print $3}') diff --git a/setup.py b/setup.py index bbf9bfe8..082650ef 100644 --- a/setup.py +++ b/setup.py @@ -54,7 +54,7 @@ except Exception as e: os.system("git config --global user.email {0}".format(ee_email)) setup(name='ee', - version='3.1.7', + version='3.1.8', description=long_description, long_description=long_description, classifiers=[], From 42e3224fe33f9536b97a7944a96063fc7422adb3 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 22 May 2015 18:20:18 +0530 Subject: [PATCH 9/9] Update changelog for 3.1.8 --- CHANGELOG.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 91fda6ca..1afe3014 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,8 @@ +v 3.1.8 - May 22, 2015 +- Fixed PHP Failed to Restart after Upgrade #550 +- Improved ee stack services command +- Minor fix and improvements + v 3.1.7 - May 21, 2015 - Fixed site blank issue after nginx stack upgrade on Debian - Improved update script