Browse Source

Merge branch 'python'

bugfixes
gau1991 10 years ago
parent
commit
48d1f974d6
  1. 26
      CONTRIBUTING.md
  2. 35
      config/bash_completion.d/ee_auto.rc
  3. 60
      ee/cli/plugins/stack_services.py
  4. 2
      ee/core/fileutils.py
  5. 32
      ee/core/mysql.py
  6. 2
      setup.py

26
CONTRIBUTING.md

@ -0,0 +1,26 @@
# Contribute to EasyEngine (ee)
This guide details how to use issues and pull requests to improve EasyEngine (ee).
## How to report issue:
Github issue-tracker is used **only** for report bugs and feature request.
Please attach the output of following command when open a new issue/bug
```bash
lsb_release -a
ee -v
ee info
wp --allow-root --info
```
### EasyEngine chat:
Developer & contributor discussion: https://gitter.im/rtCamp/easyengine
### EasyEngine support request:
For support-request please use - http://community.rtcamp.com/c/easyengine
### Pull Requests:
When submitting your code please follow this coding standerds - http://docs.rtcamp.com/easyengine/dev/python/

35
config/bash_completion.d/ee_auto.rc

@ -29,7 +29,7 @@ _ee_complete()
# IF YOU HAD ANOTHER CONTROLLER, YOU'D HANDLE THAT HERE
"debug")
COMPREPLY=( $(compgen \
-W "--start --nginx --php --fpm --mysql -i --interactive --stop " \
-W "$(command find /etc/nginx/sites-enabled/ -type l -printf "%P " 2> /dev/null) --start --nginx --php --fpm --mysql -i --interactive --stop " \
-- $cur) )
;;
@ -66,11 +66,16 @@ _ee_complete()
elif [ $COMP_CWORD -eq 3 ]; then
case "$prev" in
# HANDLE EVERYTHING AFTER THE THIRD LEVEL NAMESPACE
"install" | "purge" | "remove" | "start" | "stop" | "reload")
"install" | "purge" | "remove" )
COMPREPLY=( $(compgen \
-W "--web --admin --mail --nginx --php --mysql --postfix --wpcli --phpmyadmin --adminer --utils --memcache --dovecot" \
-- $cur) )
;;
"start" | "stop" | "reload" | "restart" | "status")
COMPREPLY=( $(compgen \
-W "--nginx --php --mysql --postfix --memcache --dovecot" \
-- $cur) )
;;
"list")
COMPREPLY=( $(compgen \
@ -121,20 +126,25 @@ _ee_complete()
COMPREPLY=( $(compgen \
-W "--db --files --all" \
-- $cur) )
;;
*)
;;
esac
fi
case "$prev" in
"--wpsubdir" | "--wpsubdomain")
"--wp" | "--wpsubdir" | "--wpsubdomain")
COMPREPLY=( $(compgen \
-W "--w3tc --wpfc --wpsc" \
-- $cur) )
;;
"--web" | "--admin" | "--mail" | "--nginx" | "--php" | "--mysql" | "--postfix" | "--wpcli" | "--phpmyadmin" | "--adminer" | "--utils" | "--memcache" | "--dovecot")
if [[ ${COMP_WORDS[1]} == "stack" ]]; then
if [[ ${COMP_WORDS[2]} == "install" || ${COMP_WORDS[2]} == "purge" || ${COMP_WORDS[2]} == "remove" ]]; then
retlist="--web --admin --mail --nginx --php --mysql --postfix --wpcli --phpmyadmin --adminer --utils --memcache --dovecot"
elif [[ ${COMP_WORDS[2]} == "start" || ${COMP_WORDS[2]} == "reload" || ${COMP_WORDS[2]} == "restart" || ${COMP_WORDS[2]} == "stop" ]]; then
retlist="--nginx --php --mysql --postfix --memcache --dovecot"
elif [[ ${COMP_WORDS[1]} == "debug" ]]; then
retlist="--start --nginx --php --fpm --mysql -i --interactive --stop"
fi
@ -144,7 +154,7 @@ _ee_complete()
-- $cur) )
;;
"--db" | "--files" | "--all")
"--db" | "--files" )
retlist="--db --files --all"
ret="${retlist[@]/$prev}"
COMPREPLY=( $(compgen \
@ -152,6 +162,19 @@ _ee_complete()
-- $cur) )
;;
"--all")
if [ ${COMP_WORDS[1]} == "clean" ]; then
retlist="--memcache --opcache --fastcgi"
else
retlist="--db --files"
fi
ret="${retlist[@]/$prev}"
COMPREPLY=( $(compgen \
-W "$(echo $ret)" \
-- $cur) )
;;
"--memcache" | "--opcache" | "--fastcgi" | "--all")
retlist="--memcache --opcache --fastcgi --all"
ret="${retlist[@]/$prev}"

