Browse Source

Merge branch 'master' into stable

stable v3.1.8
gau1991 10 years ago
parent
commit
6ea6c6e69d
  1. 5
      CHANGELOG.txt
  2. 3
      ee/cli/plugins/site_functions.py
  3. 3
      ee/cli/plugins/stack.py
  4. 388
      ee/cli/plugins/stack_services.py
  5. 2
      ee/cli/plugins/stack_upgrade.py
  6. 43
      ee/core/services.py
  7. 2
      ee/core/variables.py
  8. 2
      install
  9. 2
      setup.py

5
CHANGELOG.txt

@ -1,3 +1,8 @@
v 3.1.8 - May 22, 2015
- Fixed PHP Failed to Restart after Upgrade #550
- Improved ee stack services command
- Minor fix and improvements
v 3.1.7 - May 21, 2015
- Fixed site blank issue after nginx stack upgrade on Debian
- Improved update script

3
ee/cli/plugins/site_functions.py

@ -17,6 +17,7 @@ import sys
import getpass
import glob
import re
import platform
class SiteError(Exception):
@ -604,6 +605,8 @@ def site_package_check(self, stype):
"/usr/bin/wp", "WP-CLI"]]
if self.app.pargs.hhvm:
if platform.architecture()[0] is '32bit':
Log.error(self, "HHVM is not supported by 32bit system")
Log.debug(self, "Setting apt_packages variable for HHVM")
if not EEAptGet.is_installed(self, 'hhvm'):
apt_packages = apt_packages + EEVariables.ee_hhvm

3
ee/cli/plugins/stack.py

@ -25,6 +25,7 @@ import os
import pwd
import grp
import codecs
import platform
from ee.cli.plugins.stack_services import EEStackStatusController
from ee.cli.plugins.stack_migrate import EEStackMigrateController
from ee.cli.plugins.stack_upgrade import EEStackUpgradeController
@ -1494,6 +1495,8 @@ class EEStackController(CementBaseController):
if self.app.pargs.hhvm:
Log.debug(self, "Setting apt packages variable for HHVM")
if platform.architecture()[0] is '32bit':
Log.error(self, "HHVM is not supported by 32bit system")
if not EEAptGet.is_installed(self, 'hhvm'):
apt_packages = apt_packages + EEVariables.ee_hhvm
else:

388
ee/cli/plugins/stack_services.py

