From 7b8ce6a98fa77a12dd6e24ea4279df3982138450 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 22 May 2015 14:35:47 +0530 Subject: [PATCH] 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']