Fix wo info and add tweaks to wo stack upgrade
This commit is contained in:
@@ -8,6 +8,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||||||
|
|
||||||
### v3.9.x - [Unreleased]
|
### v3.9.x - [Unreleased]
|
||||||
|
|
||||||
|
### v3.10.0 - 2019-10-30
|
||||||
|
|
||||||
#### Added
|
#### Added
|
||||||
|
|
||||||
- WordOps install is now installed with pip from PyPi (easier, cleaner and safer) inside a wheel
|
- WordOps install is now installed with pip from PyPi (easier, cleaner and safer) inside a wheel
|
||||||
@@ -35,6 +37,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||||||
- force-ssl.conf not removed after removing a site
|
- force-ssl.conf not removed after removing a site
|
||||||
- `wo clean --opcache` not working with invalid SSL certificate
|
- `wo clean --opcache` not working with invalid SSL certificate
|
||||||
- `wo stack install --cheat` wasn't working properly previously
|
- `wo stack install --cheat` wasn't working properly previously
|
||||||
|
- `wo info` failure depending on php-fpm pool name. ConfigParser will now detect the section name.
|
||||||
|
|
||||||
|
|
||||||
### v3.9.9.4 - 2019-10-18
|
### v3.9.9.4 - 2019-10-18
|
||||||
|
|||||||
15
setup.cfg
15
setup.cfg
@@ -12,4 +12,17 @@ cover-html-dir=coverage_report/
|
|||||||
where=tests/
|
where=tests/
|
||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
license-file = LICENSE
|
license-file = LICENSE
|
||||||
|
|
||||||
|
[flake8]
|
||||||
|
ignore = F405,W504,S322,S404,S603,s607,s602
|
||||||
|
exclude =
|
||||||
|
# No need to traverse our git directory
|
||||||
|
.git,
|
||||||
|
# There's no value in checking cache directories
|
||||||
|
__pycache__,
|
||||||
|
# This contains our built documentation
|
||||||
|
build,
|
||||||
|
# This contains builds of flake8 that we don't want to check
|
||||||
|
dist
|
||||||
|
max-complexity = 10
|
||||||
@@ -225,6 +225,7 @@ echo -e ' various informations '
|
|||||||
echo -e "${CGREEN}#############################################${CEND}"
|
echo -e "${CGREEN}#############################################${CEND}"
|
||||||
wp --allow-root --info
|
wp --allow-root --info
|
||||||
wo site info wp.net
|
wo site info wp.net
|
||||||
|
wo info
|
||||||
|
|
||||||
echo -e "${CGREEN}#############################################${CEND}"
|
echo -e "${CGREEN}#############################################${CEND}"
|
||||||
echo -e ' wo stack purge '
|
echo -e ' wo stack purge '
|
||||||
@@ -244,6 +245,3 @@ for stack in $stack_purge; do
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ -n "$1" ]; then
|
|
||||||
cat /var/log/wo/test.log | ccze -A -p syslog
|
|
||||||
fi
|
|
||||||
|
|||||||
@@ -79,20 +79,22 @@ class WOInfoController(CementBaseController):
|
|||||||
max_execution_time = config['PHP']['max_execution_time']
|
max_execution_time = config['PHP']['max_execution_time']
|
||||||
|
|
||||||
config.read('/etc/{0}/fpm/pool.d/www.conf'.format("php/7.2"))
|
config.read('/etc/{0}/fpm/pool.d/www.conf'.format("php/7.2"))
|
||||||
www_listen = config['www-php72']['listen']
|
wo_sec = (config.sections())[0]
|
||||||
www_ping_path = config['www-php72']['ping.path']
|
www_listen = config[[wo_sec]]['listen']
|
||||||
www_pm_status_path = config['www-php72']['pm.status_path']
|
www_ping_path = config[[wo_sec]]['ping.path']
|
||||||
www_pm = config['www-php72']['pm']
|
www_pm_status_path = config[[wo_sec]]['pm.status_path']
|
||||||
www_pm_max_requests = config['www-php72']['pm.max_requests']
|
www_pm = config[[wo_sec]]['pm']
|
||||||
www_pm_max_children = config['www-php72']['pm.max_children']
|
www_pm_max_requests = config[[wo_sec]]['pm.max_requests']
|
||||||
www_pm_start_servers = config['www-php72']['pm.start_servers']
|
www_pm_max_children = config[[wo_sec]]['pm.max_children']
|
||||||
www_pm_min_spare_servers = config['www-php72']['pm.min_spare_servers']
|
www_pm_start_servers = config[[wo_sec]]['pm.start_servers']
|
||||||
www_pm_max_spare_servers = config['www-php72']['pm.max_spare_servers']
|
www_pm_min_spare_servers = config[[wo_sec]]['pm.min_spare_servers']
|
||||||
www_request_terminate_time = (config['www-php72']
|
www_pm_max_spare_servers = config[[wo_sec]]['pm.max_spare_servers']
|
||||||
|
www_request_terminate_time = (config[[wo_sec]]
|
||||||
['request_terminate_timeout'])
|
['request_terminate_timeout'])
|
||||||
try:
|
try:
|
||||||
www_xdebug = (config['www-php72']['php_admin_flag[xdebug.profiler_enable'
|
www_xdebug = (
|
||||||
'_trigger]'])
|
config[[wo_sec]]['php_admin_flag[xdebug.profiler_enable'
|
||||||
|
'_trigger]'])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
Log.debug(self, "{0}".format(e))
|
Log.debug(self, "{0}".format(e))
|
||||||
www_xdebug = 'off'
|
www_xdebug = 'off'
|
||||||
@@ -156,19 +158,20 @@ class WOInfoController(CementBaseController):
|
|||||||
max_execution_time = config['PHP']['max_execution_time']
|
max_execution_time = config['PHP']['max_execution_time']
|
||||||
|
|
||||||
config.read('/etc/php/7.3/fpm/pool.d/www.conf')
|
config.read('/etc/php/7.3/fpm/pool.d/www.conf')
|
||||||
www_listen = config['www-php73']['listen']
|
wo_sec = (config.sections())[0]
|
||||||
www_ping_path = config['www-php73']['ping.path']
|
www_listen = config[wo_sec]['listen']
|
||||||
www_pm_status_path = config['www-php73']['pm.status_path']
|
www_ping_path = config[wo_sec]['ping.path']
|
||||||
www_pm = config['www-php73']['pm']
|
www_pm_status_path = config[wo_sec]['pm.status_path']
|
||||||
www_pm_max_requests = config['www-php73']['pm.max_requests']
|
www_pm = config[wo_sec]['pm']
|
||||||
www_pm_max_children = config['www-php73']['pm.max_children']
|
www_pm_max_requests = config[wo_sec]['pm.max_requests']
|
||||||
www_pm_start_servers = config['www-php73']['pm.start_servers']
|
www_pm_max_children = config[wo_sec]['pm.max_children']
|
||||||
www_pm_min_spare_servers = config['www-php73']['pm.min_spare_servers']
|
www_pm_start_servers = config[wo_sec]['pm.start_servers']
|
||||||
www_pm_max_spare_servers = config['www-php73']['pm.max_spare_servers']
|
www_pm_min_spare_servers = config[wo_sec]['pm.min_spare_servers']
|
||||||
www_request_terminate_time = (config['www-php73']
|
www_pm_max_spare_servers = config[wo_sec]['pm.max_spare_servers']
|
||||||
|
www_request_terminate_time = (config[wo_sec]
|
||||||
['request_terminate_timeout'])
|
['request_terminate_timeout'])
|
||||||
try:
|
try:
|
||||||
www_xdebug = (config['www-php73']
|
www_xdebug = (config[wo_sec]
|
||||||
['php_admin_flag[xdebug.profiler_enable'
|
['php_admin_flag[xdebug.profiler_enable'
|
||||||
'_trigger]'])
|
'_trigger]'])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -266,7 +269,8 @@ class WOInfoController(CementBaseController):
|
|||||||
|
|
||||||
if self.app.pargs.nginx:
|
if self.app.pargs.nginx:
|
||||||
if (WOAptGet.is_installed(self, 'nginx-custom') or
|
if (WOAptGet.is_installed(self, 'nginx-custom') or
|
||||||
WOAptGet.is_installed(self, 'nginx-wo')):
|
WOAptGet.is_installed(self, 'nginx-wo') or
|
||||||
|
(os.path.exists('/usr/bin/nginx'))):
|
||||||
self.info_nginx()
|
self.info_nginx()
|
||||||
else:
|
else:
|
||||||
Log.error(self, "Nginx is not installed")
|
Log.error(self, "Nginx is not installed")
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class WOSiteController(CementBaseController):
|
|||||||
Log.error(self, "service nginx reload failed. "
|
Log.error(self, "service nginx reload failed. "
|
||||||
"check issues with `nginx -t` command")
|
"check issues with `nginx -t` command")
|
||||||
else:
|
else:
|
||||||
Log.error(self, "nginx configuration file does not exist")
|
Log.error(self, 'nginx configuration file does not exist')
|
||||||
|
|
||||||
@expose(help="Disable site example.com")
|
@expose(help="Disable site example.com")
|
||||||
def disable(self):
|
def disable(self):
|
||||||
@@ -106,7 +106,7 @@ class WOSiteController(CementBaseController):
|
|||||||
if not os.path.isfile('/etc/nginx/sites-enabled/{0}'
|
if not os.path.isfile('/etc/nginx/sites-enabled/{0}'
|
||||||
.format(wo_domain)):
|
.format(wo_domain)):
|
||||||
Log.debug(self, "Site {0} already disabled".format(wo_domain))
|
Log.debug(self, "Site {0} already disabled".format(wo_domain))
|
||||||
Log.info(self, "[" + Log.FAIL + "Failed" + Log.OKBLUE+"]")
|
Log.info(self, "[" + Log.FAIL + "Failed" + Log.OKBLUE + "]")
|
||||||
else:
|
else:
|
||||||
WOFileUtils.remove_symlink(self,
|
WOFileUtils.remove_symlink(self,
|
||||||
'/etc/nginx/sites-enabled/{0}'
|
'/etc/nginx/sites-enabled/{0}'
|
||||||
@@ -176,7 +176,7 @@ class WOSiteController(CementBaseController):
|
|||||||
dbname=wo_db_name, dbuser=wo_db_user,
|
dbname=wo_db_name, dbuser=wo_db_user,
|
||||||
php_version=php_version,
|
php_version=php_version,
|
||||||
dbpass=wo_db_pass,
|
dbpass=wo_db_pass,
|
||||||
ssl=ssl, sslprovider=sslprovider, sslexpiry=sslexpiry,
|
ssl=ssl, sslprovider=sslprovider, sslexpiry=sslexpiry,
|
||||||
type=sitetype + " " + cachetype + " ({0})"
|
type=sitetype + " " + cachetype + " ({0})"
|
||||||
.format("enabled" if siteinfo.is_enabled else
|
.format("enabled" if siteinfo.is_enabled else
|
||||||
"disabled"))
|
"disabled"))
|
||||||
@@ -452,7 +452,7 @@ class WOSiteCreateController(CementBaseController):
|
|||||||
|
|
||||||
if stype == 'proxy':
|
if stype == 'proxy':
|
||||||
data = dict(site_name=wo_domain, www_domain=wo_www_domain,
|
data = dict(site_name=wo_domain, www_domain=wo_www_domain,
|
||||||
static=True, basic=False, php73=False, wp=False,
|
static=True, basic=False, php73=False, wp=False,
|
||||||
wpfc=False, wpsc=False, wprocket=False, wpce=False,
|
wpfc=False, wpsc=False, wprocket=False, wpce=False,
|
||||||
multisite=False,
|
multisite=False,
|
||||||
wpsubdir=False, webroot=wo_site_webroot)
|
wpsubdir=False, webroot=wo_site_webroot)
|
||||||
@@ -463,7 +463,7 @@ class WOSiteCreateController(CementBaseController):
|
|||||||
|
|
||||||
if pargs.php73:
|
if pargs.php73:
|
||||||
data = dict(site_name=wo_domain, www_domain=wo_www_domain,
|
data = dict(site_name=wo_domain, www_domain=wo_www_domain,
|
||||||
static=False, basic=False, php73=True, wp=False,
|
static=False, basic=False, php73=True, wp=False,
|
||||||
wpfc=False, wpsc=False, wprocket=False, wpce=False,
|
wpfc=False, wpsc=False, wprocket=False, wpce=False,
|
||||||
multisite=False,
|
multisite=False,
|
||||||
wpsubdir=False, webroot=wo_site_webroot)
|
wpsubdir=False, webroot=wo_site_webroot)
|
||||||
@@ -471,7 +471,7 @@ class WOSiteCreateController(CementBaseController):
|
|||||||
|
|
||||||
if stype in ['html', 'php']:
|
if stype in ['html', 'php']:
|
||||||
data = dict(site_name=wo_domain, www_domain=wo_www_domain,
|
data = dict(site_name=wo_domain, www_domain=wo_www_domain,
|
||||||
static=True, basic=False, php73=False, wp=False,
|
static=True, basic=False, php73=False, wp=False,
|
||||||
wpfc=False, wpsc=False, wprocket=False, wpce=False,
|
wpfc=False, wpsc=False, wprocket=False, wpce=False,
|
||||||
multisite=False,
|
multisite=False,
|
||||||
wpsubdir=False, webroot=wo_site_webroot)
|
wpsubdir=False, webroot=wo_site_webroot)
|
||||||
@@ -483,7 +483,7 @@ class WOSiteCreateController(CementBaseController):
|
|||||||
elif stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
|
elif stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
|
||||||
|
|
||||||
data = dict(site_name=wo_domain, www_domain=wo_www_domain,
|
data = dict(site_name=wo_domain, www_domain=wo_www_domain,
|
||||||
static=False, basic=True, wp=False, wpfc=False,
|
static=False, basic=True, wp=False, wpfc=False,
|
||||||
wpsc=False, wpredis=False, wprocket=False, wpce=False,
|
wpsc=False, wpredis=False, wprocket=False, wpce=False,
|
||||||
multisite=False,
|
multisite=False,
|
||||||
wpsubdir=False, webroot=wo_site_webroot,
|
wpsubdir=False, webroot=wo_site_webroot,
|
||||||
@@ -509,8 +509,7 @@ class WOSiteCreateController(CementBaseController):
|
|||||||
elif data:
|
elif data:
|
||||||
data['php73'] = False
|
data['php73'] = False
|
||||||
|
|
||||||
if ((not pargs.wpfc) and
|
if ((not pargs.wpfc) and (not pargs.wpsc) and
|
||||||
(not pargs.wpsc) and
|
|
||||||
(not pargs.wprocket) and
|
(not pargs.wprocket) and
|
||||||
(not pargs.wpce) and
|
(not pargs.wpce) and
|
||||||
(not pargs.wpredis)):
|
(not pargs.wpredis)):
|
||||||
@@ -1131,7 +1130,7 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
if stype == 'php':
|
if stype == 'php':
|
||||||
data = dict(
|
data = dict(
|
||||||
site_name=wo_domain, www_domain=wo_www_domain,
|
site_name=wo_domain, www_domain=wo_www_domain,
|
||||||
static=False, basic=True, wp=False, wpfc=False,
|
static=False, basic=True, wp=False, wpfc=False,
|
||||||
wpsc=False, wpredis=False, wprocket=False, wpce=False,
|
wpsc=False, wpredis=False, wprocket=False, wpce=False,
|
||||||
multisite=False, wpsubdir=False, webroot=wo_site_webroot,
|
multisite=False, wpsubdir=False, webroot=wo_site_webroot,
|
||||||
currsitetype=oldsitetype, currcachetype=oldcachetype)
|
currsitetype=oldsitetype, currcachetype=oldcachetype)
|
||||||
@@ -1140,7 +1139,7 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
|
|
||||||
data = dict(
|
data = dict(
|
||||||
site_name=wo_domain, www_domain=wo_www_domain,
|
site_name=wo_domain, www_domain=wo_www_domain,
|
||||||
static=False, basic=True, wp=False, wpfc=False,
|
static=False, basic=True, wp=False, wpfc=False,
|
||||||
wpsc=False, wpredis=False, wprocket=False, wpce=False,
|
wpsc=False, wpredis=False, wprocket=False, wpce=False,
|
||||||
multisite=False, wpsubdir=False, webroot=wo_site_webroot,
|
multisite=False, wpsubdir=False, webroot=wo_site_webroot,
|
||||||
wo_db_name='', wo_db_user='', wo_db_pass='',
|
wo_db_name='', wo_db_user='', wo_db_pass='',
|
||||||
@@ -1294,6 +1293,11 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
letsencrypt = False
|
letsencrypt = False
|
||||||
acme_subdomain = False
|
acme_subdomain = False
|
||||||
acme_wildcard = False
|
acme_wildcard = False
|
||||||
|
else:
|
||||||
|
data['letsencrypt'] = False
|
||||||
|
letsencrypt = False
|
||||||
|
acme_subdomain = False
|
||||||
|
acme_wildcard = False
|
||||||
|
|
||||||
if not (acme_subdomain is True):
|
if not (acme_subdomain is True):
|
||||||
if letsencrypt is check_ssl:
|
if letsencrypt is check_ssl:
|
||||||
|
|||||||
@@ -539,6 +539,7 @@ class WOStackController(CementBaseController):
|
|||||||
Log.info(self, "Successfully installed packages")
|
Log.info(self, "Successfully installed packages")
|
||||||
else:
|
else:
|
||||||
return self.msg
|
return self.msg
|
||||||
|
return 0
|
||||||
|
|
||||||
@expose(help="Remove packages")
|
@expose(help="Remove packages")
|
||||||
def remove(self):
|
def remove(self):
|
||||||
|
|||||||
@@ -814,14 +814,14 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
"/etc/mysql/my.cnf.default-pkg")
|
"/etc/mysql/my.cnf.default-pkg")
|
||||||
wo_ram = psutil.virtual_memory().total / (1024 * 1024)
|
wo_ram = psutil.virtual_memory().total / (1024 * 1024)
|
||||||
# set InnoDB variable depending on the RAM available
|
# set InnoDB variable depending on the RAM available
|
||||||
wo_ram_innodb = int(wo_ram*0.3)
|
wo_ram_innodb = int(wo_ram * 0.3)
|
||||||
wo_ram_log_buffer = int(wo_ram_innodb*0.25)
|
wo_ram_log_buffer = int(wo_ram_innodb * 0.25)
|
||||||
wo_ram_log_size = int(wo_ram_log_buffer*0.5)
|
wo_ram_log_size = int(wo_ram_log_buffer * 0.5)
|
||||||
if (wo_ram < 2000):
|
if (wo_ram < 2000):
|
||||||
wo_innodb_instance = int(1)
|
wo_innodb_instance = int(1)
|
||||||
tmp_table_size = int(32)
|
tmp_table_size = int(32)
|
||||||
elif (wo_ram > 2000) and (wo_ram < 64000):
|
elif (wo_ram > 2000) and (wo_ram < 64000):
|
||||||
wo_innodb_instance = int(wo_ram/1000)
|
wo_innodb_instance = int(wo_ram / 1000)
|
||||||
tmp_table_size = int(128)
|
tmp_table_size = int(128)
|
||||||
elif (wo_ram > 64000):
|
elif (wo_ram > 64000):
|
||||||
wo_innodb_instance = int(64)
|
wo_innodb_instance = int(64)
|
||||||
@@ -1015,24 +1015,26 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
if wo_ram < 1024:
|
if wo_ram < 1024:
|
||||||
Log.debug(self, "Setting maxmemory variable to "
|
Log.debug(self, "Setting maxmemory variable to "
|
||||||
"{0} in redis.conf"
|
"{0} in redis.conf"
|
||||||
.format(int(wo_ram*1024*1024*0.1)))
|
.format(int(wo_ram * 1024 * 1024 * 0.1)))
|
||||||
WOFileUtils.searchreplace(self,
|
WOFileUtils.searchreplace
|
||||||
"/etc/redis/redis.conf",
|
(self,
|
||||||
"# maxmemory <bytes>",
|
"/etc/redis/redis.conf",
|
||||||
"maxmemory {0}"
|
"# maxmemory <bytes>",
|
||||||
.format
|
"maxmemory {0}"
|
||||||
(int(wo_ram*1024*1024*0.1)))
|
.format
|
||||||
|
(int(wo_ram * 1024 * 1024 * 0.1)))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
Log.debug(self, "Setting maxmemory variable to {0} "
|
Log.debug(self, "Setting maxmemory variable to {0} "
|
||||||
"in redis.conf"
|
"in redis.conf"
|
||||||
.format(int(wo_ram*1024*1024*0.2)))
|
.format(int(wo_ram * 1024 * 1024 * 0.2)))
|
||||||
WOFileUtils.searchreplace(self,
|
WOFileUtils.searchreplace(
|
||||||
"/etc/redis/redis.conf",
|
self,
|
||||||
"# maxmemory <bytes>",
|
"/etc/redis/redis.conf",
|
||||||
"maxmemory {0}"
|
"# maxmemory <bytes>",
|
||||||
.format
|
"maxmemory {0}"
|
||||||
(int(wo_ram*1024*1024*0.2)))
|
.format
|
||||||
|
(int(wo_ram * 1024 * 1024 * 0.2)))
|
||||||
|
|
||||||
Log.debug(
|
Log.debug(
|
||||||
self, "Setting maxmemory-policy variable to "
|
self, "Setting maxmemory-policy variable to "
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import shutil
|
|||||||
|
|
||||||
from cement.core.controller import CementBaseController, expose
|
from cement.core.controller import CementBaseController, expose
|
||||||
|
|
||||||
from wo.cli.plugins.stack_pref import post_pref, pre_pref
|
from wo.cli.plugins.stack_pref import post_pref, pre_pref, pre_stack
|
||||||
from wo.core.aptget import WOAptGet
|
from wo.core.aptget import WOAptGet
|
||||||
from wo.core.download import WODownload
|
from wo.core.download import WODownload
|
||||||
from wo.core.extract import WOExtract
|
from wo.core.extract import WOExtract
|
||||||
@@ -178,6 +178,7 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
if ((not (apt_packages)) and (not(packages))):
|
if ((not (apt_packages)) and (not(packages))):
|
||||||
self.app.args.print_help()
|
self.app.args.print_help()
|
||||||
else:
|
else:
|
||||||
|
pre_stack(self)
|
||||||
if (apt_packages):
|
if (apt_packages):
|
||||||
if (("php7.2-fpm" not in apt_packages) and
|
if (("php7.2-fpm" not in apt_packages) and
|
||||||
("php7.3-fpm" not in apt_packages) and
|
("php7.3-fpm" not in apt_packages) and
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ class WODownload():
|
|||||||
if req.encoding is None:
|
if req.encoding is None:
|
||||||
req.encoding = 'utf-8'
|
req.encoding = 'utf-8'
|
||||||
out_file.write(req.content)
|
out_file.write(req.content)
|
||||||
Log.info(self, "{0}".format("[" + Log.ENDC + "Done"
|
Log.info(self, "{0}".format("[" + Log.ENDC + "Done" +
|
||||||
+ Log.OKBLUE + "]"))
|
Log.OKBLUE + "]"))
|
||||||
except requests.RequestException as e:
|
except requests.RequestException as e:
|
||||||
Log.debug(self, "[{err}]".format(err=str(e.reason)))
|
Log.debug(self, "[{err}]".format(err=str(e.reason)))
|
||||||
Log.error(self, "Unable to download file, {0}"
|
Log.error(self, "Unable to download file, {0}"
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class WOGit:
|
|||||||
git = git.bake("--git-dir={0}/.git".format(path),
|
git = git.bake("--git-dir={0}/.git".format(path),
|
||||||
"--work-tree={0}".format(path))
|
"--work-tree={0}".format(path))
|
||||||
if os.path.isdir(path):
|
if os.path.isdir(path):
|
||||||
if not os.path.isdir(path+"/.git"):
|
if not os.path.isdir(path + "/.git"):
|
||||||
try:
|
try:
|
||||||
Log.debug(self, "WOGit: git init at {0}"
|
Log.debug(self, "WOGit: git init at {0}"
|
||||||
.format(path))
|
.format(path))
|
||||||
@@ -67,11 +67,13 @@ class WOGit:
|
|||||||
git = git.bake("--git-dir={0}/.git".format(path),
|
git = git.bake("--git-dir={0}/.git".format(path),
|
||||||
"--work-tree={0}".format(path))
|
"--work-tree={0}".format(path))
|
||||||
if os.path.isdir(path):
|
if os.path.isdir(path):
|
||||||
if not os.path.isdir(path+"/.git"):
|
if not os.path.isdir(path + "/.git"):
|
||||||
Log.error(self, "Unable to find a git repository at {0}"
|
Log.error(
|
||||||
|
self, "Unable to find a git repository at {0}"
|
||||||
.format(path))
|
.format(path))
|
||||||
try:
|
try:
|
||||||
Log.debug(self, "WOGit: git stash --include-untracked at {0}"
|
Log.debug(
|
||||||
|
self, "WOGit: git stash --include-untracked at {0}"
|
||||||
.format(path))
|
.format(path))
|
||||||
git.stash("push", "--include-untracked", "-m {0}"
|
git.stash("push", "--include-untracked", "-m {0}"
|
||||||
.format(msg))
|
.format(msg))
|
||||||
|
|||||||
@@ -43,7 +43,8 @@ class WOService():
|
|||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
Log.debug(self, "{0}".format(retcode[1]))
|
Log.debug(self, "{0}".format(retcode[1]))
|
||||||
Log.info(self, "[" + Log.FAIL + "Failed" + Log.OKBLUE+"]")
|
Log.info(self, "[" + Log.FAIL +
|
||||||
|
"Failed" + Log.OKBLUE + "]")
|
||||||
return False
|
return False
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
Log.debug(self, "{0}".format(e))
|
Log.debug(self, "{0}".format(e))
|
||||||
@@ -65,7 +66,7 @@ class WOService():
|
|||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
Log.debug(self, "{0}".format(retcode[1]))
|
Log.debug(self, "{0}".format(retcode[1]))
|
||||||
Log.info(self, "[" + Log.FAIL + "Failed" + Log.OKBLUE+"]")
|
Log.info(self, "[" + Log.FAIL + "Failed" + Log.OKBLUE + "]")
|
||||||
return False
|
return False
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
Log.debug(self, "{0}".format(e))
|
Log.debug(self, "{0}".format(e))
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class WOVar():
|
|||||||
|
|
||||||
# WordOps git configuration management
|
# WordOps git configuration management
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
config.read(os.path.expanduser("~")+'/.gitconfig')
|
config.read(os.path.expanduser("~") + '/.gitconfig')
|
||||||
try:
|
try:
|
||||||
wo_user = config['user']['name']
|
wo_user = config['user']['name']
|
||||||
wo_email = config['user']['email']
|
wo_email = config['user']['email']
|
||||||
@@ -90,7 +90,7 @@ class WOVar():
|
|||||||
git.config("--global", "user.email", "{0}".format(wo_email))
|
git.config("--global", "user.email", "{0}".format(wo_email))
|
||||||
|
|
||||||
if not os.path.isfile('/root/.gitconfig'):
|
if not os.path.isfile('/root/.gitconfig'):
|
||||||
copy2(os.path.expanduser("~")+'/.gitconfig', '/root/.gitconfig')
|
copy2(os.path.expanduser("~") + '/.gitconfig', '/root/.gitconfig')
|
||||||
|
|
||||||
# MySQL hostname
|
# MySQL hostname
|
||||||
wo_mysql_host = ""
|
wo_mysql_host = ""
|
||||||
@@ -98,7 +98,7 @@ class WOVar():
|
|||||||
if os.path.exists('/etc/mysql/conf.d/my.cnf'):
|
if os.path.exists('/etc/mysql/conf.d/my.cnf'):
|
||||||
cnfpath = "/etc/mysql/conf.d/my.cnf"
|
cnfpath = "/etc/mysql/conf.d/my.cnf"
|
||||||
else:
|
else:
|
||||||
cnfpath = os.path.expanduser("~")+"/.my.cnf"
|
cnfpath = os.path.expanduser("~") + "/.my.cnf"
|
||||||
if [cnfpath] == config.read(cnfpath):
|
if [cnfpath] == config.read(cnfpath):
|
||||||
try:
|
try:
|
||||||
wo_mysql_host = config.get('client', 'host')
|
wo_mysql_host = config.get('client', 'host')
|
||||||
|
|||||||
Reference in New Issue
Block a user