Skip to content

Commit c37844d

Browse files
committed
Merge branch 'python' of github.com:rtCamp/easyengine into python
2 parents 501dcb5 + fb925d8 commit c37844d

File tree

7 files changed

+74
-34
lines changed

7 files changed

+74
-34
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ before_script:
2121
- sudo apt-get update
2222

2323
script:
24+
- unset LANG
2425
- sudo echo -e "[user]\n\tname = abc\n\temail = [email protected]" > ~/.gitconfig
2526
- sudo echo "Travis Banch = $TRAVIS_BRANCH"
2627
- sudo apt-get install -y --force-yes git python3-setuptools python3-dev python3-apt

ee/cli/main.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313
from cement.core import foundation
1414
from cement.utils.misc import init_defaults
1515
from cement.core.exc import FrameworkError, CaughtSignal
16+
from cement.utils import fs
17+
from cement.ext.ext_mustache import MustacheOutputHandler
1618
from ee.core import exc
1719

20+
1821
# Application default. Should update config/ee.conf to reflect any
1922
# changes, or additions here.
2023
defaults = init_defaults('ee')
@@ -29,6 +32,23 @@
2932
defaults['ee']['template_dir'] = '/var/lib/ee/templates'
3033

3134

35+
# Based on https://github.com/datafolklabs/cement/issues/295
36+
# To avoid encoding releated error,we defined our custom output handler
37+
# I hope we will remove this when we upgarde to Cement 2.6 (Not released yet)
38+
class EEOutputHandler(MustacheOutputHandler):
39+
class Meta:
40+
label = 'ee_output_handler'
41+
42+
def _load_template_from_file(self, path):
43+
for templ_dir in self.app._meta.template_dirs:
44+
full_path = fs.abspath(os.path.join(templ_dir, path))
45+
if os.path.exists(full_path):
46+
self.app.log.debug('loading template file %s' % full_path)
47+
return open(full_path, encoding='utf-8', mode='r').read()
48+
else:
49+
continue
50+
51+
3252
class EEApp(foundation.CementApp):
3353
class Meta:
3454
label = 'ee'
@@ -50,7 +70,7 @@ class Meta:
5070
extensions = ['mustache']
5171

5272
# default output handler
53-
output_handler = 'mustache'
73+
output_handler = EEOutputHandler
5474

5575
debug = TOGGLE_DEBUG
5676

ee/cli/plugins/debug.py

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def debug_nginx(self):
103103
self.trigger_nginx = True
104104

105105
else:
106-
Log.info(self, "Nginx debug for site allready enabled")
106+
Log.info(self, "Nginx debug for site already enabled")
107107