60
ee/cli/plugins/stack_services.py

@ -24,22 +24,22 @@ class EEStackStatusController(CementBaseController):
if self.app.pargs.nginx:
Log.debug(self, "nginx service start")
services = services + ['nginx']
elif self.app.pargs.php:
if self.app.pargs.php:
Log.debug(self, "php5-fpm service start")
services = services + ['php5-fpm']
elif self.app.pargs.mysql:
if self.app.pargs.mysql:
Log.debug(self, "mysql service start")
services = services + ['mysql']
elif self.app.pargs.postfix:
if self.app.pargs.postfix:
Log.debug(self, "postfix service start")
services = services + ['postfix']
elif self.app.pargs.memcache:
if self.app.pargs.memcache:
Log.debug(self, "memcached service start")
services = services + ['memcached']
elif self.app.pargs.dovecot:
if self.app.pargs.dovecot:
Log.debug(self, "dovecot service start")
services = services + ['dovecot']
else:
if not services:
Log.debug(self, "nginx,php5-fpm,mysql,postfix services start")
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix']
for service in services:
@ -52,22 +52,22 @@ class EEStackStatusController(CementBaseController):
if self.app.pargs.nginx:
Log.debug(self, "nginx service stop")
services = services + ['nginx']
elif self.app.pargs.php:
if self.app.pargs.php:
Log.debug(self, "php5-fpm service stop")
services = services + ['php5-fpm']
elif self.app.pargs.mysql:
if self.app.pargs.mysql:
Log.debug(self, "mysql service stop")
services = services + ['mysql']
elif self.app.pargs.postfix:
if self.app.pargs.postfix:
Log.debug(self, "postfix service stop")
services = services + ['postfix']
elif self.app.pargs.memcache:
if self.app.pargs.memcache:
Log.debug(self, "memcached service stop")
services = services + ['memcached']
elif self.app.pargs.dovecot:
if self.app.pargs.dovecot:
Log.debug(self, "dovecot service stop")
services = services + ['dovecot']
else:
if not services:
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix']
Log.debug(self, "nginx,php5-fpm,mysql,postfix services stop")
for service in services:
@ -80,22 +80,22 @@ class EEStackStatusController(CementBaseController):
if self.app.pargs.nginx:
Log.debug(self, "nginx service restart")
services = services + ['nginx']
elif self.app.pargs.php:
if self.app.pargs.php:
Log.debug(self, "php5-fpm service restart")
services = services + ['php5-fpm']
elif self.app.pargs.mysql:
if self.app.pargs.mysql:
Log.debug(self, "mysql service restart")
services = services + ['mysql']
elif self.app.pargs.postfix:
if self.app.pargs.postfix:
Log.debug(self, "postfix service restart")
services = services + ['postfix']
elif self.app.pargs.memcache:
if self.app.pargs.memcache:
Log.debug(self, "memcached service restart")
services = services + ['memcached']
elif self.app.pargs.dovecot:
if self.app.pargs.dovecot:
Log.debug(self, "dovecot service restart")
services = services + ['dovecot']
else:
if not services:
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix']
for service in services:
Log.debug(self, "nginx,php5-fpm,mysql,postfix services restart")
@ -108,22 +108,22 @@ class EEStackStatusController(CementBaseController):
if self.app.pargs.nginx:
Log.debug(self, "nginx service status")
services = services + ['nginx']
elif self.app.pargs.php:
if self.app.pargs.php:
Log.debug(self, "php5-fpm service status")
services = services + ['php5-fpm']
elif self.app.pargs.mysql:
if self.app.pargs.mysql:
Log.debug(self, "mysql service status")
services = services + ['mysql']
elif self.app.pargs.postfix:
if self.app.pargs.postfix:
services = services + ['postfix']
Log.debug(self, "postfix service status")
elif self.app.pargs.memcache:
if self.app.pargs.memcache:
Log.debug(self, "memcached service status")
services = services + ['memcached']
elif self.app.pargs.dovecot:
if self.app.pargs.dovecot:
Log.debug(self, "dovecot service status")
services = services + ['dovecot']
else:
if not services:
Log.debug(self, "nginx,php5-fpm,mysql,postfix services status")
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix']
for service in services:
@ -137,22 +137,22 @@ class EEStackStatusController(CementBaseController):
if self.app.pargs.nginx:
Log.debug(self, "nginx service reload")
services = services + ['nginx']
elif self.app.pargs.php:
if self.app.pargs.php:
Log.debug(self, "php5-fpm service reload")
services = services + ['php5-fpm']
elif self.app.pargs.mysql:
if self.app.pargs.mysql:
Log.debug(self, "mysql service reload")
services = services + ['mysql']
elif self.app.pargs.postfix:
if self.app.pargs.postfix:
Log.debug(self, "postfix service reload")
services = services + ['postfix']
elif self.app.pargs.memcache:
if self.app.pargs.memcache:
Log.debug(self, "memcached service reload")
services = services + ['memcached']
elif self.app.pargs.dovecot:
if self.app.pargs.dovecot:
Log.debug(self, "dovecot service reload")
services = services + ['dovecot']
else:
if not services:
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix']
for service in services:
Log.debug(self, "nginx,php5-fpm,mysql,postfix services reload")

