From 0947c80c29dd2535ceaf7dd00ac317dc912a18d8 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 29 Jan 2015 14:25:59 +0530 Subject: [PATCH 01/13] Better commit messges --- ee/cli/plugins/debug.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/ee/cli/plugins/debug.py b/ee/cli/plugins/debug.py index 9734f82f..11f72b6c 100644 --- a/ee/cli/plugins/debug.py +++ b/ee/cli/plugins/debug.py @@ -70,7 +70,7 @@ class EEDebugController(CementBaseController): if not self.trigger_nginx: Log.info(self, "Nginx debug connection already enabled") - self.msg = self.msg + [" /var/log/nginx/*.error.log"] + self.msg = self.msg + ["/var/log/nginx/*.error.log"] # stop global debug elif not self.start and not self.app.pargs.site_name: @@ -99,7 +99,7 @@ class EEDebugController(CementBaseController): else: Log.info(self, "Debug for site allready enabled") - self.msg = self.msg + ['/var/www//logs/error.log' + self.msg = self.msg + ['/var/www/{0}/logs/error.log' .format(self.app.pargs.site_name)] else: @@ -143,6 +143,7 @@ class EEDebugController(CementBaseController): self.app.render((data), 'upstream.mustache', out=ee_nginx) ee_nginx.close() self.trigger_php = True + self.trigger_nginx = True else: Log.info(self, "PHP debug is allready enabled") @@ -161,6 +162,7 @@ class EEDebugController(CementBaseController): self.app.render((data), 'upstream.mustache', out=ee_nginx) ee_nginx.close() self.trigger_php = True + self.trigger_nginx = True else: Log.info(self, "PHP debug is allready disabled") @@ -185,6 +187,7 @@ class EEDebugController(CementBaseController): Log.info(self, "PHP5-FPM log_level = debug already setup") self.msg = self.msg + ['/var/log/php5/fpm.log'] + # PHP5-FPM stop global debug else: if EEShellExec.cmd_exec(self, "grep \"log_level = debug\" " @@ -280,6 +283,11 @@ class EEDebugController(CementBaseController): .format(webroot)) else: Log.info(self, "WordPress debug log already enabled") + + self.msg = self.msg + ['/var/www/{0}/htdocs/wp-content' + '/debug.log' + .format(self.app.pargs.site_name)] + else: Log.info(self, "{0} domain not valid" .format(self.app.pargs.site_name)) @@ -425,10 +433,11 @@ class EEDebugController(CementBaseController): # Reload PHP if self.trigger_php: EEService.reload_service(self, 'php5-fpm') - # - # if len(self.msg) > 0: - # self.app.log.info("Use following command to check debug logs:" - # "\n{0}".format(self.msg.join())) + + if len(self.msg) > 0: + disp_msg = ' '.join(self.msg) + Log.info(self, "Use following command to check debug logs:\n" + + Log.ENDC + "tail -f {0}".format(disp_msg)) def load(app): From dd85c74901a1f67549c173f3a2b466af623e14d5 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 29 Jan 2015 15:05:11 +0530 Subject: [PATCH 02/13] Added -i parameter to ee debug --- ee/cli/plugins/debug.py | 42 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/ee/cli/plugins/debug.py b/ee/cli/plugins/debug.py index 11f72b6c..7961ad95 100644 --- a/ee/cli/plugins/debug.py +++ b/ee/cli/plugins/debug.py @@ -6,8 +6,11 @@ from ee.core.shellexec import EEShellExec from ee.core.mysql import EEMysql from ee.core.services import EEService from ee.core.logging import Log +from ee.cli.plugins.site_functions import logwatch import os import configparser +import glob +import signal def debug_plugin_hook(app): @@ -382,6 +385,31 @@ class EEDebugController(CementBaseController): Log.info(self, "Nginx rewrite logs for {0} allready " " disabled".format(self.app.pargs.site_name)) + @expose(hide=True) + def signal_handler(self, signal, frame): + self.start = False + if self.app.pargs.nginx: + self.debug_nginx() + if self.app.pargs.php: + self.debug_php() + if self.app.pargs.fpm: + self.debug_fpm() + if self.app.pargs.mysql: + self.debug_mysql() + if self.app.pargs.wp: + self.debug_wp() + if self.app.pargs.rewrite: + self.debug_rewrite() + + # Reload Nginx + if self.trigger_nginx: + EEService.reload_service(self, 'nginx') + + # Reload PHP + if self.trigger_php: + EEService.reload_service(self, 'php5-fpm') + self.app.close(0) + @expose(hide=True) def default(self): self.start = True @@ -435,9 +463,17 @@ class EEDebugController(CementBaseController): EEService.reload_service(self, 'php5-fpm') if len(self.msg) > 0: - disp_msg = ' '.join(self.msg) - Log.info(self, "Use following command to check debug logs:\n" - + Log.ENDC + "tail -f {0}".format(disp_msg)) + if not self.app.pargs.interactive: + disp_msg = ' '.join(self.msg) + Log.info(self, "Use following command to check debug logs:\n" + + Log.ENDC + "tail -f {0}".format(disp_msg)) + else: + signal.signal(signal.SIGINT, self.signal_handler) + watch_list = [] + for w_list in self.msg: + watch_list = watch_list + glob.glob(w_list) + + logwatch(self, watch_list) def load(app): From 036c17c6cd44f9f060e309ca203f44c4dc4b4385 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 29 Jan 2015 17:35:51 +0530 Subject: [PATCH 03/13] Fixed ViMbAdmin config error --- ee/cli/templates/vimbadmin.mustache | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ee/cli/templates/vimbadmin.mustache b/ee/cli/templates/vimbadmin.mustache index acdadd7f..16f54d51 100644 --- a/ee/cli/templates/vimbadmin.mustache +++ b/ee/cli/templates/vimbadmin.mustache @@ -1,5 +1,5 @@ ;; This file is licenesed Under GNU GENERAL PUBLIC LICENSE Version 3 -;; © Copyright 2011 - 2014 Open Source Solutions Limited, Dublin, Ireland. +;; © Copyright 2011 - 2014 Open Source Solutions Limited, Dublin, Ireland. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; ViMbAdmin :: Virtual Mailbox Admin @@ -129,7 +129,7 @@ defaults.mailbox.gid = 5000 ; ; http://wiki2.dovecot.org/VirtualUsers/Home -defaults.mailbox.maildir = "maildir:/var/vmail/%d/%u"" +defaults.mailbox.maildir = "maildir:/var/vmail/%d/%u" defaults.mailbox.homedir = "/var/vmail/" ;minimum mailbox password length From 1b521ee9a5edca4b48b861afb3db43390f1ad997 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 29 Jan 2015 17:50:18 +0530 Subject: [PATCH 04/13] Fixed Postfix typo --- ee/cli/plugins/stack.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index fc9b8569..4c97cf59 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -521,7 +521,7 @@ class EEStackController(CementBaseController): "mailbox_maps.cf\"") EEShellExec.cmd_exec(self, "postconf -e \"virtual_alias_maps " "= mysql:/etc/postfix/mysql/virtual_" - " alias_maps.cf\"") + "alias_maps.cf\"") EEShellExec.cmd_exec(self, "openssl req -new -x509 -days " " 3650 -nodes -subj /commonName=" "{HOSTNAME}/emailAddress={EMAIL}" From 54fff3bfa66a8993113f0dccac5133b4c2ea69cf Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 29 Jan 2015 17:56:01 +0530 Subject: [PATCH 05/13] Fixed another Postfix typo --- ee/cli/plugins/stack.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 4c97cf59..103a3b76 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -514,8 +514,8 @@ class EEStackController(CementBaseController): "= static:5000\"") EEShellExec.cmd_exec(self, "postconf -e \"" " virtual_mailbox_domains = " - " mysql:/etc/postfix/mysql/virtual_" - " domains_maps.cf\"") + "mysql:/etc/postfix/mysql/virtual_" + "domains_maps.cf\"") EEShellExec.cmd_exec(self, "postconf -e \"virtual_mailbox_maps" " = mysql:/etc/postfix/mysql/virtual_" "mailbox_maps.cf\"") @@ -534,7 +534,7 @@ class EEStackController(CementBaseController): EEShellExec.cmd_exec(self, "postconf -e \"smtpd_tls_cert_file " "= /etc/ssl/certs/postfix.pem\"") EEShellExec.cmd_exec(self, "postconf -e \"smtpd_tls_key_file " - " = /etc/ssl/private/postfix.pem\"") + "= /etc/ssl/private/postfix.pem\"") # Sieve configuration if not os.path.exists('/var/lib/dovecot/sieve/'): From f894c9e6fe6eb243799c90b0d5b0126000481a6f Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 29 Jan 2015 18:00:53 +0530 Subject: [PATCH 06/13] Fixed MySQL host in Postfix configuration --- ee/cli/plugins/stack.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 103a3b76..31c3345f 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -776,7 +776,7 @@ class EEStackController(CementBaseController): Log.debug(self, "Creating directory " "/etc/postfix/mysql/") os.makedirs('/etc/postfix/mysql/') - data = dict(password=vm_passwd, host=EEVariables.ee_mysql) + data = dict(password=vm_passwd, host=EEVariables.ee_mysql_host) vm_config = open('/etc/postfix/mysql/virtual_alias_maps.cf', 'w') self.app.render((data), 'virtual_alias_maps.mustache', From 1eb9a7b5ac728eefb666c9e115e6f1db6ed28bfe Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 30 Jan 2015 13:11:27 +0530 Subject: [PATCH 07/13] Optimized dovecot setup --- ee/cli/plugins/stack.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 31c3345f..c49d9519 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -473,6 +473,19 @@ class EEStackController(CementBaseController): self.app.render((data), 'dovecot.mustache', out=ee_dovecot) ee_dovecot.close() + EEShellExec.cmd_exec(self, "sed -i \"s/\\!include " + "auth-system.conf.ext/#\\!include " + "auth-system.conf.ext/\" " + "/etc/dovecot/conf.d/10-auth.conf") + + EEShellExec.cmd_exec(self, "sed -i \"s\'/etc/dovecot/" + "dovecot.pem\'/etc/ssl/certs/dovecot.pem" + "\'\" /etc/dovecot/conf.d/10-ssl.conf") + EEShellExec.cmd_exec(self, "sed -i \"s\'/etc/dovecot/" + "private/dovecot.pem\'/etc/ssl/private" + "/dovecot.pem\'\" /etc/dovecot/conf.d/" + "10-ssl.conf") + # Custom Postfix configuration needed with Dovecot # Changes in master.cf # TODO: Find alternative for sed in Python @@ -561,7 +574,7 @@ class EEStackController(CementBaseController): "default.sieve") EEGit.add(self, ["/etc/postfix", "/etc/dovecot"], msg="Installed mail server") - EEService.reload_service(self, 'dovecot') + EEService.restart_service(self, 'dovecot') EEService.reload_service(self, 'postfix') if set(EEVariables.ee_mailscanner).issubset(set(apt_packages)): @@ -598,7 +611,7 @@ class EEStackController(CementBaseController): Log.debug(self, "Restarting clamav-daemon service") EEShellExec.cmd_exec(self, "service clamav-daemon restart") EEGit.add(self, ["/etc/amavis"], msg="Adding Amvis into Git") - EEService.reload_service(self, 'dovecot') + EEService.restart_service(self, 'dovecot') EEService.reload_service(self, 'postfix') EEService.reload_service(self, 'amavis') @@ -817,7 +830,7 @@ class EEStackController(CementBaseController): self.app.render((data), '50-user.mustache', out=vm_config) vm_config.close() - EEService.reload_service(self, 'dovecot') + EEService.restart_service(self, 'dovecot') EEService.reload_service(self, 'nginx') EEService.reload_service(self, 'php5-fpm') self.msg = (self.msg + ["Configure ViMbAdmin:\thttps://{0}:" From e2cea7eac5bbdee0a5aa041261e93fc5de15b204 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 30 Jan 2015 13:27:22 +0530 Subject: [PATCH 08/13] Fixed typo --- ee/cli/plugins/stack.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index c49d9519..26cbfe65 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -883,8 +883,8 @@ class EEStackController(CementBaseController): EEShellExec.cmd_exec(self, "bash -c \"sed -i \\\"s:\$config\[" "\'plugins\'\] " "= array(:\$config\['plugins'\] = " - "array(\n\'sieverules\',:\\\" /var/www" - "/roundcubemail/htdocs/config" + "array(\\n \'sieverules\',:\\\" " + "/var/www/roundcubemail/htdocs/config" "/config.inc.php\"") EEShellExec.cmd_exec(self, "echo \"\$config['sieverules_port']" "=4190;\" >> /var/www/roundcubemail" From d8a8b1be4ab03ec03d932475164854c030b33949 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 30 Jan 2015 14:16:17 +0530 Subject: [PATCH 09/13] Some config changes in postfix --- ee/cli/plugins/stack.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 26cbfe65..9076a67a 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -466,7 +466,7 @@ class EEStackController(CementBaseController): "/dovecot.pem") # Custom Dovecot configuration by EasyEngine - data = dict() + data = dict(email=EEVariables.ee_email) Log.debug(self, "Writting configuration into file" "/etc/dovecot/conf.d/99-ee.conf ") ee_dovecot = open('/etc/dovecot/conf.d/99-ee.conf', 'w') @@ -789,7 +789,13 @@ class EEStackController(CementBaseController): Log.debug(self, "Creating directory " "/etc/postfix/mysql/") os.makedirs('/etc/postfix/mysql/') - data = dict(password=vm_passwd, host=EEVariables.ee_mysql_host) + + if EEVariables.ee_mysql_host is "localhost": + data = dict(password=vm_passwd, host="127.0.0.1") + else: + data = dict(password=vm_passwd, + host=EEVariables.ee_mysql_host) + vm_config = open('/etc/postfix/mysql/virtual_alias_maps.cf', 'w') self.app.render((data), 'virtual_alias_maps.mustache', From b442016d9b47d5379a7f686202e468a4c5a8ff0f Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 30 Jan 2015 18:39:18 +0530 Subject: [PATCH 10/13] FQDN check for mail --- ee/cli/plugins/stack.py | 38 ++++++++++++++++++++++++++++--- ee/cli/templates/50-user.mustache | 2 +- ee/core/checkfqdn.py | 22 ++++++++++++++++++ 3 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 ee/core/checkfqdn.py diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 9076a67a..c87dcca9 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -12,6 +12,7 @@ from ee.core.extract import EEExtract from ee.core.mysql import EEMysql from ee.core.addswap import EESwap from ee.core.git import EEGit +from ee.core.checkfqdn import check_fqdn from pynginxconfig import NginxConfig from ee.core.services import EEService import random @@ -44,6 +45,8 @@ class EEStackController(CementBaseController): dict(help='Install admin tools stack', action='store_true')), (['--mail'], dict(help='Install mail server stack', action='store_true')), + (['--mailscanner'], + dict(help='Install mail scanner stack', action='store_true')), (['--nginx'], dict(help='Install Nginx stack', action='store_true')), (['--php'], @@ -588,6 +591,20 @@ class EEStackController(CementBaseController): out=ee_amavis) ee_amavis.close() + # Amavis ViMbadmin configuration + if os.path.isfile("/etc/postfix/mysql/virtual_alias_maps.cf"): + vm_host = os.popen("grep hosts /etc/postfix/mysql/virtual_" + "alias_maps.cf | awk \'{ print $3 }\' |" + " tr -d '\\n'").read() + vm_pass = os.popen("grep password /etc/postfix/mysql/" + "virtual_alias_maps.cf | awk \'{ print " + "$3 }\' | tr -d '\\n'").read() + + data = dict(host=vm_host, password=vm_pass) + vm_config = open('/etc/amavis/conf.d/50-user', 'w') + self.app.render((data), '50-user.mustache', out=vm_config) + vm_config.close() + # Amavis postfix configuration EEShellExec.cmd_exec(self, "postconf -e \"content_filter = " "smtp-amavis:[127.0.0.1]:10024\"") @@ -948,7 +965,8 @@ class EEStackController(CementBaseController): (not self.app.pargs.php) and (not self.app.pargs.mysql) and (not self.app.pargs.postfix) and (not self.app.pargs.wpcli) and (not self.app.pargs.phpmyadmin) and - (not self.app.pargs.adminer) and (not self.app.pargs.utils)): + (not self.app.pargs.adminer) and (not self.app.pargs.utils) and + (not self.app.pargs.mailscanner)): self.app.pargs.web = True if self.app.pargs.web: @@ -975,6 +993,8 @@ class EEStackController(CementBaseController): self.app.pargs.postfix = True if not EEAptGet.is_installed(self, 'dovecot-core'): + check_fqdn(self, + os.popen("hostname -f | tr -d '\n'").read()) Log.debug(self, "Setting apt_packages variable for mail") apt_packages = apt_packages + EEVariables.ee_mail packages = packages + [["https://github.com/opensolutions/" @@ -990,8 +1010,11 @@ class EEStackController(CementBaseController): "Roundcube"]] if EEVariables.ee_ram > 1024: - apt_packages = (apt_packages + - EEVariables.ee_mailscanner) + self.app.pargs.mailscanner = True + else: + Log.info(self, "System RAM is less than 1GB\nMail " + "scanner packages are not going to install" + " automatically") else: Log.info(self, "Mail server is already installed") @@ -1050,6 +1073,9 @@ class EEStackController(CementBaseController): "htdocs/db/adminer/index.php", "Adminer"]] + if self.app.pargs.mailscanner: + apt_packages = (apt_packages + EEVariables.ee_mailscanner) + if self.app.pargs.utils: Log.debug(self, "Setting packages variable for utils") packages = packages + [["http://phpmemcacheadmin.googlecode" @@ -1149,6 +1175,9 @@ class EEStackController(CementBaseController): EEMysql.execute(self, "drop database IF EXISTS vimbadmin") EEMysql.execute(self, "drop database IF EXISTS roundcubemail") + if self.app.pargs.mailscanner: + apt_packages = (apt_packages + EEVariables.ee_mailscanner) + if self.app.pargs.nginx: Log.debug(self, "Removing apt_packages variable of Nginx") apt_packages = apt_packages + EEVariables.ee_nginx @@ -1225,6 +1254,9 @@ class EEStackController(CementBaseController): EEMysql.execute(self, "drop database IF EXISTS vimbadmin") EEMysql.execute(self, "drop database IF EXISTS roundcubemail") + if self.app.pargs.mailscanner: + apt_packages = (apt_packages + EEVariables.ee_mailscanner) + if self.app.pargs.nginx: Log.debug(self, "Purge apt_packages variable of Nginx") apt_packages = apt_packages + EEVariables.ee_nginx diff --git a/ee/cli/templates/50-user.mustache b/ee/cli/templates/50-user.mustache index e0e0c625..0cee70fb 100644 --- a/ee/cli/templates/50-user.mustache +++ b/ee/cli/templates/50-user.mustache @@ -8,7 +8,7 @@ $final_spam_destiny = D_PASS; # We need to provide list of domains for which filtering need to be done @lookup_sql_dsn = ( -['DBI:mysql:database=vimbadmin;host=127.0.0.1;port=3306', +['DBI:mysql:database=vimbadmin;host={{host}};port=3306', 'vimbadmin', '{{password}}']); diff --git a/ee/core/checkfqdn.py b/ee/core/checkfqdn.py new file mode 100644 index 00000000..ea488a1f --- /dev/null +++ b/ee/core/checkfqdn.py @@ -0,0 +1,22 @@ +from ee.core.shellexec import EEShellExec +from ee.core.variables import EEVariables +import os + + +def check_fqdn(self, ee_host): + #ee_host=os.popen("hostname -f | tr -d '\n'").read() + if '.' in ee_host: + EEVariables.ee_fqdn = ee_host + with open('/etc/hostname', 'w') as hostfile: + hostfile.write(ee_host) + + EEShellExec.cmd_exec(self, "sed -i \"1i\\127.0.0.1 {0}\" /etc/hosts" + .format(ee_host)) + if EEVariables.ee_platform_distro == 'debian': + EEShellExec.cmd_exec(self, "/etc/init.d/hostname.sh start") + else: + EEShellExec.cmd_exec(self, "service hostname restart") + + else: + ee_host = input("Enter hostname [fqdn]:") + check_fqdn(self, ee_host) From cb04cda30fa691aeaa69013086c3922165fd1954 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 30 Jan 2015 19:07:53 +0530 Subject: [PATCH 11/13] Fixed Travis --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index bcd2a8d0..30990a81 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,8 @@ before_install: - rm -rf ~/.gnupg before_script: + - sudo bash -c 'echo example.com > /etc/hostname' + - sudo service hostname restart - sudo apt-get -qq purge mysql* graphviz* - sudo apt-get -qq autoremove From 4c4ac4989a281d9a13b3bf2502acbf10711680ff Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Fri, 30 Jan 2015 19:09:41 +0530 Subject: [PATCH 12/13] changed key server --- ee/cli/plugins/stack.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 9076a67a..0abc7fd0 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -82,7 +82,8 @@ class EEStackController(CementBaseController): EERepo.add(self, repo_url=EEVariables.ee_mysql_repo) Log.debug(self, 'Adding key for {0}' .format(EEVariables.ee_mysql_repo)) - EERepo.add_key(self, '1C4CBDCDCD2EFD2A') + EERepo.add_key(self, '1C4CBDCDCD2EFD2A', + keyserver="subkeys.pgp.net") chars = ''.join(random.sample(string.ascii_letters, 8)) Log.info(self, "Pre-seeding MySQL") EEShellExec.cmd_exec(self, "echo \"percona-server-server-5.6 " From a8b88c42c1fb8d98fbb06bd91b0e0bd4a6bba918 Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Fri, 30 Jan 2015 19:14:41 +0530 Subject: [PATCH 13/13] self parameter missing in add_repo --- ee/core/apt_repo.py | 11 ++++++----- ee/core/aptget.py | 16 +++++++++++++++- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/ee/core/apt_repo.py b/ee/core/apt_repo.py index 4a71a6fb..a2d6f312 100644 --- a/ee/core/apt_repo.py +++ b/ee/core/apt_repo.py @@ -48,11 +48,12 @@ class EERepo(): "--remove '{ppa_name}'" .format(ppa_name=repo_url)) - def add_key(keyids, keyserver=None): + def add_key(self, keyids, keyserver=None): if keyserver is None: - EEShellExec.cmd_exec("gpg --keyserver {serv}" - .format(serv=(keyserver - or "hkp://keys.gnupg.net")) + EEShellExec.cmd_exec(self, "gpg --keyserver {serv}" + .format(serv=(keyserver or + "hkp://keys.gnupg.net")) + " --recv-keys {key}".format(key=keyids)) - EEShellExec.cmd_exec("gpg -a --export --armor {0}".format(keyids) + EEShellExec.cmd_exec(self, "gpg -a --export --armor {0}" + .format(keyids) + " | apt-key add - ") diff --git a/ee/core/aptget.py b/ee/core/aptget.py index 2e533e19..72b4c4cb 100644 --- a/ee/core/aptget.py +++ b/ee/core/aptget.py @@ -50,15 +50,25 @@ class EEAptGet(): #apt_cache.close() return False else: - pkg.mark_install() + try: + print(pkg.name) + pkg.mark_install() + except Exception as e: + Log.debug(self, str(e)) + Log.error(self, str(e)) + try: #apt_pkg.PkgSystemUnLock() result = apt_cache.commit() #apt_cache.close() return result except SystemError as e: + Log.debug(self, 'SystemError: ' + str(e)) Log.error(self, 'SystemError: ' + str(e)) #apt_cache.close() + except Exception as e: + Log.debug(self, str(e)) + Log.error(self, str(e)) else: #apt_cache.close() Log.error(self, 'Unknown package selected (' + @@ -85,6 +95,7 @@ class EEAptGet(): return False else: try: + print(pkg.name) pkg.mark_delete(purge) except SystemError as e: Log.debug(self, 'SystemError: ' + str(e)) @@ -97,6 +108,9 @@ class EEAptGet(): except SystemError as e: Log.debug(self, 'SystemError: ' + str(e)) return False + except Exception as e: + Log.debug(self, str(e)) + Log.error(self, str(e)) # apt_cache.close() else: # apt_cache.close()