108108
self.msg = self.msg + ['{0}{1}/logs/error.log'
109109
.format(EEVariables.ee_webroot,
@@ -129,7 +129,7 @@ def debug_nginx(self):
129129

130130
else:
131131

132-
Log.info(self, "Nginx debug for site allready disabled")
132+
Log.info(self, "Nginx debug for site already disabled")
133133
else:
134134
Log.info(self, "{0} domain not valid"
135135
.format(self.app.pargs.site_name))
@@ -154,7 +154,7 @@ def debug_php(self):
154154
self.trigger_php = True
155155
self.trigger_nginx = True
156156
else:
157-
Log.info(self, "PHP debug is allready enabled")
157+
Log.info(self, "PHP debug is already enabled")
158158

159159
self.msg = self.msg + ['/var/log/php5/slow.log']
160160

@@ -174,7 +174,7 @@ def debug_php(self):
174174
self.trigger_php = True
175175
self.trigger_nginx = True
176176
else:
177-
Log.info(self, "PHP debug is allready disabled")
177+
Log.info(self, "PHP debug is already disabled")
178178

179179
@expose(hide=True)
180180
def debug_fpm(self):
@@ -249,7 +249,7 @@ def debug_mysql(self):
249249
"n#EasyEngine end MySQL slow log\\\";"
250250
" }} | crontab -\"".format(cron_time))
251251
else:
252-
Log.info(self, "MySQL slow log is allready enabled")
252+
Log.info(self, "MySQL slow log is already enabled")
253253

254254
self.msg = self.msg + ['/var/log/mysql/mysql-slow.log']
255255

@@ -378,7 +378,7 @@ def debug_rewrite(self):
378378
.format(config_path))
379379
self.trigger_nginx = True
380380
else:
381-
Log.info(self, "Nginx rewrite logs for {0} allready setup"
381+
Log.info(self, "Nginx rewrite logs for {0} already setup"
382382
.format(self.app.pargs.site_name))
383383

384384
if ('{0}{1}/logs/error.log'.format(EEVariables.ee_webroot,
@@ -400,7 +400,7 @@ def debug_rewrite(self):
400400
.format(config_path))
401401
self.trigger_nginx = True
402402
else:
403-
Log.info(self, "Nginx rewrite logs for {0} allready "
403+
Log.info(self, "Nginx rewrite logs for {0} already "
404404
" disabled".format(self.app.pargs.site_name))
405405

406406
@expose(hide=True)
@@ -414,7 +414,12 @@ def signal_handler(self, signal, frame):
414414
if self.app.pargs.fpm:
415415
self.debug_fpm()
416416
if self.app.pargs.mysql:
417-
self.debug_mysql()
417+
# MySQL debug will not work for remote MySQL
418+
if EEVariables.ee_mysql_host is "localhost":
419+
self.debug_mysql()
420+
else:
421+
Log.warn(self, "Remote MySQL found, EasyEngine will not "
422+
"enable remote debug")
418423
if self.app.pargs.wp:
419424
self.debug_wp()
420425
if self.app.pargs.rewrite:
@@ -445,19 +450,19 @@ def default(self):
445450
and (not self.app.pargs.fpm) and (not self.app.pargs.mysql)
446451
and (not self.app.pargs.wp) and (not self.app.pargs.rewrite)
447452
and (not self.app.pargs.site_name)):
448-
self.debug_nginx()
449-
self.debug_php()
450-
self.debug_fpm()
451-
self.debug_mysql()
452-
self.debug_rewrite()
453+
self.app.pargs.nginx = True
454+
self.app.pargs.php = True
455+
self.app.pargs.fpm = True
456+
self.app.pargs.mysql = True
457+
self.app.pargs.rewrite = True
453458

454459
if ((not self.app.pargs.nginx) and (not self.app.pargs.php)
455460
and (not self.app.pargs.fpm) and (not self.app.pargs.mysql)
456461
and (not self.app.pargs.wp) and (not self.app.pargs.rewrite)
457462
and self.app.pargs.site_name):
458-
self.debug_nginx()
459-
self.debug_wp()
460-
self.debug_rewrite()
463+
self.app.pargs.nginx = True
464+
self.app.pargs.wp = True
465+
self.app.pargs.rewrite = True
461466

462467
if self.app.pargs.nginx:
463468
self.debug_nginx()
@@ -466,7 +471,12 @@ def default(self):
466471
if self.app.pargs.fpm:
467472
self.debug_fpm()
468473
if self.app.pargs.mysql:
469-
self.debug_mysql()
474+
# MySQL debug will not work for remote MySQL
475+
if EEVariables.ee_mysql_host is "localhost":
476+
self.debug_mysql()
477+
else:
478+
Log.warn(self, "Remote MySQL found, EasyEngine will not "
479+
"enable remote debug")
470480
if self.app.pargs.wp:
471481
self.debug_wp()
472482
if self.app.pargs.rewrite:

ee/cli/plugins/stack.py

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -888,10 +888,12 @@ def post_pref(self, apt_packages, packages):
888888
Log.debug(self, "Creating vimbadmin database if not exist")
889889
EEMysql.execute(self, "create database if not exists"
890890
" vimbadmin")
891-
Log.debug(self, "Granting all privileges on vimbadmin.* to "
892-
"vimbadmin@root IDENTIFIED BY password ")
893-
EEMysql.execute(self, "grant all privileges on vimbadmin.* to"
894-
" vimbadmin@{0} IDENTIFIED BY"
891+
Log.debug(self, " grant all privileges on `vimbadmin`.* to"
892+
" `vimbadmin`@`{0}` IDENTIFIED BY"
893+
" ' '".format(self.app.config.get('mysql',
894+
'grant-host')))
895+
EEMysql.execute(self, "grant all privileges on `vimbadmin`.* "
896+
" to `vimbadmin`@`{0}` IDENTIFIED BY"
895897
" '{1}'".format(self.app.config.get('mysql',
896898
'grant-host'), vm_passwd),
897899
errormsg="Cannot grant "
@@ -1022,10 +1024,14 @@ def post_pref(self, apt_packages, packages):
10221024
Log.debug(self, "Creating Database roundcubemail")
10231025
EEMysql.execute(self, "create database if not exists "
10241026
" roundcubemail")
1025-
Log.debug(self, "Grant all privileges on roundcubemail")
1027+
Log.debug(self, "grant all privileges"
1028+
" on `roundcubemail`.* to "
1029+
" `roundcube`@`{0}` IDENTIFIED BY "
1030+
"' '".format(self.app.config.get(
1031+
'mysql', 'grant-host')))
10261032
EEMysql.execute(self, "grant all privileges"
1027-
" on roundcubemail.* to "
1028-
" roundcube@{0} IDENTIFIED BY "
1033+
" on `roundcubemail`.* to "
1034+
" `roundcube`@`{0}` IDENTIFIED BY "
10291035
"'{1}'".format(self.app.config.get(
10301036
'mysql', 'grant-host'),
10311037
rc_passwd))
@@ -1123,8 +1129,9 @@ def install(self, packages=[], apt_packages=[], disp_msg=True):
11231129
(not self.app.pargs.postfix) and (not self.app.pargs.wpcli) and
11241130
(not self.app.pargs.phpmyadmin) and
11251131
(not self.app.pargs.adminer) and (not self.app.pargs.utils) and
1126-
(not self.app.pargs.mailscanner)):
1132+
(not self.app.pargs.mailscanner) and (not self.app.pargs.all)):
11271133
self.app.pargs.web = True
1134+
self.app.pargs.admin = True
11281135

11291136
if self.app.pargs.all:
11301137
self.app.pargs.web = True
@@ -1245,7 +1252,7 @@ def install(self, packages=[], apt_packages=[], disp_msg=True):
12451252
else:
12461253
Log.error(self, "Failed to find installed Dovecot")
12471254
else:
1248-
Log.error(self, "Mail scanner allready installed")
1255+
Log.error(self, "Mail scanner already installed")
12491256

12501257
if self.app.pargs.utils:
12511258
Log.debug(self, "Setting packages variable for utils")
@@ -1330,8 +1337,9 @@ def remove(self):
13301337
(not self.app.pargs.postfix) and (not self.app.pargs.wpcli) and
13311338
(not self.app.pargs.phpmyadmin) and
13321339
(not self.app.pargs.adminer) and (not self.app.pargs.utils) and
1333-
(not self.app.pargs.mailscanner)):
1340+
(not self.app.pargs.mailscanner) and (not self.app.pargs.all)):
13341341
self.app.pargs.web = True
1342+
self.app.pargs.admin = True
13351343