2
ee/core/fileutils.py

@ -74,7 +74,7 @@ class EEFileUtils():
except IOError as e:
Log.debug(self, "{e}".format(e.strerror))
Log.error(self, "Unable to copy file from {0} to {1}"
.fromat(src, dest))
.format(src, dest))
def searchreplace(self, fnm, sstr, rstr):
"""

32
ee/core/mysql.py

@ -42,23 +42,23 @@ class EEMysql():
Log.error(self, 'Unable to connect to database: {0}'
.format(e))
try:
if log:
Log.debug(self, "Executing MySQL statement: {0}"
.format(statement))
try:
if log:
Log.debug(self, "Executing MySQL statement: {0}"
.format(statement))
cur.execute(statement)
cur.close()
conn.close()
cur.execute(statement)
cur.close()
conn.close()
except Exception as e:
cur.close()
conn.close()
Log.debug(self, "{0}".format(e))
if not errormsg:
Log.error(self, 'Unable to execute statement')
else:
Log.error(self, '{0}'.format(errormsg))
except Exception as e:
cur.close()
conn.close()
Log.debug(self, "{0}".format(e))
if not errormsg:
Log.error(self, 'Unable to execute statement')
else:
Log.error(self, '{0}'.format(errormsg))
# def __del__(self):

2
setup.py

@ -54,7 +54,7 @@ except Exception as e:
os.system("git config --global user.email {0}".format(ee_email))
setup(name='ee',
version='3.0',
version='3.0.2',
description=long_description,
long_description=long_description,
classifiers=[],

Loading…
Cancel
Save