Skip to content

Commit 48d1f97

Browse files
author
gau1991
committed
Merge branch 'python'
2 parents 05222eb + ed3a833 commit 48d1f97

File tree

6 files changed

+103
-54
lines changed

6 files changed

+103
-54
lines changed

CONTRIBUTING.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Contribute to EasyEngine (ee)
2+
3+
This guide details how to use issues and pull requests to improve EasyEngine (ee).
4+
5+
## How to report issue:
6+
7+
Github issue-tracker is used **only** for report bugs and feature request.
8+
9+
Please attach the output of following command when open a new issue/bug
10+
```bash
11+
lsb_release -a
12+
ee -v
13+
ee info
14+
wp --allow-root --info
15+
```
16+
17+
### EasyEngine chat:
18+
Developer & contributor discussion: https://gitter.im/rtCamp/easyengine
19+
20+
21+
### EasyEngine support request:
22+
For support-request please use - http://community.rtcamp.com/c/easyengine
23+
24+
25+
### Pull Requests:
26+
When submitting your code please follow this coding standerds - http://docs.rtcamp.com/easyengine/dev/python/

config/bash_completion.d/ee_auto.rc

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ _ee_complete()
2929
# IF YOU HAD ANOTHER CONTROLLER, YOU'D HANDLE THAT HERE
3030
"debug")
3131
COMPREPLY=( $(compgen \
32-
-W "--start --nginx --php --fpm --mysql -i --interactive --stop " \
32+
-W "$(command find /etc/nginx/sites-enabled/ -type l -printf "%P " 2> /dev/null) --start --nginx --php --fpm --mysql -i --interactive --stop " \
3333
-- $cur) )
3434
;;
3535

@@ -66,11 +66,16 @@ _ee_complete()
6666
elif [ $COMP_CWORD -eq 3 ]; then
6767
case "$prev" in
6868
# HANDLE EVERYTHING AFTER THE THIRD LEVEL NAMESPACE
69-
"install" | "purge" | "remove" | "start" | "stop" | "reload")
69+
"install" | "purge" | "remove" )
7070
COMPREPLY=( $(compgen \
7171
-W "--web --admin --mail --nginx --php --mysql --postfix --wpcli --phpmyadmin --adminer --utils --memcache --dovecot" \
7272
-- $cur) )
7373
;;
74+
"start" | "stop" | "reload" | "restart" | "status")
75+
COMPREPLY=( $(compgen \
76+
-W "--nginx --php --mysql --postfix --memcache --dovecot" \
77+
-- $cur) )
78+
;;
7479

7580
"list")
7681
COMPREPLY=( $(compgen \
@@ -121,20 +126,25 @@ _ee_complete()
121126
COMPREPLY=( $(compgen \
122127
-W "--db --files --all" \
123128
-- $cur) )
124-
129+
;;
130+
*)
131+
;;
125132
esac
133+
126134
fi
127135

128136
case "$prev" in
129-
"--wpsubdir" | "--wpsubdomain")
137+
"--wp" | "--wpsubdir" | "--wpsubdomain")
130138
COMPREPLY=( $(compgen \
131139
-W "--w3tc --wpfc --wpsc" \
132140
-- $cur) )
133141
;;
134142

135143
"--web" | "--admin" | "--mail" | "--nginx" | "--php" | "--mysql" | "--postfix" | "--wpcli" | "--phpmyadmin" | "--adminer" | "--utils" | "--memcache" | "--dovecot")
136-
if [[ ${COMP_WORDS[1]} == "stack" ]]; then
144+
if [[ ${COMP_WORDS[2]} == "install" || ${COMP_WORDS[2]} == "purge" || ${COMP_WORDS[2]} == "remove" ]]; then
137145
retlist="--web --admin --mail --nginx --php --mysql --postfix --wpcli --phpmyadmin --adminer --utils --memcache --dovecot"
146+
elif [[ ${COMP_WORDS[2]} == "start" || ${COMP_WORDS[2]} == "reload" || ${COMP_WORDS[2]} == "restart" || ${COMP_WORDS[2]} == "stop" ]]; then
147+
retlist="--nginx --php --mysql --postfix --memcache --dovecot"
138148
elif [[ ${COMP_WORDS[1]} == "debug" ]]; then
139149
retlist="--start --nginx --php --fpm --mysql -i --interactive --stop"
140150
fi
@@ -144,14 +154,27 @@ _ee_complete()
144154
-- $cur) )
145155
;;
146156