13361344
if self.app.pargs.all:
13371345
self.app.pargs.web = True
@@ -1424,8 +1432,9 @@ def purge(self):
14241432
(not self.app.pargs.postfix) and (not self.app.pargs.wpcli) and
14251433
(not self.app.pargs.phpmyadmin) and
14261434
(not self.app.pargs.adminer) and (not self.app.pargs.utils) and
1427-
(not self.app.pargs.mailscanner)):
1435+
(not self.app.pargs.mailscanner) and (not self.app.pargs.all)):
14281436
self.app.pargs.web = True
1437+
self.app.pargs.admin = True
14291438

14301439
if self.app.pargs.all:
14311440
self.app.pargs.web = True

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.2"
15+
ee_version = "3.0.3"
1616

1717
# EasyEngine packages versions
1818
ee_wp_cli = "0.18.0"

install

Lines changed: 3 additions & 3 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.2"
8+
new_ee_version="3.0.3"
99
branch=$1
1010

1111
# Define echo function
@@ -175,7 +175,7 @@ function update_to_ee3()
175175
sed -i "s/X-Powered-By.*/X-Powered-By \"EasyEngine $new_ee_version\";/" /etc/nginx/nginx.conf &>> /dev/null
176176
fi
177177

178-
grant_host=$(grep grant-host /etc/easyengine/ee.conf | awk '{ print $3 }')
178+
grant_host=$(grep grant-host /etc/easyengine/ee.conf | awk '{ print $3 }' | head -1 )
179179
db_name=$(grep db-name /etc/easyengine/ee.conf | awk '{ print $3 }')
180180
db_user=$(grep db-name /etc/easyengine/ee.conf | awk '{ print $3 }')
181181
wp_prefix=$(grep prefix /etc/easyengine/ee.conf | awk '{ print $3 }')
@@ -318,7 +318,7 @@ else
318318
service nginx reload &>> /dev/null
319319
fi
320320
else
321-
ee_lib_echo_fail "You allready have EasyEngine $new_ee_version" | tee -ai $EE_INSTALL_LOG
321+
ee_lib_echo_fail "You already have EasyEngine $new_ee_version" | tee -ai $EE_INSTALL_LOG
322322
exit 1
323323
fi
324324
fi

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
os.system("git config --global user.email {0}".format(ee_email))
5555

5656
setup(name='ee',
57-
version='3.0.2',
57+
version='3.0.3',
5858
description=long_description,
5959
long_description=long_description,
6060
classifiers=[],

0 commit comments

Comments
 (0)