From c8d54979024e2d5321564f748d31e503ed95dca6 Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Tue, 2 Jun 2015 15:16:15 +0530 Subject: [PATCH] pdated mailstack --- ee/cli/plugins/mailstack.py | 20 ++++++++++++++------ ee/cli/plugins/mysqlstack.py | 6 ++++++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/ee/cli/plugins/mailstack.py b/ee/cli/plugins/mailstack.py index d3b45dc6..462ce9d2 100644 --- a/ee/cli/plugins/mailstack.py +++ b/ee/cli/plugins/mailstack.py @@ -9,6 +9,7 @@ from ee.core.shellexec import CommandExecutionError from ee.core.fileutils import EEFileUtils from ee.core.git import EEGit from ee.core.services import EEService +from ee.cli.plugins.mysqlstack import EEMysqlStack from ee.core.logging import Log from ee.cli.main import app @@ -34,6 +35,15 @@ class EEMailStack(EEStack): def _get_stack(self): return EEMailStack.packages_name + def _requirement_check(self): + """ + Check if requirements for this EEWebmailAdmin stack are fullfilled. + """ + if not EEMysqlStack(self).is_installed(): + self.log.info("EEWebmailAdmin stack requires Mysqlstack to be installed") + print("exiting") + sys.exit(2) + def _add_repo(self): """ Add repository for packages to be downloaded from @@ -47,6 +57,8 @@ class EEMailStack(EEStack): Defines pre-install activities done before installing mail stack """ # Add mail repository + + self._requirement_check() self._add_repo() self.log.debug(self, 'Executing the command debconf-set-selections.') @@ -288,15 +300,11 @@ class EEWebmailAdmin (EEStack): def _get_package_path(self, package): return "/tmp/{0}.tar.gz".format(package) - def _requirement_check(self): - """ - Check if requirements for this EEWebmailAdmin stack are fullfilled. - """ - pass - def _pre_install(self): """ """ + + self._requirement_check() for pkg in self.packages_name: print([self._get_package_url(pkg), '/tmp/{0}.tar.gz'.format(pkg), pkg]) print() diff --git a/ee/cli/plugins/mysqlstack.py b/ee/cli/plugins/mysqlstack.py index 7e069959..46eec68a 100644 --- a/ee/cli/plugins/mysqlstack.py +++ b/ee/cli/plugins/mysqlstack.py @@ -18,6 +18,7 @@ class EEMysqlStack(EEStack): EasyEngine MYSQL stack """ packages_name = ["mariadb-server", "percona-toolkit"] + app = app log = app.log def __init__(self, packages_name=None): @@ -128,3 +129,8 @@ class EEMysqlStack(EEStack): def purge_stack(self): self.log.info("Purging MySQL stack, please wait...") super(EEMysqlStack, self).purge_stack() + + def is_installed(self): + self.log.info("Checking if mysql is installed") + return EEShellExec.cmd_exec(self, "mysqladmin ping") +