From 11f5b1e4602c79a73a622437b88aa1e250917e0d Mon Sep 17 00:00:00 2001 From: gau1991 Date: Wed, 31 Dec 2014 11:57:56 +0530 Subject: [PATCH] Fixed various bugs --- ee/cli/plugins/debug.py | 18 +++++++++--------- ee/cli/plugins/stack.py | 16 ++++++++-------- ee/core/apt_repo.py | 12 +++++++----- ee/core/aptget.py | 8 ++++---- 4 files changed, 28 insertions(+), 26 deletions(-) diff --git a/ee/cli/plugins/debug.py b/ee/cli/plugins/debug.py index bcdaf710..23f26c24 100644 --- a/ee/cli/plugins/debug.py +++ b/ee/cli/plugins/debug.py @@ -17,23 +17,23 @@ class EEDebugController(CementBaseController): stacked_type = 'nested' arguments = [ (['--stop'], - dict(help='Install web stack', action='store_true')), + dict(help='Stop debug', action='store_true')), (['--start'], - dict(help='Install admin tools stack', action='store_true')), + dict(help='Start debug', action='store_true')), (['--nginx'], - dict(help='Install mail server stack', action='store_true')), + dict(help='Debug Nginx', action='store_true')), (['--php'], - dict(help='Install Nginx stack', action='store_true')), + dict(help='Debug PHP', action='store_true')), (['--fpm'], - dict(help='Install PHP stack', action='store_true')), + dict(help='Debug FastCGI', action='store_true')), (['--mysql'], - dict(help='Install MySQL stack', action='store_true')), + dict(help='Debug MySQL', action='store_true')), (['--wp'], - dict(help='Install Postfix stack', action='store_true')), + dict(help='Debug WordPress sites', action='store_true')), (['--rewrite'], - dict(help='Install WPCLI stack', action='store_true')), + dict(help='Debug Nginx rewrite rules', action='store_true')), (['-i', '--interactive'], - dict(help='Install WPCLI stack', action='store_true')), + dict(help='Interactive debug', action='store_true')), ] @expose(hide=True) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 120f7c87..15f33391 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -79,9 +79,9 @@ class EEStackController(CementBaseController): "$(hostname -f)\" | debconf-set-selections") if set(EEVariables.ee_mysql).issubset(set(apt_packages)): print("Adding repository for MySQL ... ") - EERepo.add(repo_url=EEVariables.ee_mysql_repo) + EERepo.add(self, repo_url=EEVariables.ee_mysql_repo) self.app.log.debug('Adding key of MySQL.') - EERepo.add_key('1C4CBDCDCD2EFD2A') + EERepo.add_key(self, '1C4CBDCDCD2EFD2A') chars = ''.join(random.sample(string.ascii_letters, 8)) print("Pre-seeding MySQL variables ... ") EEShellExec.cmd_exec(self, "echo \"percona-server-server-5.6 " @@ -107,26 +107,26 @@ class EEStackController(CementBaseController): print("Adding repository for Nginx ... ") if EEVariables.ee_platform_distro == 'Debian': self.app.log.debug('Adding Dotdeb/nginx GPG key') - EERepo.add(repo_url=EEVariables.ee_nginx_repo) + EERepo.add(self, repo_url=EEVariables.ee_nginx_repo) else: self.app.log.debug('Adding ppa of Nginx') - EERepo.add(ppa=EEVariables.ee_nginx_repo) + EERepo.add(self, ppa=EEVariables.ee_nginx_repo) if set(EEVariables.ee_php).issubset(set(apt_packages)): print("Adding repository for PHP ... ") if EEVariables.ee_platform_distro == 'Debian': self.app.log.debug('Adding repo_url of php for Debian') - EERepo.add(repo_url=EEVariables.ee_php_repo) + EERepo.add(self, repo_url=EEVariables.ee_php_repo) self.app.log.debug('Adding Dotdeb/php GPG key') - EERepo.add_key('89DF5277') + EERepo.add_key(self, '89DF5277') else: self.app.log.debug('Adding ppa for PHP') - EERepo.add(ppa=EEVariables.ee_php_repo) + EERepo.add(self, ppa=EEVariables.ee_php_repo) if set(EEVariables.ee_mail).issubset(set(apt_packages)): if EEVariables.ee_platform_codename == 'squeeze': print("Adding repository for dovecot ... ") - EERepo.add(repo_url=EEVariables.ee_dovecot_repo) + EERepo.add(self, repo_url=EEVariables.ee_dovecot_repo) self.app.log.debug('Executing the command debconf-set-selections.') EEShellExec.cmd_exec(self, "echo \"dovecot-core dovecot-core/" "create-ssl-cert boolean yes\" " diff --git a/ee/core/apt_repo.py b/ee/core/apt_repo.py index 0ed5c554..8ad22f34 100644 --- a/ee/core/apt_repo.py +++ b/ee/core/apt_repo.py @@ -10,7 +10,7 @@ class EERepo(): """Initialize """ pass - def add(repo_url=None, ppa=None): + def add(self, repo_url=None, ppa=None): # TODO add repository code if repo_url is not None: @@ -31,13 +31,15 @@ class EERepo(): print("Cannot add repo for {distro}" .format(distro=EEVariables.ee_platform_distro)) else: - EEShellExec.cmd_exec("add-apt-repository -y '{ppa_name}'" + EEShellExec.cmd_exec(self, "add-apt-repository -y " + "'{ppa_name}'" .format(ppa_name=ppa)) - def remove(repo_url=None): + def remove(self, repo_url=None): # TODO remove repository - EEShellExec.cmd_exec("add-apt-repository -y " - "--remove '{ppa_name}'".format(ppa_name=repo_url)) + EEShellExec.cmd_exec(self, "add-apt-repository -y " + "--remove '{ppa_name}'" + .format(ppa_name=repo_url)) pass def add_key(keyids, keyserver=None): diff --git a/ee/core/aptget.py b/ee/core/aptget.py index f7fc1776..645a40c8 100644 --- a/ee/core/aptget.py +++ b/ee/core/aptget.py @@ -13,7 +13,7 @@ class EEAptGet: def update(self): """Similar to apt-get update""" - self.app.log.debug("Update cache") + # self.app.log.debug("Update cache") self.cache.update(self.fprogress) self.cache.open() @@ -202,19 +202,19 @@ class EEAptGet: # Check if packages available for remove/update. if self.cache.delete_count > 0: - self.app.log.debug('packages will be REMOVED ') + # self.app.log.debug('packages will be REMOVED ') print("The following packages will be REMOVED:" "\n {pkg_name}" .format(pkg_name=my_selected_packages)) print("{pkg_remove_count} to remove." .format(pkg_remove_count=self.cache.delete_count)) - self.app.log.debug('bytes disk space will be freed') + # self.app.log.debug('bytes disk space will be freed') print("After this operation, {space} bytes disk spac" "e will be freed.".format(space=self.cache.required_space)) try: self.cache.commit(self.fprogress, self.iprogress) except Exception as e: - self.app.log.error('Sorry, package installation failed ') + # self.app.log.error('Sorry, package installation failed ') print("Sorry, package installation failed [{err}]" .format(err=str(e))) return(False)