147-
"--db" | "--files" | "--all")
157+
"--db" | "--files" )
148158
retlist="--db --files --all"
149159
ret="${retlist[@]/$prev}"
150160
COMPREPLY=( $(compgen \
151161
-W "$(echo $ret)" \
152162
-- $cur) )
153163
;;
154164

165+
"--all")
166+
if [ ${COMP_WORDS[1]} == "clean" ]; then
167+
retlist="--memcache --opcache --fastcgi"
168+
else
169+
retlist="--db --files"
170+
171+
fi
172+
ret="${retlist[@]/$prev}"
173+
COMPREPLY=( $(compgen \
174+
-W "$(echo $ret)" \
175+
-- $cur) )
176+
;;
177+
155178
"--memcache" | "--opcache" | "--fastcgi" | "--all")
156179
retlist="--memcache --opcache --fastcgi --all"
157180
ret="${retlist[@]/$prev}"

ee/cli/plugins/stack_services.py

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,22 @@ def start(self):
2424
if self.app.pargs.nginx:
2525
Log.debug(self, "nginx service start")
2626
services = services + ['nginx']
27-
elif self.app.pargs.php:
27+
if self.app.pargs.php:
2828
Log.debug(self, "php5-fpm service start")
2929
services = services + ['php5-fpm']
30-
elif self.app.pargs.mysql:
30+
if self.app.pargs.mysql:
3131
Log.debug(self, "mysql service start")
3232
services = services + ['mysql']
33-
elif self.app.pargs.postfix:
33+
if self.app.pargs.postfix:
3434
Log.debug(self, "postfix service start")
3535
services = services + ['postfix']
36-
elif self.app.pargs.memcache:
36+
if self.app.pargs.memcache:
3737
Log.debug(self, "memcached service start")
3838
services = services + ['memcached']
39-
elif self.app.pargs.dovecot:
39+
if self.app.pargs.dovecot:
4040
Log.debug(self, "dovecot service start")
4141
services = services + ['dovecot']
42-
else:
42+
if not services:
4343
Log.debug(self, "nginx,php5-fpm,mysql,postfix services start")
4444
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix']
4545
for service in services:
@@ -52,22 +52,22 @@ def stop(self):
5252
if self.app.pargs.nginx:
5353
Log.debug(self, "nginx service stop")
5454
services = services + ['nginx']
55-
elif self.app.pargs.php:
55+
if self.app.pargs.php:
5656
Log.debug(self, "php5-fpm service stop")
5757
services = services + ['php5-fpm']
58-
elif self.app.pargs.mysql:
58+
if self.app.pargs.mysql:
5959
Log.debug(self, "mysql service stop")
6060
services = services + ['mysql']
61-
elif self.app.pargs.postfix:
61+
if self.app.pargs.postfix:
6262
Log.debug(self, "postfix service stop")
6363
services = services + ['postfix']
64-
elif self.app.pargs.memcache:
64+
if self.app.pargs.memcache:
6565
Log.debug(self, "memcached service stop")
6666
services = services + ['memcached']
67-
elif self.app.pargs.dovecot:
67+
if self.app.pargs.dovecot:
6868
Log.debug(self, "dovecot service stop")
6969
services = services + ['dovecot']
70-
else:
70+
if not services:
7171
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix']
7272
Log.debug(self, "nginx,php5-fpm,mysql,postfix services stop")
7373
for service in services:
@@ -80,22 +80,22 @@ def restart(self):
8080
if self.app.pargs.nginx:
8181
Log.debug(self, "nginx service restart")
8282
services = services + ['nginx']
83-
elif self.app.pargs.php:
83+
if self.app.pargs.php:
8484
Log.debug(self, "php5-fpm service restart")
8585
services = services + ['php5-fpm']
86-
elif self.app.pargs.mysql:
86+
if self.app.pargs.mysql:
8787
Log.debug(self, "mysql service restart")
8888
services = services + ['mysql']
89-
elif self.app.pargs.postfix:
89+
if self.app.pargs.postfix:
9090
Log.debug(self, "postfix service restart")
9191
services = services + ['postfix']
92-
elif self.app.pargs.memcache:
92+
if self.app.pargs.memcache:
9393
Log.debug(self, "memcached service restart")
9494
services = services + ['memcached']
95-
elif self.app.pargs.dovecot:
95+
if self.app.pargs.dovecot:
9696
Log.debug(self, "dovecot service restart")
9797
services = services + ['dovecot']
98-
else:
98+
if not services:
9999
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix']
100100
for service in services:
101101
Log.debug(self, "nginx,php5-fpm,mysql,postfix services restart")
@@ -108,22 +108,22 @@ def status(self):
108108
if self.app.pargs.nginx:
109109
Log.debug(self, "nginx service status")
110110
services = services + ['nginx']
111-
elif self.app.pargs.php:
111+
if self.app.pargs.php:
112112
Log.debug(self, "php5-fpm service status")
113113
services = services + ['php5-fpm']
114-
elif self.app.pargs.mysql:
114+
if self.app.pargs.mysql:
115115
Log.debug(self, "mysql service status")
116116
services = services + ['mysql']
117-
elif self.app.pargs.postfix:
117+
if self.app.pargs.postfix:
118118
services = services + ['postfix']
119119
Log.debug(self, "postfix service status")
120-
elif self.app.pargs.memcache:
120+
if self.app.pargs.memcache:
121121
Log.debug(self, "memcached service status")
122122
services = services + ['memcached']
123-
elif self.app.pargs.dovecot:
123+
if self.app.pargs.dovecot:
124124
Log.debug(self, "dovecot service status")
125125
services = services + ['dovecot']
126-
else:
126+
if not services:
127127
Log.debug(self, "nginx,php5-fpm,mysql,postfix services status")
128128
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix']
129129
for service in services:
@@ -137,22 +137,22 @@ def reload(self):
137137
if self.app.pargs.nginx:
138138
Log.debug(self, "nginx service reload")
139139
services = services + ['nginx']
140-
elif self.app.pargs.php:
140+
if self.app.pargs.php:
141141
Log.debug(self, "php5-fpm service reload")
142142
services = services + ['php5-fpm']
143-
elif self.app.pargs.mysql:
143+
if self.app.pargs.mysql:
144144
Log.debug(self, "mysql service reload")
145145
services = services + ['mysql']
146-
elif self.app.pargs.postfix:
146+
if self.app.pargs.postfix:
147147
Log.debug(self, "postfix service reload")
148148
services = services + ['postfix']
149-
elif self.app.pargs.memcache:
149+
if self.app.pargs.memcache:
150150
Log.debug(self, "memcached service reload")
151151
services = services + ['memcached']
152-
elif self.app.pargs.dovecot:
152+
if self.app.pargs.dovecot:
153153
Log.debug(self, "dovecot service reload")
154154
services = services + ['dovecot']
155-
else:
155+
if not services:
156156
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix']
157157
for service in services:
158158
Log.debug(self, "nginx,php5-fpm,mysql,postfix services reload")

