From b38e59fe185d56255f619c70df386afb12df7edb Mon Sep 17 00:00:00 2001 From: "shital.rtcamp" Date: Fri, 13 Feb 2015 12:13:57 +0530 Subject: [PATCH 01/10] removed hard coded version of wp-cli in sitefunction.py --- ee/cli/plugins/clean.py | 2 +- ee/cli/plugins/site_functions.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ee/cli/plugins/clean.py b/ee/cli/plugins/clean.py index 9718fc3b..28c5a5ab 100644 --- a/ee/cli/plugins/clean.py +++ b/ee/cli/plugins/clean.py @@ -50,7 +50,7 @@ class EECleanController(CementBaseController): @expose(hide=True) def clean_memcache(self): - """This function Clears memcache""" + """This function Clears memcache """ try: if(EEAptGet.is_installed(self, "memcached")): EEService.restart_service(self, "memcached") diff --git a/ee/cli/plugins/site_functions.py b/ee/cli/plugins/site_functions.py index b12d3673..5d4328b9 100644 --- a/ee/cli/plugins/site_functions.py +++ b/ee/cli/plugins/site_functions.py @@ -418,9 +418,10 @@ def site_package_check(self, stype): Log.debug(self, "Setting packages variable for WP-CLI") if not EEShellExec.cmd_exec(self, "which wp"): packages = packages + [["https://github.com/wp-cli/wp-cli/" - "releases/download/v0.17.1/" - "wp-cli.phar", "/usr/bin/wp", - "WP-CLI"]] + "releases/download/{0}/" + "wp-cli.phar" + .format(EEVariables.ee_wp_cli), + "/usr/bin/wp", "WP-CLI"]] return(stack.install(apt_packages=apt_packages, packages=packages, disp_msg=False)) From c962c126c60f3272dd27f509b9a564526bf65ab2 Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Fri, 13 Feb 2015 13:41:43 +0530 Subject: [PATCH 02/10] added quotes for sql queries --- ee/cli/plugins/site_functions.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ee/cli/plugins/site_functions.py b/ee/cli/plugins/site_functions.py index 379f9d89..4de87e68 100644 --- a/ee/cli/plugins/site_functions.py +++ b/ee/cli/plugins/site_functions.py @@ -112,15 +112,15 @@ def setupdatabase(self, data): # create MySQL database Log.info(self, "Setting up database\t\t", end='') Log.debug(self, "Creating databse {0}".format(ee_db_name)) - EEMysql.execute(self, "create database {0}" + EEMysql.execute(self, "create database `{0}`" .format(ee_db_name), errormsg="Cannot create database") # Create MySQL User Log.debug(self, "Creating user {0}".format(ee_db_username)) - Log.debug(self, "create user {0}@{1} identified by ''" + Log.debug(self, "create user `{0}`@`{1}` identified by ''" .format(ee_db_username, ee_mysql_grant_host)) EEMysql.execute(self, - "create user {0}@{1} identified by '{2}'" + "create user `{0}`@`{1}` identified by '{2}'" .format(ee_db_username, ee_mysql_grant_host, ee_db_password), errormsg="Cannot setup database user", log=False) @@ -128,7 +128,7 @@ def setupdatabase(self, data): # Grant permission Log.debug(self, "Setting up user privileges") EEMysql.execute(self, - "grant all privileges on {0}.* to {1}@{2}" + "grant all privileges on `{0}`.* to `{1}`@`{2}`" .format(ee_db_name, ee_db_username, ee_mysql_grant_host), errormsg="Cannot setup database user privileges") Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]") From c4e301d106ecfff859b02231b6a7f392e8ea72d2 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 13 Feb 2015 13:46:39 +0530 Subject: [PATCH 03/10] Improved Nginx reinstallation --- 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 56535fb1..1d3fff20 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -155,8 +155,8 @@ class EEStackController(CementBaseController): EEService.reload_service(self, 'postfix') if set(EEVariables.ee_nginx).issubset(set(apt_packages)): - if ((not os.path.isfile('/etc/nginx/conf.d/ee-nginx.conf')) and - os.path.isfile('/etc/nginx/nginx.conf')): + if ((not EEShellExec.cmd_exec(self, "grep -Hr EasyEngine " + "/etc/nginx")) and os.path.isfile('/etc/nginx/nginx.conf')): nc = NginxConfig() Log.debug(self, 'Loading file /etc/nginx/nginx.conf ') nc.loadf('/etc/nginx/nginx.conf') From 155755d247b76d4334254a2eb4cfa3dcc3e663f0 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 13 Feb 2015 14:06:34 +0530 Subject: [PATCH 04/10] Added gcc as a dependency --- install | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install b/install index 336a37aa..7857b936 100644 --- a/install +++ b/install @@ -39,13 +39,13 @@ function install_dep() # Install Python3 on users system ee_lib_echo "Installing pre depedencies" if [ "$EE_LINUX_DISTRO" == "Ubuntu" ]; then - apt-get -y install python-software-properties software-properties-common python3 python3-apt python3-setuptools python3-dev sqlite3 git || ee_lib_error "Unable to install pre depedencies, exit status " 1 + apt-get -y install gcc python-software-properties software-properties-common python3 python3-apt python3-setuptools python3-dev sqlite3 git || ee_lib_error "Unable to install pre depedencies, exit status " 1 elif [ "$EE_LINUX_DISTRO" == "Debian" ]; then - apt-get -y install graphviz python-software-properties python3 python3-apt python3-setuptools python3-dev sqlite3 git || ee_lib_error "Unable to pre depedencies, exit status " 1 + apt-get -y install gcc graphviz python-software-properties python3 python3-apt python3-setuptools python3-dev sqlite3 git || ee_lib_error "Unable to pre depedencies, exit status " 1 fi # Generating Locale - locale-gen en &>> /dev/null + locale-gen en &>> /dev/null } function sync_db() From 9cd8fb64dada991816c8ed27c0616a808cfe2483 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 13 Feb 2015 14:50:20 +0530 Subject: [PATCH 05/10] keyserver issue fix --- ee/cli/plugins/stack.py | 2 +- ee/core/apt_repo.py | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 1d3fff20..dd79b781 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -90,7 +90,7 @@ class EEStackController(CementBaseController): Log.debug(self, 'Adding key for {0}' .format(EEVariables.ee_mysql_repo)) EERepo.add_key(self, '1C4CBDCDCD2EFD2A', - keyserver="subkeys.pgp.net") + keyserver="http://keyserver.ubuntu.com:80") chars = ''.join(random.sample(string.ascii_letters, 8)) Log.debug(self, "Pre-seeding MySQL") EEShellExec.cmd_exec(self, "echo \"percona-server-server-5.6 " diff --git a/ee/core/apt_repo.py b/ee/core/apt_repo.py index aea5b2a7..a32794b5 100644 --- a/ee/core/apt_repo.py +++ b/ee/core/apt_repo.py @@ -71,11 +71,10 @@ class EERepo(): default keyserver is hkp://keys.gnupg.net user can provide other keyserver with keyserver="hkp://xyz" """ - if keyserver is None: - EEShellExec.cmd_exec(self, "gpg --keyserver {serv}" - .format(serv=(keyserver or - "hkp://keys.gnupg.net")) - + " --recv-keys {key}".format(key=keyids)) - EEShellExec.cmd_exec(self, "gpg -a --export --armor {0}" - .format(keyids) - + " | apt-key add - ") + EEShellExec.cmd_exec(self, "gpg --keyserver {serv}" + .format(serv=(keyserver or + "hkp://keys.gnupg.net")) + + " --recv-keys {key}".format(key=keyids)) + EEShellExec.cmd_exec(self, "gpg -a --export --armor {0}" + .format(keyids) + + " | apt-key add - ") From 902a1eae3cf5b00286f64d4985593d31243d1dc4 Mon Sep 17 00:00:00 2001 From: "shital.rtcamp" Date: Fri, 13 Feb 2015 15:27:30 +0530 Subject: [PATCH 06/10] updated site_function.py --- ee/cli/plugins/site_functions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ee/cli/plugins/site_functions.py b/ee/cli/plugins/site_functions.py index 889d3df3..680c5263 100644 --- a/ee/cli/plugins/site_functions.py +++ b/ee/cli/plugins/site_functions.py @@ -423,8 +423,8 @@ def site_package_check(self, stype): Log.debug(self, "Setting packages variable for WP-CLI") if not EEShellExec.cmd_exec(self, "which wp"): packages = packages + [["https://github.com/wp-cli/wp-cli/" - "releases/download/{0}/" - "wp-cli.phar" + "releases/download/v{0}/" + "wp-cli-{0}.phar" .format(EEVariables.ee_wp_cli), "/usr/bin/wp", "WP-CLI"]] return(stack.install(apt_packages=apt_packages, packages=packages, From c79eaa0726361bdaec4cc96e1ac1e5e177bc7662 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 13 Feb 2015 16:25:10 +0530 Subject: [PATCH 07/10] Keyserver URL changed --- 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 dd79b781..0690a2bf 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -90,7 +90,7 @@ class EEStackController(CementBaseController): Log.debug(self, 'Adding key for {0}' .format(EEVariables.ee_mysql_repo)) EERepo.add_key(self, '1C4CBDCDCD2EFD2A', - keyserver="http://keyserver.ubuntu.com:80") + keyserver="keyserver.ubuntu.com") chars = ''.join(random.sample(string.ascii_letters, 8)) Log.debug(self, "Pre-seeding MySQL") EEShellExec.cmd_exec(self, "echo \"percona-server-server-5.6 " From e72d48eadcded309a3622493eb496fca18be326c Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 13 Feb 2015 17:44:15 +0530 Subject: [PATCH 08/10] Fixed local variable cur referenced before assignment --- ee/core/mysql.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ee/core/mysql.py b/ee/core/mysql.py index c40b2bfd..cc245ede 100644 --- a/ee/core/mysql.py +++ b/ee/core/mysql.py @@ -48,6 +48,9 @@ class EEMysql(): .format(statement)) cur.execute(statement) + cur.close() + conn.close() + except Exception as e: cur.close() conn.close() @@ -57,8 +60,6 @@ class EEMysql(): else: Log.error(self, '{0}'.format(errormsg)) - cur.close() - conn.close() # def __del__(self): # self.cur.close() From b98167d6f93aba1c0564873935653e74aa2e9eca Mon Sep 17 00:00:00 2001 From: "shital.rtcamp" Date: Fri, 13 Feb 2015 18:33:27 +0530 Subject: [PATCH 09/10] added git commit message in secure.py --- ee/cli/plugins/secure.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/ee/cli/plugins/secure.py b/ee/cli/plugins/secure.py index d29ac091..c7007bb9 100644 --- a/ee/cli/plugins/secure.py +++ b/ee/cli/plugins/secure.py @@ -3,6 +3,7 @@ from cement.core import handler, hook from ee.core.shellexec import EEShellExec from ee.core.variables import EEVariables from ee.core.logging import Log +from ee.core.git import EEGit import string import random import sys @@ -55,8 +56,8 @@ class EESecureController(CementBaseController): if username == "": self.app.pargs.user_input = EEVariables.ee_user if not self.app.pargs.user_pass: - password = input("Provide HTTP authentication " - "password [{0}] :".format(passwd)) + password = getpass.getpass("Provide HTTP authentication " + "password [{0}] :".format(passwd)) self.app.pargs.user_pass = password if password == "": self.app.pargs.user_pass = passwd @@ -71,12 +72,8 @@ class EESecureController(CementBaseController): .format(username=self.app.pargs.user_input, password=self.app.pargs.user_pass), log=False) - Log.info(self, "Successfully changed HTTP authentication" - " username to : {username}" - .format(username=self.app.pargs.user_input), log=False) - Log.info(self, "Successfully changed HTTP authentication" - " password to : {password}" - .format(password=self.app.pargs.user_pass), log=False) + EEGit.add(self, ["/etc/nginx"], + msg="Adding changed secure auth into Git") @expose(hide=True) def secure_port(self): @@ -104,6 +101,9 @@ class EESecureController(CementBaseController): "{port} default_server ssl;/\" " "/etc/nginx/sites-available/22222" .format(port=self.app.pargs.user_input)) + EEGit.add(self, ["/etc/nginx"], + msg="Adding changed secure port into Git") + Log.info(self, "Successfully port changed {port}" .format(port=self.app.pargs.user_input)) @@ -127,6 +127,9 @@ class EESecureController(CementBaseController): "\"/deny/i allow {whitelist_adre}\;\"" " /etc/nginx/common/acl.conf" .format(whitelist_adre=ip_addr)) + EEGit.add(self, ["/etc/nginx"], + msg="Adding changed secure ip into Git") + Log.info(self, "Successfully added IP address in acl.conf file") From 8ec42f8547a5baf9f46a75a0e1f02181ca8d6c53 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 13 Feb 2015 18:55:50 +0530 Subject: [PATCH 10/10] EasyEngine 3.0.2 --- ee/core/variables.py | 2 +- install | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ee/core/variables.py b/ee/core/variables.py index 24b3c269..e42c3950 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.0.1" + ee_version = "3.0.2" # EasyEngine packages versions ee_wp_cli = "0.18.0" diff --git a/install b/install index 7857b936..e9892983 100644 --- a/install +++ b/install @@ -5,7 +5,7 @@ # to update current EasyEngine from 2.x to 3.x old_ee_version="2.2.3" -new_ee_version="3.0.1" +new_ee_version="3.0.2" branch=$1 # Define echo function