@ -3,6 +3,7 @@ from cement.core import handler, hook
from ee.core.services import EEService
from ee.core.logging import Log
from ee.core.variables import EEVariables
from ee.core.aptget import EEAptGet
class EEStackStatusController(CementBaseController):
@ -22,158 +23,282 @@ class EEStackStatusController(CementBaseController):
def start(self):
"""Start services"""
services = []
if not (self.app.pargs.nginx or self.app.pargs.php
or self.app.pargs.mysql or self.app.pargs.postfix
or self.app.pargs.hhvm or self.app.pargs.memcache
or self.app.pargs.dovecot):
self.app.pargs.nginx = True
self.app.pargs.php = True
self.app.pargs.mysql = True
self.app.pargs.postfix = True
self.app.pargs.hhvm = True
if self.app.pargs.nginx:
Log.debug(self, "nginx service start")
services = services + ['nginx']
if EEVariables.ee_platform_distro == 'debian':
check_nginx = 'nginx-extras'
else:
check_nginx = 'nginx-custom'
if EEAptGet.is_installed(self, check_nginx):
services = services + ['nginx']
else:
Log.info(self, "Nginx is not installed")
if self.app.pargs.php:
Log.debug(self, "php5-fpm service start")
services = services + ['php5-fpm']
if EEAptGet.is_installed(self, 'php5-fpm'):
services = services + ['php5-fpm']
else:
Log.info(self, "PHP5-FPM is not installed")
if self.app.pargs.mysql:
if EEVariables.ee_mysql_host is "localhost":
Log.debug(self, "mysql service start")
services = services + ['mysql']
if ((EEVariables.ee_mysql_host is "localhost") or
(EEVariables.ee_mysql_host is "127.0.0.1")):
if (EEAptGet.is_installed(self, 'mysql-server') or
EEAptGet.is_installed(self, 'percona-server-server-5.6') or
EEAptGet.is_installed(self, 'mariadb-server')):
services = services + ['mysql']
else:
Log.info(self, "MySQL is not installed")
else:
Log.warn(self, "Remote MySQL found,"
"unable to start MySQL service")
Log.warn(self, "Remote MySQL found, "
"Unable to check MySQL service status")
if self.app.pargs.postfix:
Log.debug(self, "postfix service start")
services = services + ['postfix']
if EEAptGet.is_installed(self, 'postfix'):
services = services + ['postfix']
else:
Log.info(self, "Postfix is not installed")
if self.app.pargs.hhvm:
services = services + ['hhvm']
Log.debug(self, "hhvm service start")
if EEAptGet.is_installed(self, 'hhvm'):
services = services + ['hhvm']
else:
Log.info(self, "HHVM is not installed")
if self.app.pargs.memcache:
Log.debug(self, "memcached service start")
services = services + ['memcached']
if EEAptGet.is_installed(self, 'memcached'):
services = services + ['memcached']
else:
Log.info(self, "Memcache is not installed")
if self.app.pargs.dovecot:
Log.debug(self, "dovecot service start")
services = services + ['dovecot']
if not services and EEVariables.ee_mysql_host is "localhost":
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix',
'hhvm']
Log.debug(self, "nginx,php5-fpm,mysql,postfix,hhvm services start")
elif not services:
services = services + ['nginx', 'php5-fpm', 'postfix', 'hhvm']
Log.debug(self, "nginx,php5-fpm,postfix,hhvm services start")
if EEAptGet.is_installed(self, 'dovecot-core'):
services = services + ['dovecot']
else:
Log.info(self, "Mail server is not installed")
for service in services:
Log.debug(self, "Starting service: {0}".format(service))
EEService.start_service(self, service)
@expose(help="Stop stack services")
def stop(self):
"""Stop services"""
services = []
if not (self.app.pargs.nginx or self.app.pargs.php
or self.app.pargs.mysql or self.app.pargs.postfix
or self.app.pargs.hhvm or self.app.pargs.memcache
or self.app.pargs.dovecot):
self.app.pargs.nginx = True
self.app.pargs.php = True
self.app.pargs.mysql = True
self.app.pargs.postfix = True
self.app.pargs.hhvm = True
if self.app.pargs.nginx:
Log.debug(self, "nginx service stop")
services = services + ['nginx']
if EEVariables.ee_platform_distro == 'debian':
check_nginx = 'nginx-extras'
else:
check_nginx = 'nginx-custom'
if EEAptGet.is_installed(self, check_nginx):
services = services + ['nginx']
else:
Log.info(self, "Nginx is not installed")
if self.app.pargs.php:
Log.debug(self, "php5-fpm service stop")
services = services + ['php5-fpm']
if EEAptGet.is_installed(self, 'php5-fpm'):
services = services + ['php5-fpm']
else:
Log.info(self, "PHP5-FPM is not installed")
if self.app.pargs.mysql:
if EEVariables.ee_mysql_host is "localhost":
Log.debug(self, "mysql service stop")
services = services + ['mysql']
if ((EEVariables.ee_mysql_host is "localhost") or
(EEVariables.ee_mysql_host is "127.0.0.1")):
if (EEAptGet.is_installed(self, 'mysql-server') or
EEAptGet.is_installed(self, 'percona-server-server-5.6') or
EEAptGet.is_installed(self, 'mariadb-server')):
services = services + ['mysql']
else:
Log.info(self, "MySQL is not installed")
else:
Log.warn(self, "Remote MySQL found, "
"unable to stop MySQL service")
"Unable to check MySQL service status")
if self.app.pargs.postfix:
Log.debug(self, "postfix service stop")
services = services + ['postfix']
if EEAptGet.is_installed(self, 'postfix'):
services = services + ['postfix']
else:
Log.info(self, "Postfix is not installed")
if self.app.pargs.hhvm:
services = services + ['hhvm']
Log.debug(self, "hhvm service stop")
if EEAptGet.is_installed(self, 'hhvm'):
services = services + ['hhvm']
else:
Log.info(self, "HHVM is not installed")
if self.app.pargs.memcache:
Log.debug(self, "memcached service stop")
services = services + ['memcached']
if EEAptGet.is_installed(self, 'memcached'):
services = services + ['memcached']
else:
Log.info(self, "Memcache is not installed")
if self.app.pargs.dovecot:
Log.debug(self, "dovecot service stop")
services = services + ['dovecot']
if not services and EEVariables.ee_mysql_host is "localhost":
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix',
'hhvm']
Log.debug(self, "nginx,php5-fpm,mysql,postfix,hhvm services stop")
elif not services:
services = services + ['nginx', 'php5-fpm', 'postfix', 'hhvm']
Log.debug(self, "nginx,php5-fpm,postfix,hhvm services stop")
if EEAptGet.is_installed(self, 'dovecot-core'):
services = services + ['dovecot']
else:
Log.info(self, "Mail server is not installed")
for service in services:
Log.debug(self, "Stopping service: {0}".format(service))
EEService.stop_service(self, service)
@expose(help="Restart stack services")
def restart(self):
"""Restart services"""
services = []
if not (self.app.pargs.nginx or self.app.pargs.php
or self.app.pargs.mysql or self.app.pargs.postfix
or self.app.pargs.hhvm or self.app.pargs.memcache
or self.app.pargs.dovecot):
self.app.pargs.nginx = True
self.app.pargs.php = True
self.app.pargs.mysql = True
self.app.pargs.postfix = True
self.app.pargs.hhvm = True
if self.app.pargs.nginx:
Log.debug(self, "nginx service restart")
services = services + ['nginx']
if EEVariables.ee_platform_distro == 'debian':
check_nginx = 'nginx-extras'
else:
check_nginx = 'nginx-custom'
if EEAptGet.is_installed(self, check_nginx):
services = services + ['nginx']
else:
Log.info(self, "Nginx is not installed")
if self.app.pargs.php:
Log.debug(self, "php5-fpm service restart")
services = services + ['php5-fpm']
if EEAptGet.is_installed(self, 'php5-fpm'):
services = services + ['php5-fpm']
else:
Log.info(self, "PHP5-FPM is not installed")
if self.app.pargs.mysql:
if EEVariables.ee_mysql_host is "localhost":
Log.debug(self, "mysql service restart")
services = services + ['mysql']
if ((EEVariables.ee_mysql_host is "localhost") or
(EEVariables.ee_mysql_host is "127.0.0.1")):
if (EEAptGet.is_installed(self, 'mysql-server') or
EEAptGet.is_installed(self, 'percona-server-server-5.6') or
EEAptGet.is_installed(self, 'mariadb-server')):
services = services + ['mysql']
else:
Log.info(self, "MySQL is not installed")
else:
Log.warn(self, "Remote MySQL found, "
"unable to restart MySQL service")
"Unable to check MySQL service status")
if self.app.pargs.postfix:
Log.debug(self, "postfix service restart")
services = services + ['postfix']
if EEAptGet.is_installed(self, 'postfix'):
services = services + ['postfix']
else:
Log.info(self, "Postfix is not installed")
if self.app.pargs.hhvm:
services = services + ['hhvm']
Log.debug(self, "hhvm service restart")
if EEAptGet.is_installed(self, 'hhvm'):
services = services + ['hhvm']
else:
Log.info(self, "HHVM is not installed")
if self.app.pargs.memcache:
Log.debug(self, "memcached service restart")
services = services + ['memcached']
if EEAptGet.is_installed(self, 'memcached'):
services = services + ['memcached']
else:
Log.info(self, "Memcache is not installed")
if self.app.pargs.dovecot:
Log.debug(self, "dovecot service restart")
services = services + ['dovecot']
if not services and EEVariables.ee_mysql_host is "localhost":
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix',
'hhvm']
Log.debug(self, "nginx,php5-fpm,mysql,postfix,hhvm services"
"restart")
elif not services:
services = services + ['nginx', 'php5-fpm', 'postfix', 'hhvm']
Log.debug(self, "nginx,php5-fpm,postfix,hhvm services restart")
if EEAptGet.is_installed(self, 'dovecot-core'):
services = services + ['dovecot']
else:
Log.info(self, "Mail server is not installed")
for service in services:
Log.debug(self, "Restarting service: {0}".format(service))
EEService.restart_service(self, service)
@expose(help="Get stack status")
def status(self):
"""Status of services"""
services = []
if not (self.app.pargs.nginx or self.app.pargs.php
or self.app.pargs.mysql or self.app.pargs.postfix
or self.app.pargs.hhvm or self.app.pargs.memcache
or self.app.pargs.dovecot):
self.app.pargs.nginx = True
self.app.pargs.php = True
self.app.pargs.mysql = True
self.app.pargs.postfix = True
self.app.pargs.hhvm = True
if self.app.pargs.nginx:
Log.debug(self, "nginx service status")
services = services + ['nginx']
if EEVariables.ee_platform_distro == 'debian':
check_nginx = 'nginx-extras'
else:
check_nginx = 'nginx-custom'
if EEAptGet.is_installed(self, check_nginx):
services = services + ['nginx']
else:
Log.info(self, "Nginx is not installed")
if self.app.pargs.php:
Log.debug(self, "php5-fpm service status")
services = services + ['php5-fpm']
if EEAptGet.is_installed(self, 'php5-fpm'):
services = services + ['php5-fpm']
else:
Log.info(self, "PHP5-FPM is not installed")
if self.app.pargs.mysql:
if EEVariables.ee_mysql_host is "localhost":
Log.debug(self, "mysql service status")
services = services + ['mysql']
if ((EEVariables.ee_mysql_host is "localhost") or
(EEVariables.ee_mysql_host is "127.0.0.1")):
if (EEAptGet.is_installed(self, 'mysql-server') or
EEAptGet.is_installed(self, 'percona-server-server-5.6') or
EEAptGet.is_installed(self, 'mariadb-server')):
services = services + ['mysql']
else:
Log.info(self, "MySQL is not installed")
else:
Log.warn(self, "Remote MySQL found, "
"unable to get MySQL service status")
"Unable to check MySQL service status")
if self.app.pargs.postfix:
services = services + ['postfix']
Log.debug(self, "postfix service status")
if EEAptGet.is_installed(self, 'postfix'):
services = services + ['postfix']
else:
Log.info(self, "Postfix is not installed")
if self.app.pargs.hhvm:
services = services + ['hhvm']
Log.debug(self, "hhvm service status")
if EEAptGet.is_installed(self, 'hhvm'):
services = services + ['hhvm']
else:
Log.info(self, "HHVM is not installed")
if self.app.pargs.memcache:
Log.debug(self, "memcached service status")
services = services + ['memcached']
if EEAptGet.is_installed(self, 'memcached'):
services = services + ['memcached']
else:
Log.info(self, "Memcache is not installed")
if self.app.pargs.dovecot:
Log.debug(self, "dovecot service status")
services = services + ['dovecot']
if not services and EEVariables.ee_mysql_host is "localhost":
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix',
'hhvm']
Log.debug(self, "nginx,php5-fpm,mysql,postfix,hhvm services"
" status")
elif not services:
services = services + ['nginx', 'php5-fpm', 'postfix', 'hhvm']
Log.debug(self, "nginx,php5-fpm,postfix,hhvm services status")
if EEAptGet.is_installed(self, 'dovecot-core'):
services = services + ['dovecot']
else:
Log.info(self, "Mail server is not installed")
for service in services:
if EEService.get_service_status(self, service):
Log.info(self, "{0:10}: {1}".format(service, "Running"))
@ -182,35 +307,66 @@ class EEStackStatusController(CementBaseController):
def reload(self):
"""Reload service"""
services = []
if not (self.app.pargs.nginx or self.app.pargs.php
or self.app.pargs.mysql or self.app.pargs.postfix
or self.app.pargs.hhvm or self.app.pargs.memcache
or self.app.pargs.dovecot):
self.app.pargs.nginx = True
self.app.pargs.php = True
self.app.pargs.mysql = True
self.app.pargs.postfix = True
if self.app.pargs.nginx:
Log.debug(self, "nginx service reload")
services = services + ['nginx']
if EEVariables.ee_platform_distro == 'debian':
check_nginx = 'nginx-extras'
else:
check_nginx = 'nginx-custom'
if EEAptGet.is_installed(self, check_nginx):
services = services + ['nginx']
else:
Log.info(self, "Nginx is not installed")
if self.app.pargs.php:
Log.debug(self, "php5-fpm service reload")
services = services + ['php5-fpm']
if EEAptGet.is_installed(self, 'php5-fpm'):
services = services + ['php5-fpm']
else:
Log.info(self, "PHP5-FPM is not installed")
if self.app.pargs.mysql:
if EEVariables.ee_mysql_host is "localhost":
Log.debug(self, "mysql service reload")
services = services + ['mysql']
if ((EEVariables.ee_mysql_host is "localhost") or
(EEVariables.ee_mysql_host is "127.0.0.1")):
if (EEAptGet.is_installed(self, 'mysql-server') or
EEAptGet.is_installed(self, 'percona-server-server-5.6') or
EEAptGet.is_installed(self, 'mariadb-server')):
services = services + ['mysql']
else:
Log.info(self, "MySQL is not installed")
else:
Log.warn(self, "Remote MySQL found, "
"unable to remote MySQL service")
"Unable to check MySQL service status")
if self.app.pargs.postfix:
Log.debug(self, "postfix service reload")
services = services + ['postfix']
if EEAptGet.is_installed(self, 'postfix'):
services = services + ['postfix']
else:
Log.info(self, "Postfix is not installed")
if self.app.pargs.hhvm:
Log.warn(self, "hhvm does not support to reload")
Log.info(self, "HHVM does not support to reload")
if self.app.pargs.memcache:
Log.debug(self, "memcached service reload")
services = services + ['memcached']
if EEAptGet.is_installed(self, 'memcached'):
services = services + ['memcached']
else:
Log.info(self, "Memcache is not installed")
if self.app.pargs.dovecot:
Log.debug(self, "dovecot service reload")
services = services + ['dovecot']
if not services and EEVariables.ee_mysql_host is "localhost":
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix']
Log.debug(self, "nginx,php5-fpm,mysql,postfix services reload")
elif not services:
services = services + ['nginx', 'php5-fpm', 'postfix']
Log.debug(self, "nginx,php5-fpm,postfix services reload")
if EEAptGet.is_installed(self, 'dovecot-core'):
services = services + ['dovecot']
else:
Log.info(self, "Mail server is not installed")
for service in services:
Log.debug(self, "Reloading service: {0}".format(service))
EEService.reload_service(self, service)

