Skip to content

Commit 9c615dc

Browse files
author
gau1991
committed
Merge branch 'python' of github.com:rtCamp/easyengine into python
2 parents 2c1226a + 3f28027 commit 9c615dc

File tree

5 files changed

+22
-10
lines changed

5 files changed

+22
-10
lines changed

ee/cli/plugins/secure.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,23 @@ def secure_auth(self):
6060
self.app.pargs.user_pass = password
6161
if password == "":
6262
self.app.pargs.user_pass = passwd
63+
Log.debug(self, "printf username:"
64+
"$(openssl passwd -crypt "
65+
"password 2> /dev/null)\n\""
66+
"> /etc/nginx/htpasswd-ee 2>/dev/null")
6367
EEShellExec.cmd_exec(self, "printf \"{username}:"
6468
"$(openssl passwd -crypt "
6569
"{password} 2> /dev/null)\n\""
6670
"> /etc/nginx/htpasswd-ee 2>/dev/null"
6771
.format(username=self.app.pargs.user_input,
68-
password=self.app.pargs.user_pass))
72+
password=self.app.pargs.user_pass),
73+
log=False)
6974
Log.info(self, "Successfully changed HTTP authentication"
7075
" username to : {username}"
71-
.format(username=self.app.pargs.user_input))
76+
.format(username=self.app.pargs.user_input), log=False)
7277
Log.info(self, "Successfully changed HTTP authentication"
7378
" password to : {password}"
74-
.format(password=self.app.pargs.user_pass))
79+
.format(password=self.app.pargs.user_pass), log=False)
7580

7681
@expose(hide=True)
7782
def secure_port(self):

ee/cli/plugins/site.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,9 +475,9 @@ def default(self):
475475

476476
if data['wp']:
477477
Log.info(self, Log.ENDC + "WordPress admin user :"
478-
" {0}".format(ee_wp_creds['wp_user']))
478+
" {0}".format(ee_wp_creds['wp_user']), log=False)
479479
Log.info(self, Log.ENDC + "WordPress admin user password : {0}"
480-
.format(ee_wp_creds['wp_pass']))
480+
.format(ee_wp_creds['wp_pass']), log=False)
481481

482482
display_cache_settings(self, data)
483483
addNewSite(self, ee_www_domain, stype, cache, ee_site_webroot)

ee/cli/plugins/site_functions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,13 @@ def setupdatabase(self, data):
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 ''"
121+
.format(ee_db_username, ee_mysql_grant_host))
120122
EEMysql.execute(self,
121123
"create user {0}@{1} identified by '{2}'"
122124
.format(ee_db_username, ee_mysql_grant_host,
123125
ee_db_password),
124-
errormsg="Cannot setup database user")
126+
errormsg="Cannot setup database user", log=False)
125127

126128
# Grant permission
127129
Log.debug(self, "Setting up user privileges")

ee/core/logging.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,14 @@ def error(self, msg):
2323
self.app.log.error(Log.FAIL + msg + Log.ENDC)
2424
self.app.close(1)
2525

26-
def info(self, msg, end='\n'):
26+
def info(self, msg, end='\n', log=True):
2727
"""
2828
Logs info messages into log file
2929
"""
30+
3031
print(Log.OKBLUE + msg + Log.ENDC, end=end)
31-
self.app.log.info(Log.OKBLUE + msg + Log.ENDC)
32+
if log:
33+
self.app.log.info(Log.OKBLUE + msg + Log.ENDC)
3234

3335
def warn(self, msg):
3436
"""

ee/core/mysql.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class EEMysql():
1010
"""Method for MySQL connection"""
1111

12-
def execute(self, statement, errormsg=''):
12+
def execute(self, statement, errormsg='', log=True):
1313
"""Get login details from ~/.my.cnf & Execute MySQL query"""
1414
config = configparser.RawConfigParser()
1515
cnfpath = expanduser("~")+"/.my.cnf"
@@ -43,7 +43,10 @@ def execute(self, statement, errormsg=''):
4343
.format(e))
4444

4545
try:
46-
Log.debug(self, "Executing MySQL statement: {0}".format(statement))
46+
if log:
47+
Log.debug(self, "Executing MySQL statement: {0}"
48+
.format(statement))
49+
4750
cur.execute(statement)
4851
except Exception as e:
4952
cur.close()

0 commit comments

Comments
 (0)