Skip to content

Commit 05222eb

Browse files
author
gau1991
committed
Merge branch 'python'
2 parents 93e8aff + 8ec42f8 commit 05222eb

File tree

8 files changed

+38
-34
lines changed

8 files changed

+38
-34
lines changed

ee/cli/plugins/clean.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def default(self):
5050

5151
@expose(hide=True)
5252
def clean_memcache(self):
53-
"""This function Clears memcache"""
53+
"""This function Clears memcache """
5454
try:
5555
if(EEAptGet.is_installed(self, "memcached")):
5656
EEService.restart_service(self, "memcached")

ee/cli/plugins/secure.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from ee.core.shellexec import EEShellExec
44
from ee.core.variables import EEVariables
55
from ee.core.logging import Log
6+
from ee.core.git import EEGit
67
import string
78
import random
89
import sys
@@ -55,8 +56,8 @@ def secure_auth(self):
5556
if username == "":
5657
self.app.pargs.user_input = EEVariables.ee_user
5758
if not self.app.pargs.user_pass:
58-
password = input("Provide HTTP authentication "
59-
"password [{0}] :".format(passwd))
59+
password = getpass.getpass("Provide HTTP authentication "
60+
"password [{0}] :".format(passwd))
6061
self.app.pargs.user_pass = password
6162
if password == "":
6263
self.app.pargs.user_pass = passwd
@@ -71,12 +72,8 @@ def secure_auth(self):
7172
.format(username=self.app.pargs.user_input,
7273
password=self.app.pargs.user_pass),
7374
log=False)
74-
Log.info(self, "Successfully changed HTTP authentication"
75-
" username to : {username}"
76-
.format(username=self.app.pargs.user_input), log=False)
77-
Log.info(self, "Successfully changed HTTP authentication"
78-
" password to : {password}"
79-
.format(password=self.app.pargs.user_pass), log=False)
75+
EEGit.add(self, ["/etc/nginx"],
76+
msg="Adding changed secure auth into Git")
8077

8178
@expose(hide=True)
8279
def secure_port(self):
@@ -104,6 +101,9 @@ def secure_port(self):
104101
"{port} default_server ssl;/\" "
105102
"/etc/nginx/sites-available/22222"
106103
.format(port=self.app.pargs.user_input))
104+
EEGit.add(self, ["/etc/nginx"],
105+
msg="Adding changed secure port into Git")
106+
107107
Log.info(self, "Successfully port changed {port}"
108108
.format(port=self.app.pargs.user_input))
109109

@@ -127,6 +127,9 @@ def secure_ip(self):
127127
"\"/deny/i allow {whitelist_adre}\;\""
128128
" /etc/nginx/common/acl.conf"
129129
.format(whitelist_adre=ip_addr))
130+
EEGit.add(self, ["/etc/nginx"],
131+
msg="Adding changed secure ip into Git")
132+
130133
Log.info(self, "Successfully added IP address in acl.conf file")
131134

132135

ee/cli/plugins/site_functions.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,23 +112,23 @@ def setupdatabase(self, data):
112112
# create MySQL database
113113
Log.info(self, "Setting up database\t\t", end='')
114114
Log.debug(self, "Creating databse {0}".format(ee_db_name))
115-
EEMysql.execute(self, "create database {0}"
115+
EEMysql.execute(self, "create database `{0}`"
116116
.format(ee_db_name), errormsg="Cannot create database")
117117

118118
# Create MySQL User
119119
Log.debug(self, "Creating user {0}".format(ee_db_username))
120-
Log.debug(self, "create user {0}@{1} identified by ''"
120+
Log.debug(self, "create user `{0}`@`{1}` identified by ''"
121121
.format(ee_db_username, ee_mysql_grant_host))
122122
EEMysql.execute(self,
123-
"create user {0}@{1} identified by '{2}'"
123+
"create user `{0}`@`{1}` identified by '{2}'"
124124
.format(ee_db_username, ee_mysql_grant_host,
125125
ee_db_password),
126126
errormsg="Cannot setup database user", log=False)
127127

128128
# Grant permission
129129
Log.debug(self, "Setting up user privileges")
130130
EEMysql.execute(self,
131-
"grant all privileges on {0}.* to {1}@{2}"
131+
"grant all privileges on `{0}`.* to `{1}`@`{2}`"
132132
.format(ee_db_name, ee_db_username, ee_mysql_grant_host),
133133
errormsg="Cannot setup database user privileges")
134134
Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]")
@@ -423,9 +423,10 @@ def site_package_check(self, stype):
423423
Log.debug(self, "Setting packages variable for WP-CLI")
424424
if not EEShellExec.cmd_exec(self, "which wp"):
425425
packages = packages + [["https://github.com/wp-cli/wp-cli/"
426-
"releases/download/v0.17.1/"
427-
"wp-cli.phar", "/usr/bin/wp",
428-
"WP-CLI"]]
426+
"releases/download/v{0}/"
427+
"wp-cli-{0}.phar"
428+
.format(EEVariables.ee_wp_cli),
429+
"/usr/bin/wp", "WP-CLI"]]
429430
return(stack.install(apt_packages=apt_packages, packages=packages,
430431
disp_msg=False))
431432