2
ee/cli/plugins/stack_upgrade.py

@ -203,7 +203,7 @@ class EEStackUpgradeController(CementBaseController):
EEService.restart_service(self, 'nginx')
if set(EEVariables.ee_php).issubset(set(apt_packages)):
EEService.restart_service(self, 'php')
EEService.restart_service(self, 'php5-fpm')
if set(EEVariables.ee_hhvm).issubset(set(apt_packages)):
EEService.restart_service(self, 'hhvm')
if set(EEVariables.ee_postfix).issubset(set(apt_packages)):

43
ee/core/services.py

@ -18,9 +18,14 @@ class EEService():
Similar to `service xyz start`
"""
try:
if service_name in ['nginx', 'php5-fpm']:
service_cmd = ('{0} -t && service {0} start'
.format(service_name))
else:
service_cmd = ('service {0} start'.format(service_name))
Log.info(self, "Start : {0:10}" .format(service_name), end='')
retcode = subprocess.getstatusoutput('service {0} start'
.format(service_name))
retcode = subprocess.getstatusoutput(service_cmd)
if retcode[0] == 0:
Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + "]")
return True
@ -60,9 +65,14 @@ class EEService():
Similar to `service xyz restart`
"""
try:
if service_name in ['nginx', 'php5-fpm']:
service_cmd = ('{0} -t && service {0} restart'
.format(service_name))
else:
service_cmd = ('service {0} restart'.format(service_name))
Log.info(self, "Restart : {0:10}".format(service_name), end='')
retcode = subprocess.getstatusoutput('service {0} restart'
.format(service_name))
retcode = subprocess.getstatusoutput(service_cmd)
if retcode[0] == 0:
Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + "]")
return True
@ -82,26 +92,13 @@ class EEService():
"""
try:
if service_name in ['nginx', 'php5-fpm']:
Log.info(self, "Reload : {0:10}".format(service_name),
end='')
retcode = subprocess.getstatusoutput('{0} -t &&'
' service {0} reload'
.format(service_name))
if retcode[0] == 0:
# print(retcode[0])
# subprocess.getstatusoutput('service {0} reload'
# .format(service_name))
Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE +
"]")
return True
else:
Log.debug(self, "{0}".format(retcode[1]))
Log.info(self, "[" + Log.FAIL + "Failed" +
Log.OKBLUE+"]")
return False
service_cmd = ('{0} -t && service {0} reload'
.format(service_name))
else:
service_cmd = ('service {0} reload'.format(service_name))
Log.info(self, "Reload : {0:10}".format(service_name), end='')
retcode = subprocess.getstatusoutput('service {0} reload'
.format(service_name))
retcode = subprocess.getstatusoutput(service_cmd)
if retcode[0] == 0:
Log.info(self, "[" + Log.ENDC + "OK" + Log.OKBLUE + "]")
return True

2
ee/core/variables.py

@ -12,7 +12,7 @@ class EEVariables():
"""Intialization of core variables"""
# EasyEngine version
ee_version = "3.1.7"
ee_version = "3.1.8"
# EasyEngine packages versions
ee_wp_cli = "0.19.1"

2
install

@ -48,7 +48,7 @@ fi
# Define variables for later use
ee_branch=$1
readonly ee_version_old="2.2.3"
readonly ee_version_new="3.1.7"
readonly ee_version_new="3.1.8"
readonly ee_log_dir=/var/log/ee/
readonly ee_install_log=/var/log/ee/install.log
readonly ee_linux_distro=$(lsb_release -i | awk '{print $3}')

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.1.7',
version='3.1.8',
description=long_description,
long_description=long_description,
classifiers=[],

Loading…
Cancel
Save