ee/core/fileutils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def copyfile(self, src, dest):
7474
except IOError as e:
7575
Log.debug(self, "{e}".format(e.strerror))
7676
Log.error(self, "Unable to copy file from {0} to {1}"
77-
.fromat(src, dest))
77+
.format(src, dest))
7878

7979
def searchreplace(self, fnm, sstr, rstr):
8080
"""

ee/core/mysql.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,23 @@ def execute(self, statement, errormsg='', log=True):
4242
Log.error(self, 'Unable to connect to database: {0}'
4343
.format(e))
4444

45-
try:
46-
if log:
47-
Log.debug(self, "Executing MySQL statement: {0}"
48-
.format(statement))
45+
try:
46+
if log:
47+
Log.debug(self, "Executing MySQL statement: {0}"
48+
.format(statement))
49+
50+
cur.execute(statement)
51+
cur.close()
52+
conn.close()
4953

50-
cur.execute(statement)
51-
cur.close()
52-
conn.close()
53-
54-
except Exception as e:
55-
cur.close()
56-
conn.close()
57-
Log.debug(self, "{0}".format(e))
58-
if not errormsg:
59-
Log.error(self, 'Unable to execute statement')
60-
else:
61-
Log.error(self, '{0}'.format(errormsg))
54+
except Exception as e:
55+
cur.close()
56+
conn.close()
57+
Log.debug(self, "{0}".format(e))
58+
if not errormsg:
59+
Log.error(self, 'Unable to execute statement')
60+
else:
61+
Log.error(self, '{0}'.format(errormsg))
6262

6363

6464
# def __del__(self):

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',
57+
version='3.0.2',
5858
description=long_description,
5959
long_description=long_description,
6060
classifiers=[],

0 commit comments

Comments
 (0)