ee/cli/plugins/stack.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def pre_pref(self, apt_packages):
9090
Log.debug(self, 'Adding key for {0}'
9191
.format(EEVariables.ee_mysql_repo))
9292
EERepo.add_key(self, '1C4CBDCDCD2EFD2A',
93-
keyserver="subkeys.pgp.net")
93+
keyserver="keyserver.ubuntu.com")
9494
chars = ''.join(random.sample(string.ascii_letters, 8))
9595
Log.debug(self, "Pre-seeding MySQL")
9696
EEShellExec.cmd_exec(self, "echo \"percona-server-server-5.6 "
@@ -155,8 +155,8 @@ def post_pref(self, apt_packages, packages):
155155
EEService.reload_service(self, 'postfix')
156156

157157
if set(EEVariables.ee_nginx).issubset(set(apt_packages)):
158-
if ((not os.path.isfile('/etc/nginx/conf.d/ee-nginx.conf')) and
159-
os.path.isfile('/etc/nginx/nginx.conf')):
158+
if ((not EEShellExec.cmd_exec(self, "grep -Hr EasyEngine "
159+
"/etc/nginx")) and os.path.isfile('/etc/nginx/nginx.conf')):
160160
nc = NginxConfig()
161161
Log.debug(self, 'Loading file /etc/nginx/nginx.conf ')
162162
nc.loadf('/etc/nginx/nginx.conf')

ee/core/apt_repo.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,10 @@ def add_key(self, keyids, keyserver=None):
7171
default keyserver is hkp://keys.gnupg.net
7272
user can provide other keyserver with keyserver="hkp://xyz"
7373
"""
74-
if keyserver is None:
75-
EEShellExec.cmd_exec(self, "gpg --keyserver {serv}"
76-
.format(serv=(keyserver or
77-
"hkp://keys.gnupg.net"))
78-
+ " --recv-keys {key}".format(key=keyids))
79-
EEShellExec.cmd_exec(self, "gpg -a --export --armor {0}"
80-
.format(keyids)
81-
+ " | apt-key add - ")
74+
EEShellExec.cmd_exec(self, "gpg --keyserver {serv}"
75+
.format(serv=(keyserver or
76+
"hkp://keys.gnupg.net"))
77+
+ " --recv-keys {key}".format(key=keyids))
78+
EEShellExec.cmd_exec(self, "gpg -a --export --armor {0}"
79+
.format(keyids)
80+
+ " | apt-key add - ")

ee/core/mysql.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ def execute(self, statement, errormsg='', log=True):
4848
.format(statement))
4949

5050
cur.execute(statement)
51+
cur.close()
52+
conn.close()
53+
5154
except Exception as e:
5255
cur.close()
5356
conn.close()
@@ -57,8 +60,6 @@ def execute(self, statement, errormsg='', log=True):
5760
else:
5861
Log.error(self, '{0}'.format(errormsg))
5962

60-
cur.close()
61-
conn.close()
6263

6364
# def __del__(self):
6465
# self.cur.close()

ee/core/variables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class EEVariables():
1212
"""Intialization of core variables"""
1313

1414
# EasyEngine version
15-
ee_version = "3.0.1"
15+
ee_version = "3.0.2"
1616

1717
# EasyEngine packages versions
1818
ee_wp_cli = "0.18.0"

install

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# to update current EasyEngine from 2.x to 3.x
66

77
old_ee_version="2.2.3"
8-
new_ee_version="3.0.1"
8+
new_ee_version="3.0.2"
99
branch=$1
1010

1111
# Define echo function
@@ -39,13 +39,13 @@ function install_dep()
3939
# Install Python3 on users system
4040
ee_lib_echo "Installing pre depedencies"
4141
if [ "$EE_LINUX_DISTRO" == "Ubuntu" ]; then
42-
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
42+
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
4343
elif [ "$EE_LINUX_DISTRO" == "Debian" ]; then
44-
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
44+
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
4545
fi
4646

4747
# Generating Locale
48-
locale-gen en &>> /dev/null
48+
locale-gen en &>> /dev/null
4949
}
5050

5151
function sync_db()

0 commit comments

Comments
 (0)