diff --git a/wo/cli/plugins/clean.py b/wo/cli/plugins/clean.py index a8e0052..a1b1231 100644 --- a/wo/cli/plugins/clean.py +++ b/wo/cli/plugins/clean.py @@ -1,14 +1,16 @@ """Clean Plugin for WordOps.""" -from wo.core.shellexec import WOShellExec -from wo.core.aptget import WOAptGet -from wo.core.services import WOService -from wo.core.logging import Log -from cement.core.controller import CementBaseController, expose -from cement.core import handler, hook import os import urllib.request +from cement.core import handler, hook +from cement.core.controller import CementBaseController, expose + +from wo.core.aptget import WOAptGet +from wo.core.logging import Log +from wo.core.services import WOService +from wo.core.shellexec import WOShellExec + def wo_clean_hook(app): pass diff --git a/wo/cli/plugins/debug.py b/wo/cli/plugins/debug.py index 391b3fc..9c2def0 100644 --- a/wo/cli/plugins/debug.py +++ b/wo/cli/plugins/debug.py @@ -1,21 +1,23 @@ """Debug Plugin for WordOps""" -from cement.core.controller import CementBaseController, expose -from cement.core import handler, hook -from wo.core.aptget import WOAptGet -from wo.core.shellexec import WOShellExec -from wo.core.mysql import WOMysql -from wo.core.services import WOService -from wo.core.logging import Log -from wo.cli.plugins.site_functions import logwatch -from wo.core.variables import WOVariables -from wo.core.fileutils import WOFileUtils -from pynginxconfig import NginxConfig -import os import configparser import glob +import os import signal +from cement.core import handler, hook +from cement.core.controller import CementBaseController, expose +from pynginxconfig import NginxConfig + +from wo.cli.plugins.site_functions import logwatch +from wo.core.aptget import WOAptGet +from wo.core.fileutils import WOFileUtils +from wo.core.logging import Log +from wo.core.mysql import WOMysql +from wo.core.services import WOService +from wo.core.shellexec import WOShellExec +from wo.core.variables import WOVariables + def wo_debug_hook(app): pass diff --git a/wo/cli/plugins/import_slow_log.py b/wo/cli/plugins/import_slow_log.py index 6e51b51..bc13ff8 100644 --- a/wo/cli/plugins/import_slow_log.py +++ b/wo/cli/plugins/import_slow_log.py @@ -1,5 +1,6 @@ -from cement.core.controller import CementBaseController, expose from cement.core import handler, hook +from cement.core.controller import CementBaseController, expose + from wo.core.logging import Log diff --git a/wo/cli/plugins/info.py b/wo/cli/plugins/info.py index efaf767..0a6a145 100644 --- a/wo/cli/plugins/info.py +++ b/wo/cli/plugins/info.py @@ -1,296 +1,298 @@ -"""WOInfo Plugin for WordOps""" - -from cement.core.controller import CementBaseController, expose -from cement.core import handler, hook -from pynginxconfig import NginxConfig -from wo.core.aptget import WOAptGet -from wo.core.shellexec import WOShellExec -from wo.core.logging import Log -import os -import configparser - - -def wo_info_hook(app): - pass - - -class WOInfoController(CementBaseController): - class Meta: - label = 'info' - stacked_on = 'base' - stacked_type = 'nested' - description = ('Display configuration information related to Nginx,' - ' PHP and MySQL') - arguments = [ - (['--mysql'], - dict(help='Get MySQL configuration information', - action='store_true')), - (['--php'], - dict(help='Get PHP 7.2 configuration information', - action='store_true')), - (['--php73'], - dict(help='Get PHP 7.3 configuration information', - action='store_true')), - (['--nginx'], - dict(help='Get Nginx configuration information', - action='store_true')), - ] - usage = "wo info [options]" - - @expose(hide=True) - def info_nginx(self): - """Display Nginx information""" - version = os.popen("/usr/sbin/nginx -v 2>&1 | " - "awk -F '/' '{print $2}' | " - "awk -F ' ' '{print $1}' | tr '\n' ' '").read() - allow = os.popen("grep ^allow /etc/nginx/common/acl.conf | " - "cut -d' ' -f2 | cut -d';' -f1 | tr '\n' ' '").read() - nc = NginxConfig() - nc.loadf('/etc/nginx/nginx.conf') - user = nc.get('user')[1] - worker_processes = nc.get('worker_processes')[1] - worker_connections = nc.get([('events',), 'worker_connections'])[1] - keepalive_timeout = nc.get([('http',), 'keepalive_timeout'])[1] - fastcgi_read_timeout = nc.get([('http',), - 'fastcgi_read_timeout'])[1] - client_max_body_size = nc.get([('http',), - 'client_max_body_size'])[1] - data = dict(version=version, allow=allow, user=user, - worker_processes=worker_processes, - keepalive_timeout=keepalive_timeout, - worker_connections=worker_connections, - fastcgi_read_timeout=fastcgi_read_timeout, - client_max_body_size=client_max_body_size) - self.app.render((data), 'info_nginx.mustache') - - @expose(hide=True) - def info_php(self): - """Display PHP information""" - version = os.popen("/usr/bin/php7.2 -v 2>/dev/null | " - "head -n1 | cut -d' ' -f2 |" - " cut -d'+' -f1 | tr -d '\n'").read - config = configparser.ConfigParser() - config.read('/etc/{0}/fpm/php.ini'.format("php/7.2")) - expose_php = config['PHP']['expose_php'] - memory_limit = config['PHP']['memory_limit'] - post_max_size = config['PHP']['post_max_size'] - upload_max_filesize = config['PHP']['upload_max_filesize'] - max_execution_time = config['PHP']['max_execution_time'] - - config.read('/etc/{0}/fpm/pool.d/www.conf'.format("php/7.2")) - www_listen = config['www']['listen'] - www_ping_path = config['www']['ping.path'] - www_pm_status_path = config['www']['pm.status_path'] - www_pm = config['www']['pm'] - www_pm_max_requests = config['www']['pm.max_requests'] - www_pm_max_children = config['www']['pm.max_children'] - www_pm_start_servers = config['www']['pm.start_servers'] - www_pm_min_spare_servers = config['www']['pm.min_spare_servers'] - www_pm_max_spare_servers = config['www']['pm.max_spare_servers'] - www_request_terminate_time = (config['www'] - ['request_terminate_timeout']) - try: - www_xdebug = (config['www']['php_admin_flag[xdebug.profiler_enable' - '_trigger]']) - except Exception as e: - Log.debug(self, "{0}".format(e)) - www_xdebug = 'off' - - config.read('/etc/{0}/fpm/pool.d/debug.conf'.format("php/7.2")) - debug_listen = config['debug']['listen'] - debug_ping_path = config['debug']['ping.path'] - debug_pm_status_path = config['debug']['pm.status_path'] - debug_pm = config['debug']['pm'] - debug_pm_max_requests = config['debug']['pm.max_requests'] - debug_pm_max_children = config['debug']['pm.max_children'] - debug_pm_start_servers = config['debug']['pm.start_servers'] - debug_pm_min_spare_servers = config['debug']['pm.min_spare_servers'] - debug_pm_max_spare_servers = config['debug']['pm.max_spare_servers'] - debug_request_terminate = (config['debug'] - ['request_terminate_timeout']) - try: - debug_xdebug = (config['debug']['php_admin_flag[xdebug.profiler_' - 'enable_trigger]']) - except Exception as e: - Log.debug(self, "{0}".format(e)) - debug_xdebug = 'off' - - data = dict(version=version, expose_php=expose_php, - memory_limit=memory_limit, post_max_size=post_max_size, - upload_max_filesize=upload_max_filesize, - max_execution_time=max_execution_time, - www_listen=www_listen, www_ping_path=www_ping_path, - www_pm_status_path=www_pm_status_path, www_pm=www_pm, - www_pm_max_requests=www_pm_max_requests, - www_pm_max_children=www_pm_max_children, - www_pm_start_servers=www_pm_start_servers, - www_pm_min_spare_servers=www_pm_min_spare_servers, - www_pm_max_spare_servers=www_pm_max_spare_servers, - www_request_terminate_timeout=www_request_terminate_time, - www_xdebug_profiler_enable_trigger=www_xdebug, - debug_listen=debug_listen, debug_ping_path=debug_ping_path, - debug_pm_status_path=debug_pm_status_path, - debug_pm=debug_pm, - debug_pm_max_requests=debug_pm_max_requests, - debug_pm_max_children=debug_pm_max_children, - debug_pm_start_servers=debug_pm_start_servers, - debug_pm_min_spare_servers=debug_pm_min_spare_servers, - debug_pm_max_spare_servers=debug_pm_max_spare_servers, - debug_request_terminate_timeout=debug_request_terminate, - debug_xdebug_profiler_enable_trigger=debug_xdebug) - self.app.render((data), 'info_php.mustache') - - @expose(hide=True) - def info_php73(self): - """Display PHP information""" - version = os.popen("/usr/bin/php7.3 -v 2>/dev/null | " - "head -n1 | cut -d' ' -f2 |" - " cut -d'+' -f1 | tr -d '\n'").read - config = configparser.ConfigParser() - config.read('/etc/php/7.3/fpm/php.ini') - expose_php = config['PHP']['expose_php'] - memory_limit = config['PHP']['memory_limit'] - post_max_size = config['PHP']['post_max_size'] - upload_max_filesize = config['PHP']['upload_max_filesize'] - max_execution_time = config['PHP']['max_execution_time'] - - config.read('/etc/php/7.3/fpm/pool.d/www.conf') - www_listen = config['www']['listen'] - www_ping_path = config['www']['ping.path'] - www_pm_status_path = config['www']['pm.status_path'] - www_pm = config['www']['pm'] - www_pm_max_requests = config['www']['pm.max_requests'] - www_pm_max_children = config['www']['pm.max_children'] - www_pm_start_servers = config['www']['pm.start_servers'] - www_pm_min_spare_servers = config['www']['pm.min_spare_servers'] - www_pm_max_spare_servers = config['www']['pm.max_spare_servers'] - www_request_terminate_time = (config['www'] - ['request_terminate_timeout']) - try: - www_xdebug = (config['www']['php_admin_flag[xdebug.profiler_enable' - '_trigger]']) - except Exception as e: - Log.debug(self, "{0}".format(e)) - www_xdebug = 'off' - - config.read('/etc/php/7.3/fpm/pool.d/debug.conf') - debug_listen = config['debug']['listen'] - debug_ping_path = config['debug']['ping.path'] - debug_pm_status_path = config['debug']['pm.status_path'] - debug_pm = config['debug']['pm'] - debug_pm_max_requests = config['debug']['pm.max_requests'] - debug_pm_max_children = config['debug']['pm.max_children'] - debug_pm_start_servers = config['debug']['pm.start_servers'] - debug_pm_min_spare_servers = config['debug']['pm.min_spare_servers'] - debug_pm_max_spare_servers = config['debug']['pm.max_spare_servers'] - debug_request_terminate = (config['debug'] - ['request_terminate_timeout']) - try: - debug_xdebug = (config['debug']['php_admin_flag[xdebug.profiler_' - 'enable_trigger]']) - except Exception as e: - Log.debug(self, "{0}".format(e)) - debug_xdebug = 'off' - - data = dict(version=version, expose_php=expose_php, - memory_limit=memory_limit, post_max_size=post_max_size, - upload_max_filesize=upload_max_filesize, - max_execution_time=max_execution_time, - www_listen=www_listen, www_ping_path=www_ping_path, - www_pm_status_path=www_pm_status_path, www_pm=www_pm, - www_pm_max_requests=www_pm_max_requests, - www_pm_max_children=www_pm_max_children, - www_pm_start_servers=www_pm_start_servers, - www_pm_min_spare_servers=www_pm_min_spare_servers, - www_pm_max_spare_servers=www_pm_max_spare_servers, - www_request_terminate_timeout=www_request_terminate_time, - www_xdebug_profiler_enable_trigger=www_xdebug, - debug_listen=debug_listen, debug_ping_path=debug_ping_path, - debug_pm_status_path=debug_pm_status_path, - debug_pm=debug_pm, - debug_pm_max_requests=debug_pm_max_requests, - debug_pm_max_children=debug_pm_max_children, - debug_pm_start_servers=debug_pm_start_servers, - debug_pm_min_spare_servers=debug_pm_min_spare_servers, - debug_pm_max_spare_servers=debug_pm_max_spare_servers, - debug_request_terminate_timeout=debug_request_terminate, - debug_xdebug_profiler_enable_trigger=debug_xdebug) - self.app.render((data), 'info_php.mustache') - - @expose(hide=True) - def info_mysql(self): - """Display MySQL information""" - version = os.popen("/usr/bin/mysql -V | awk '{print($5)}' | " - "cut -d ',' " - "-f1 | tr -d '\n'").read() - host = "localhost" - port = os.popen("/usr/bin/mysql -e \"show variables\" | " - "/bin/grep ^port | awk " - "'{print($2)}' | tr -d '\n'").read() - wait_timeout = os.popen("/usr/bin/mysql -e \"show variables\" | grep " - "^wait_timeout | awk '{print($2)}' | " - "tr -d '\n'").read() - interactive_timeout = os.popen("/usr/bin/mysql -e " - "\"show variables\" | grep " - "^interactive_timeout | awk " - "'{print($2)}' | tr -d '\n'").read() - max_used_connections = os.popen("/usr/bin/mysql -e " - "\"show global status\" | " - "grep Max_used_connections | awk " - "'{print($2)}' | tr -d '\n'").read() - datadir = os.popen("/usr/bin/mysql -e \"show variables\" | " - "/bin/grep datadir | awk" - " '{print($2)}' | tr -d '\n'").read() - socket = os.popen("/usr/bin/mysql -e \"show variables\" | " - "/bin/grep \"^socket\" | " - "awk '{print($2)}' | tr -d '\n'").read() - data = dict(version=version, host=host, port=port, - wait_timeout=wait_timeout, - interactive_timeout=interactive_timeout, - max_used_connections=max_used_connections, - datadir=datadir, socket=socket) - self.app.render((data), 'info_mysql.mustache') - - @expose(hide=True) - def default(self): - """default function for info""" - if (not self.app.pargs.nginx and not self.app.pargs.php and - not self.app.pargs.mysql and not self.app.pargs.php73): - self.app.pargs.nginx = True - self.app.pargs.php = True - self.app.pargs.mysql = True - if WOAptGet.is_installed(self, 'php7.3-fpm'): - self.app.pargs.php73 = True - - if self.app.pargs.nginx: - if (WOAptGet.is_installed(self, 'nginx-custom') or - WOAptGet.is_installed(self, 'nginx-wo')): - self.info_nginx() - else: - Log.error(self, "Nginx is not installed") - - if self.app.pargs.php: - if WOAptGet.is_installed(self, 'php7.2-fpm'): - self.info_php() - else: - Log.error(self, "PHP 7.2 is not installed") - - if self.app.pargs.php73: - if WOAptGet.is_installed(self, 'php7.3-fpm'): - self.info_php73() - else: - Log.error(self, "PHP 7.3 is not installed") - - if self.app.pargs.mysql: - if WOShellExec.cmd_exec(self, "/usr/bin/mysqladmin ping"): - self.info_mysql() - else: - Log.error(self, "MySQL is not installed") - - -def load(app): - # register the plugin class.. this only happens if the plugin is enabled - handler.register(WOInfoController) - - # register a hook (function) to run after arguments are parsed. - hook.register('post_argument_parsing', wo_info_hook) +"""WOInfo Plugin for WordOps""" + +import configparser +import os + +from cement.core import handler, hook +from cement.core.controller import CementBaseController, expose +from pynginxconfig import NginxConfig + +from wo.core.aptget import WOAptGet +from wo.core.logging import Log +from wo.core.shellexec import WOShellExec + + +def wo_info_hook(app): + pass + + +class WOInfoController(CementBaseController): + class Meta: + label = 'info' + stacked_on = 'base' + stacked_type = 'nested' + description = ('Display configuration information related to Nginx,' + ' PHP and MySQL') + arguments = [ + (['--mysql'], + dict(help='Get MySQL configuration information', + action='store_true')), + (['--php'], + dict(help='Get PHP 7.2 configuration information', + action='store_true')), + (['--php73'], + dict(help='Get PHP 7.3 configuration information', + action='store_true')), + (['--nginx'], + dict(help='Get Nginx configuration information', + action='store_true')), + ] + usage = "wo info [options]" + + @expose(hide=True) + def info_nginx(self): + """Display Nginx information""" + version = os.popen("/usr/sbin/nginx -v 2>&1 | " + "awk -F '/' '{print $2}' | " + "awk -F ' ' '{print $1}' | tr '\n' ' '").read() + allow = os.popen("grep ^allow /etc/nginx/common/acl.conf | " + "cut -d' ' -f2 | cut -d';' -f1 | tr '\n' ' '").read() + nc = NginxConfig() + nc.loadf('/etc/nginx/nginx.conf') + user = nc.get('user')[1] + worker_processes = nc.get('worker_processes')[1] + worker_connections = nc.get([('events',), 'worker_connections'])[1] + keepalive_timeout = nc.get([('http',), 'keepalive_timeout'])[1] + fastcgi_read_timeout = nc.get([('http',), + 'fastcgi_read_timeout'])[1] + client_max_body_size = nc.get([('http',), + 'client_max_body_size'])[1] + data = dict(version=version, allow=allow, user=user, + worker_processes=worker_processes, + keepalive_timeout=keepalive_timeout, + worker_connections=worker_connections, + fastcgi_read_timeout=fastcgi_read_timeout, + client_max_body_size=client_max_body_size) + self.app.render((data), 'info_nginx.mustache') + + @expose(hide=True) + def info_php(self): + """Display PHP information""" + version = os.popen("/usr/bin/php7.2 -v 2>/dev/null | " + "head -n1 | cut -d' ' -f2 |" + " cut -d'+' -f1 | tr -d '\n'").read + config = configparser.ConfigParser() + config.read('/etc/{0}/fpm/php.ini'.format("php/7.2")) + expose_php = config['PHP']['expose_php'] + memory_limit = config['PHP']['memory_limit'] + post_max_size = config['PHP']['post_max_size'] + upload_max_filesize = config['PHP']['upload_max_filesize'] + max_execution_time = config['PHP']['max_execution_time'] + + config.read('/etc/{0}/fpm/pool.d/www.conf'.format("php/7.2")) + www_listen = config['www']['listen'] + www_ping_path = config['www']['ping.path'] + www_pm_status_path = config['www']['pm.status_path'] + www_pm = config['www']['pm'] + www_pm_max_requests = config['www']['pm.max_requests'] + www_pm_max_children = config['www']['pm.max_children'] + www_pm_start_servers = config['www']['pm.start_servers'] + www_pm_min_spare_servers = config['www']['pm.min_spare_servers'] + www_pm_max_spare_servers = config['www']['pm.max_spare_servers'] + www_request_terminate_time = (config['www'] + ['request_terminate_timeout']) + try: + www_xdebug = (config['www']['php_admin_flag[xdebug.profiler_enable' + '_trigger]']) + except Exception as e: + Log.debug(self, "{0}".format(e)) + www_xdebug = 'off' + + config.read('/etc/{0}/fpm/pool.d/debug.conf'.format("php/7.2")) + debug_listen = config['debug']['listen'] + debug_ping_path = config['debug']['ping.path'] + debug_pm_status_path = config['debug']['pm.status_path'] + debug_pm = config['debug']['pm'] + debug_pm_max_requests = config['debug']['pm.max_requests'] + debug_pm_max_children = config['debug']['pm.max_children'] + debug_pm_start_servers = config['debug']['pm.start_servers'] + debug_pm_min_spare_servers = config['debug']['pm.min_spare_servers'] + debug_pm_max_spare_servers = config['debug']['pm.max_spare_servers'] + debug_request_terminate = (config['debug'] + ['request_terminate_timeout']) + try: + debug_xdebug = (config['debug']['php_admin_flag[xdebug.profiler_' + 'enable_trigger]']) + except Exception as e: + Log.debug(self, "{0}".format(e)) + debug_xdebug = 'off' + + data = dict(version=version, expose_php=expose_php, + memory_limit=memory_limit, post_max_size=post_max_size, + upload_max_filesize=upload_max_filesize, + max_execution_time=max_execution_time, + www_listen=www_listen, www_ping_path=www_ping_path, + www_pm_status_path=www_pm_status_path, www_pm=www_pm, + www_pm_max_requests=www_pm_max_requests, + www_pm_max_children=www_pm_max_children, + www_pm_start_servers=www_pm_start_servers, + www_pm_min_spare_servers=www_pm_min_spare_servers, + www_pm_max_spare_servers=www_pm_max_spare_servers, + www_request_terminate_timeout=www_request_terminate_time, + www_xdebug_profiler_enable_trigger=www_xdebug, + debug_listen=debug_listen, debug_ping_path=debug_ping_path, + debug_pm_status_path=debug_pm_status_path, + debug_pm=debug_pm, + debug_pm_max_requests=debug_pm_max_requests, + debug_pm_max_children=debug_pm_max_children, + debug_pm_start_servers=debug_pm_start_servers, + debug_pm_min_spare_servers=debug_pm_min_spare_servers, + debug_pm_max_spare_servers=debug_pm_max_spare_servers, + debug_request_terminate_timeout=debug_request_terminate, + debug_xdebug_profiler_enable_trigger=debug_xdebug) + self.app.render((data), 'info_php.mustache') + + @expose(hide=True) + def info_php73(self): + """Display PHP information""" + version = os.popen("/usr/bin/php7.3 -v 2>/dev/null | " + "head -n1 | cut -d' ' -f2 |" + " cut -d'+' -f1 | tr -d '\n'").read + config = configparser.ConfigParser() + config.read('/etc/php/7.3/fpm/php.ini') + expose_php = config['PHP']['expose_php'] + memory_limit = config['PHP']['memory_limit'] + post_max_size = config['PHP']['post_max_size'] + upload_max_filesize = config['PHP']['upload_max_filesize'] + max_execution_time = config['PHP']['max_execution_time'] + + config.read('/etc/php/7.3/fpm/pool.d/www.conf') + www_listen = config['www']['listen'] + www_ping_path = config['www']['ping.path'] + www_pm_status_path = config['www']['pm.status_path'] + www_pm = config['www']['pm'] + www_pm_max_requests = config['www']['pm.max_requests'] + www_pm_max_children = config['www']['pm.max_children'] + www_pm_start_servers = config['www']['pm.start_servers'] + www_pm_min_spare_servers = config['www']['pm.min_spare_servers'] + www_pm_max_spare_servers = config['www']['pm.max_spare_servers'] + www_request_terminate_time = (config['www'] + ['request_terminate_timeout']) + try: + www_xdebug = (config['www']['php_admin_flag[xdebug.profiler_enable' + '_trigger]']) + except Exception as e: + Log.debug(self, "{0}".format(e)) + www_xdebug = 'off' + + config.read('/etc/php/7.3/fpm/pool.d/debug.conf') + debug_listen = config['debug']['listen'] + debug_ping_path = config['debug']['ping.path'] + debug_pm_status_path = config['debug']['pm.status_path'] + debug_pm = config['debug']['pm'] + debug_pm_max_requests = config['debug']['pm.max_requests'] + debug_pm_max_children = config['debug']['pm.max_children'] + debug_pm_start_servers = config['debug']['pm.start_servers'] + debug_pm_min_spare_servers = config['debug']['pm.min_spare_servers'] + debug_pm_max_spare_servers = config['debug']['pm.max_spare_servers'] + debug_request_terminate = (config['debug'] + ['request_terminate_timeout']) + try: + debug_xdebug = (config['debug']['php_admin_flag[xdebug.profiler_' + 'enable_trigger]']) + except Exception as e: + Log.debug(self, "{0}".format(e)) + debug_xdebug = 'off' + + data = dict(version=version, expose_php=expose_php, + memory_limit=memory_limit, post_max_size=post_max_size, + upload_max_filesize=upload_max_filesize, + max_execution_time=max_execution_time, + www_listen=www_listen, www_ping_path=www_ping_path, + www_pm_status_path=www_pm_status_path, www_pm=www_pm, + www_pm_max_requests=www_pm_max_requests, + www_pm_max_children=www_pm_max_children, + www_pm_start_servers=www_pm_start_servers, + www_pm_min_spare_servers=www_pm_min_spare_servers, + www_pm_max_spare_servers=www_pm_max_spare_servers, + www_request_terminate_timeout=www_request_terminate_time, + www_xdebug_profiler_enable_trigger=www_xdebug, + debug_listen=debug_listen, debug_ping_path=debug_ping_path, + debug_pm_status_path=debug_pm_status_path, + debug_pm=debug_pm, + debug_pm_max_requests=debug_pm_max_requests, + debug_pm_max_children=debug_pm_max_children, + debug_pm_start_servers=debug_pm_start_servers, + debug_pm_min_spare_servers=debug_pm_min_spare_servers, + debug_pm_max_spare_servers=debug_pm_max_spare_servers, + debug_request_terminate_timeout=debug_request_terminate, + debug_xdebug_profiler_enable_trigger=debug_xdebug) + self.app.render((data), 'info_php.mustache') + + @expose(hide=True) + def info_mysql(self): + """Display MySQL information""" + version = os.popen("/usr/bin/mysql -V | awk '{print($5)}' | " + "cut -d ',' " + "-f1 | tr -d '\n'").read() + host = "localhost" + port = os.popen("/usr/bin/mysql -e \"show variables\" | " + "/bin/grep ^port | awk " + "'{print($2)}' | tr -d '\n'").read() + wait_timeout = os.popen("/usr/bin/mysql -e \"show variables\" | grep " + "^wait_timeout | awk '{print($2)}' | " + "tr -d '\n'").read() + interactive_timeout = os.popen("/usr/bin/mysql -e " + "\"show variables\" | grep " + "^interactive_timeout | awk " + "'{print($2)}' | tr -d '\n'").read() + max_used_connections = os.popen("/usr/bin/mysql -e " + "\"show global status\" | " + "grep Max_used_connections | awk " + "'{print($2)}' | tr -d '\n'").read() + datadir = os.popen("/usr/bin/mysql -e \"show variables\" | " + "/bin/grep datadir | awk" + " '{print($2)}' | tr -d '\n'").read() + socket = os.popen("/usr/bin/mysql -e \"show variables\" | " + "/bin/grep \"^socket\" | " + "awk '{print($2)}' | tr -d '\n'").read() + data = dict(version=version, host=host, port=port, + wait_timeout=wait_timeout, + interactive_timeout=interactive_timeout, + max_used_connections=max_used_connections, + datadir=datadir, socket=socket) + self.app.render((data), 'info_mysql.mustache') + + @expose(hide=True) + def default(self): + """default function for info""" + if (not self.app.pargs.nginx and not self.app.pargs.php and + not self.app.pargs.mysql and not self.app.pargs.php73): + self.app.pargs.nginx = True + self.app.pargs.php = True + self.app.pargs.mysql = True + if WOAptGet.is_installed(self, 'php7.3-fpm'): + self.app.pargs.php73 = True + + if self.app.pargs.nginx: + if (WOAptGet.is_installed(self, 'nginx-custom') or + WOAptGet.is_installed(self, 'nginx-wo')): + self.info_nginx() + else: + Log.error(self, "Nginx is not installed") + + if self.app.pargs.php: + if WOAptGet.is_installed(self, 'php7.2-fpm'): + self.info_php() + else: + Log.error(self, "PHP 7.2 is not installed") + + if self.app.pargs.php73: + if WOAptGet.is_installed(self, 'php7.3-fpm'): + self.info_php73() + else: + Log.error(self, "PHP 7.3 is not installed") + + if self.app.pargs.mysql: + if WOShellExec.cmd_exec(self, "/usr/bin/mysqladmin ping"): + self.info_mysql() + else: + Log.error(self, "MySQL is not installed") + + +def load(app): + # register the plugin class.. this only happens if the plugin is enabled + handler.register(WOInfoController) + + # register a hook (function) to run after arguments are parsed. + hook.register('post_argument_parsing', wo_info_hook) diff --git a/wo/cli/plugins/log.py b/wo/cli/plugins/log.py index d080368..d2d2fe3 100644 --- a/wo/cli/plugins/log.py +++ b/wo/cli/plugins/log.py @@ -6,6 +6,7 @@ import os from cement.core import handler, hook from cement.core.controller import CementBaseController, expose + from wo.cli.plugins.site_functions import logwatch from wo.core.fileutils import WOFileUtils from wo.core.logging import Log diff --git a/wo/cli/plugins/maintenance.py b/wo/cli/plugins/maintenance.py index ad65841..8d45967 100644 --- a/wo/cli/plugins/maintenance.py +++ b/wo/cli/plugins/maintenance.py @@ -2,6 +2,7 @@ from cement.core import handler, hook from cement.core.controller import CementBaseController, expose + from wo.core.aptget import WOAptGet from wo.core.logging import Log diff --git a/wo/cli/plugins/models.py b/wo/cli/plugins/models.py index a609c67..382aab7 100644 --- a/wo/cli/plugins/models.py +++ b/wo/cli/plugins/models.py @@ -1,4 +1,5 @@ -from sqlalchemy import Column, DateTime, String, Integer, Boolean, func +from sqlalchemy import Boolean, Column, DateTime, Integer, String, func + from wo.core.database import Base diff --git a/wo/cli/plugins/secure.py b/wo/cli/plugins/secure.py index 119a31b..e8ca67e 100644 --- a/wo/cli/plugins/secure.py +++ b/wo/cli/plugins/secure.py @@ -1,13 +1,15 @@ -from cement.core.controller import CementBaseController, expose +import getpass +import random +import string + from cement.core import handler, hook +from cement.core.controller import CementBaseController, expose + +from wo.core.git import WOGit +from wo.core.logging import Log +from wo.core.services import WOService from wo.core.shellexec import WOShellExec from wo.core.variables import WOVariables -from wo.core.logging import Log -from wo.core.git import WOGit -from wo.core.services import WOService -import string -import random -import getpass def wo_secure_hook(app): diff --git a/wo/cli/plugins/site.py b/wo/cli/plugins/site.py index 5d420cc..2050fad 100644 --- a/wo/cli/plugins/site.py +++ b/wo/cli/plugins/site.py @@ -10,7 +10,7 @@ from cement.core.controller import CementBaseController, expose from wo.cli.plugins.site_functions import * from wo.cli.plugins.sitedb import (addNewSite, deleteSiteInfo, getAllsites, getSiteInfo, updateSiteInfo) -from wo.core.domainvalidate import GetDomainlevel, ValidateDomain +from wo.core.domainvalidate import DMN from wo.core.fileutils import WOFileUtils from wo.core.git import WOGit from wo.core.logging import Log @@ -57,7 +57,7 @@ class WOSiteController(CementBaseController): pargs.site_name = pargs.site_name.strip() # validate domain name - (wo_domain, wo_www_domain) = ValidateDomain(pargs.site_name) + (wo_domain, wo_www_domain) = DMN.validatedomain(self, pargs.site_name) # check if site exists if not check_domain_exists(self, wo_domain): @@ -94,7 +94,7 @@ class WOSiteController(CementBaseController): Log.debug(self, str(e)) Log.error(self, 'could not input site name') pargs.site_name = pargs.site_name.strip() - (wo_domain, wo_www_domain) = ValidateDomain(pargs.site_name) + (wo_domain, wo_www_domain) = DMN.validatedomain(self, pargs.site_name) # check if site exists if not check_domain_exists(self, wo_domain): Log.error(self, "site {0} does not exist".format(wo_domain)) @@ -134,8 +134,8 @@ class WOSiteController(CementBaseController): Log.debug(self, str(e)) Log.error(self, 'could not input site name') pargs.site_name = pargs.site_name.strip() - (wo_domain, wo_www_domain) = ValidateDomain(pargs.site_name) - (wo_domain_type, wo_root_domain) = GetDomainlevel(wo_domain) + (wo_domain, wo_www_domain) = DMN.validatedomain(self, pargs.site_name) + (wo_domain_type, wo_root_domain) = DMN.getdomainlevel(self, wo_domain) wo_db_name = '' wo_db_user = '' wo_db_pass = '' @@ -186,7 +186,7 @@ class WOSiteController(CementBaseController): def log(self): pargs = self.app.pargs pargs.site_name = pargs.site_name.strip() - (wo_domain, wo_www_domain) = ValidateDomain(pargs.site_name) + (wo_domain, wo_www_domain) = DMN.validatedomain(self, pargs.site_name) wo_site_webroot = getSiteInfo(self, wo_domain).site_path if not check_domain_exists(self, wo_domain): @@ -208,7 +208,7 @@ class WOSiteController(CementBaseController): Log.error(self, 'could not input site name') # TODO Write code for wo site edit command here pargs.site_name = pargs.site_name.strip() - (wo_domain, wo_www_domain) = ValidateDomain(pargs.site_name) + (wo_domain, wo_www_domain) = DMN.validatedomain(self, pargs.site_name) if not check_domain_exists(self, wo_domain): Log.error(self, "site {0} does not exist".format(wo_domain)) @@ -239,7 +239,7 @@ class WOSiteController(CementBaseController): Log.error(self, 'Unable to read input, please try again') pargs.site_name = pargs.site_name.strip() - (wo_domain, wo_www_domain) = ValidateDomain(pargs.site_name) + (wo_domain, wo_www_domain) = DMN.validatedomain(self, pargs.site_name) if not check_domain_exists(self, wo_domain): Log.error(self, "site {0} does not exist".format(wo_domain)) @@ -280,7 +280,7 @@ class WOSiteEditController(CementBaseController): Log.error(self, 'Unable to read input, Please try again') pargs.site_name = pargs.site_name.strip() - (wo_domain, wo_www_domain) = ValidateDomain(pargs.site_name) + (wo_domain, wo_www_domain) = DMN.validatedomain(self, pargs.site_name) if not check_domain_exists(self, wo_domain): Log.error(self, "site {0} does not exist".format(wo_domain)) @@ -425,7 +425,7 @@ class WOSiteCreateController(CementBaseController): Log.error(self, "Unable to input site name, Please try again!") pargs.site_name = pargs.site_name.strip() - (wo_domain, wo_www_domain) = ValidateDomain(pargs.site_name) + (wo_domain, wo_www_domain) = DMN.validatedomain(self, pargs.site_name) if not wo_domain.strip(): Log.error(self, "Invalid domain name, " "Provide valid domain name") @@ -718,7 +718,7 @@ class WOSiteCreateController(CementBaseController): "`tail /var/log/wo/wordops.log` and please try again") if pargs.letsencrypt: - (wo_domain_type, wo_root_domain) = GetDomainlevel(wo_domain) + (wo_domain_type, wo_root_domain) = DMN.getdomainlevel(self, wo_domain) data['letsencrypt'] = True letsencrypt = True if data['letsencrypt'] is True: @@ -931,7 +931,7 @@ class WOSiteUpdateController(CementBaseController): Log.error(self, 'Unable to input site name, Please try again!') pargs.site_name = pargs.site_name.strip() - (wo_domain, wo_www_domain) = ValidateDomain(pargs.site_name) + (wo_domain, wo_www_domain) = DMN.validatedomain(self, pargs.site_name) wo_site_webroot = WOVariables.wo_webroot + wo_domain check_site = getSiteInfo(self, wo_domain) @@ -1129,7 +1129,7 @@ class WOSiteUpdateController(CementBaseController): pargs.php73 = False if pargs.letsencrypt: - (wo_domain_type, wo_root_domain) = GetDomainlevel(wo_domain) + (wo_domain_type, wo_root_domain) = DMN.getdomainlevel(self, wo_domain) if pargs.letsencrypt == 'on': data['letsencrypt'] = True letsencrypt = True @@ -1858,7 +1858,7 @@ class WOSiteDeleteController(CementBaseController): Log.error(self, 'could not input site name') pargs.site_name = pargs.site_name.strip() - (wo_domain, wo_www_domain) = ValidateDomain(pargs.site_name) + (wo_domain, wo_www_domain) = DMN.validatedomain(self, pargs.site_name) wo_db_name = '' wo_prompt = '' wo_nginx_prompt = '' diff --git a/wo/cli/plugins/site_functions.py b/wo/cli/plugins/site_functions.py index 7afdc8a..80bbb1a 100644 --- a/wo/cli/plugins/site_functions.py +++ b/wo/cli/plugins/site_functions.py @@ -1,8 +1,8 @@ import getpass import glob +import json import os import random -import json import re import string import subprocess @@ -10,13 +10,13 @@ from subprocess import CalledProcessError from wo.cli.plugins.sitedb import getSiteInfo from wo.cli.plugins.stack import WOStackController +from wo.cli.plugins.stack_pref import post_pref from wo.core.aptget import WOAptGet from wo.core.fileutils import WOFileUtils from wo.core.git import WOGit from wo.core.logging import Log from wo.core.mysql import WOMysql from wo.core.services import WOService -from wo.cli.plugins.stack_pref import post_pref from wo.core.shellexec import CommandExecutionError, WOShellExec from wo.core.sslutils import SSL from wo.core.variables import WOVariables diff --git a/wo/cli/plugins/sitedb.py b/wo/cli/plugins/sitedb.py index 9e21e13..2ed7aa2 100644 --- a/wo/cli/plugins/sitedb.py +++ b/wo/cli/plugins/sitedb.py @@ -1,10 +1,11 @@ -from sqlalchemy import Column, DateTime, String, Integer, Boolean -from sqlalchemy import ForeignKey, func -from sqlalchemy.orm import relationship, backref +from sqlalchemy import (Boolean, Column, DateTime, ForeignKey, Integer, String, + func) from sqlalchemy.ext.declarative import declarative_base -from wo.core.logging import Log -from wo.core.database import db_session +from sqlalchemy.orm import backref, relationship + from wo.cli.plugins.models import SiteDB +from wo.core.database import db_session +from wo.core.logging import Log def addNewSite(self, site, stype, cache, path, diff --git a/wo/cli/plugins/stack_pref.py b/wo/cli/plugins/stack_pref.py index 0e61cf7..b131c13 100644 --- a/wo/cli/plugins/stack_pref.py +++ b/wo/cli/plugins/stack_pref.py @@ -14,7 +14,6 @@ from wo.core.apt_repo import WORepo from wo.core.aptget import WOAptGet from wo.core.checkfqdn import check_fqdn_ip from wo.core.cron import WOCron -from wo.core.domainvalidate import GetDomainlevel from wo.core.extract import WOExtract from wo.core.fileutils import WOFileUtils from wo.core.git import WOGit diff --git a/wo/cli/plugins/stack_services.py b/wo/cli/plugins/stack_services.py index 695ee1d..0fd60ee 100644 --- a/wo/cli/plugins/stack_services.py +++ b/wo/cli/plugins/stack_services.py @@ -2,6 +2,7 @@ import os from cement.core import handler, hook from cement.core.controller import CementBaseController, expose + from wo.core.aptget import WOAptGet from wo.core.logging import Log from wo.core.services import WOService diff --git a/wo/cli/plugins/stack_upgrade.py b/wo/cli/plugins/stack_upgrade.py index ebe8284..1f6e2b2 100644 --- a/wo/cli/plugins/stack_upgrade.py +++ b/wo/cli/plugins/stack_upgrade.py @@ -3,6 +3,7 @@ import shutil from cement.core import handler, hook from cement.core.controller import CementBaseController, expose + from wo.cli.plugins.stack_pref import post_pref, pre_pref from wo.core.aptget import WOAptGet from wo.core.download import WODownload diff --git a/wo/cli/plugins/sync.py b/wo/cli/plugins/sync.py index 5039a03..b2f1d91 100644 --- a/wo/cli/plugins/sync.py +++ b/wo/cli/plugins/sync.py @@ -2,6 +2,7 @@ import glob from cement.core import handler, hook from cement.core.controller import CementBaseController, expose + from wo.cli.plugins.sitedb import getAllsites, updateSiteInfo from wo.core.fileutils import WOFileUtils from wo.core.logging import Log diff --git a/wo/cli/plugins/update.py b/wo/cli/plugins/update.py index d9f557d..0372853 100644 --- a/wo/cli/plugins/update.py +++ b/wo/cli/plugins/update.py @@ -3,6 +3,7 @@ import time from cement.core import handler, hook from cement.core.controller import CementBaseController, expose + from wo.core.download import WODownload from wo.core.logging import Log diff --git a/wo/core/addswap.py b/wo/core/addswap.py index ad0c14c..04dcfd1 100644 --- a/wo/core/addswap.py +++ b/wo/core/addswap.py @@ -1,11 +1,13 @@ """WordOps Swap Creation""" -from wo.core.shellexec import WOShellExec -from wo.core.fileutils import WOFileUtils -from wo.core.aptget import WOAptGet -from wo.core.logging import Log import os + import psutil +from wo.core.aptget import WOAptGet +from wo.core.fileutils import WOFileUtils +from wo.core.logging import Log +from wo.core.shellexec import WOShellExec + class WOSwap(): """Manage Swap""" diff --git a/wo/core/apt_repo.py b/wo/core/apt_repo.py index 44f53df..1715639 100644 --- a/wo/core/apt_repo.py +++ b/wo/core/apt_repo.py @@ -1,8 +1,9 @@ """WordOps packages repository operations""" +import os + +from wo.core.logging import Log from wo.core.shellexec import WOShellExec from wo.core.variables import WOVariables -from wo.core.logging import Log -import os class WORepo(): diff --git a/wo/core/aptget.py b/wo/core/aptget.py index 3e3fe53..3bff57e 100644 --- a/wo/core/aptget.py +++ b/wo/core/aptget.py @@ -1,11 +1,12 @@ """WordOps package installation using apt-get module.""" -import apt -import sys import subprocess -from wo.core.logging import Log +import sys + +from sh import ErrorReturnCode, apt_get + +import apt from wo.core.apt_repo import WORepo -from sh import apt_get -from sh import ErrorReturnCode +from wo.core.logging import Log class WOAptGet(): diff --git a/wo/core/checkfqdn.py b/wo/core/checkfqdn.py index 933c020..8b240f8 100644 --- a/wo/core/checkfqdn.py +++ b/wo/core/checkfqdn.py @@ -1,6 +1,7 @@ +import requests + from wo.core.shellexec import WOShellExec from wo.core.variables import WOVariables -import requests def check_fqdn(self, wo_host): diff --git a/wo/core/cron.py b/wo/core/cron.py index fd4ec70..adfabf7 100644 --- a/wo/core/cron.py +++ b/wo/core/cron.py @@ -1,5 +1,6 @@ -from wo.core.shellexec import WOShellExec from wo.core.logging import Log +from wo.core.shellexec import WOShellExec + """ Set CRON on LINUX system. diff --git a/wo/core/domainvalidate.py b/wo/core/domainvalidate.py index 667fc21..a787480 100644 --- a/wo/core/domainvalidate.py +++ b/wo/core/domainvalidate.py @@ -3,49 +3,50 @@ import os from urllib.parse import urlparse -def ValidateDomain(url): - """ - This function returns domain name removing http:// and https:// - returns domain name only with or without www as user provided. - """ +class DOMN: - # Check if http:// or https:// present remove it if present - domain_name = url.split('/') - if 'http:' in domain_name or 'https:' in domain_name: - domain_name = domain_name[2] - else: - domain_name = domain_name[0] - www_domain_name = domain_name.split('.') - final_domain = '' - if www_domain_name[0] == 'www': - final_domain = '.'.join(www_domain_name[1:]) - else: - final_domain = domain_name + def validatedomain(self, url): + """ + This function returns domain name removing http:// and https:// + returns domain name only with or without www as user provided. + """ - return (final_domain, domain_name) + # Check if http:// or https:// present remove it if present + domain_name = url.split('/') + if 'http:' in domain_name or 'https:' in domain_name: + domain_name = domain_name[2] + else: + domain_name = domain_name[0] + www_domain_name = domain_name.split('.') + final_domain = '' + if www_domain_name[0] == 'www': + final_domain = '.'.join(www_domain_name[1:]) + else: + final_domain = domain_name + return (final_domain, domain_name) -def GetDomainlevel(domain): - """ - This function returns the domain type : domain, subdomain, - """ - domain_name = domain.lower().strip().split('.') - if domain_name[0] == 'www': - domain_name = domain_name[1:] - domain_type = '' - if os.path.isfile("/var/lib/wo/public_suffix_list.dat"): - # Read mode opens a file for reading only. - suffix_file = open( - "/var/lib/wo/public_suffix_list.dat", encoding='utf-8', ) - # Read all the lines into a list. - for domain_suffix in suffix_file: - if (str(domain_suffix).strip()) == ('.'.join(domain_name[1:])): - domain_type = 'domain' - root_domain = ('.'.join(domain_name[0:])) - break - else: - domain_type = 'subdomain' - root_domain = ('.'.join(domain_name[1:])) - suffix_file.close() + def getdomainlevel(self, domain): + """ + This function returns the domain type : domain, subdomain, + """ + domain_name = domain.lower().strip().split('.') + if domain_name[0] == 'www': + domain_name = domain_name[1:] + domain_type = '' + if os.path.isfile("/var/lib/wo/public_suffix_list.dat"): + # Read mode opens a file for reading only. + suffix_file = open( + "/var/lib/wo/public_suffix_list.dat", encoding='utf-8', ) + # Read all the lines into a list. + for domain_suffix in suffix_file: + if (str(domain_suffix).strip()) == ('.'.join(domain_name[1:])): + domain_type = 'domain' + root_domain = ('.'.join(domain_name[0:])) + break + else: + domain_type = 'subdomain' + root_domain = ('.'.join(domain_name[1:])) + suffix_file.close() - return (domain_type, root_domain) + return (domain_type, root_domain) diff --git a/wo/core/download.py b/wo/core/download.py index d81b277..53abbfd 100644 --- a/wo/core/download.py +++ b/wo/core/download.py @@ -1,7 +1,8 @@ """WordOps download core classes.""" -import urllib.request -import urllib.error import os +import urllib.error +import urllib.request + from wo.core.logging import Log diff --git a/wo/core/extract.py b/wo/core/extract.py index 0564b9b..2effab0 100644 --- a/wo/core/extract.py +++ b/wo/core/extract.py @@ -1,6 +1,7 @@ """WordOps Extract Core """ -import tarfile import os +import tarfile + from wo.core.logging import Log diff --git a/wo/core/fileutils.py b/wo/core/fileutils.py index cf44ab3..0cf8bcb 100644 --- a/wo/core/fileutils.py +++ b/wo/core/fileutils.py @@ -1,8 +1,9 @@ """WordOps file utils core classes.""" -import shutil +import fileinput import os import pwd -import fileinput +import shutil + from wo.core.logging import Log diff --git a/wo/core/git.py b/wo/core/git.py index 32f919e..96a9638 100644 --- a/wo/core/git.py +++ b/wo/core/git.py @@ -1,8 +1,10 @@ """WordOps GIT module""" -from sh import git, ErrorReturnCode -from wo.core.logging import Log import os +from sh import ErrorReturnCode, git + +from wo.core.logging import Log + class WOGit: """Intialization of core variables""" diff --git a/wo/core/logwatch.py b/wo/core/logwatch.py index 6440bdd..0d51440 100644 --- a/wo/core/logwatch.py +++ b/wo/core/logwatch.py @@ -3,10 +3,11 @@ Real time log files watcher supporting log rotation. """ -import os -import time import errno +import os import stat +import time + from wo.core.logging import Log diff --git a/wo/core/mysql.py b/wo/core/mysql.py index e168e85..2e962b6 100644 --- a/wo/core/mysql.py +++ b/wo/core/mysql.py @@ -1,8 +1,10 @@ """WordOps MySQL core classes.""" -import pymysql -from pymysql import connections, DatabaseError, Error -from os.path import expanduser import os +from os.path import expanduser + +import pymysql +from pymysql import DatabaseError, Error, connections + from wo.core.logging import Log from wo.core.variables import WOVariables diff --git a/wo/core/nginxhashbucket.py b/wo/core/nginxhashbucket.py index 921fe1f..9145812 100644 --- a/wo/core/nginxhashbucket.py +++ b/wo/core/nginxhashbucket.py @@ -1,10 +1,11 @@ """WordOps Hash Bucket Calculator""" -from wo.core.fileutils import WOFileUtils +import fileinput import math import os -import fileinput import subprocess +from wo.core.fileutils import WOFileUtils + def hashbucket(self): # Check Nginx Hashbucket error diff --git a/wo/core/sendmail.py b/wo/core/sendmail.py index 59c330f..9a60602 100644 --- a/wo/core/sendmail.py +++ b/wo/core/sendmail.py @@ -1,10 +1,10 @@ -import smtplib import os -from email.mime.multipart import MIMEMultipart +import smtplib +from email import encoders from email.mime.base import MIMEBase +from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from email.utils import COMMASPACE, formatdate -from email import encoders def WOSendMail(send_from, send_to, subject, text, files, server="localhost", diff --git a/wo/core/services.py b/wo/core/services.py index 350a84a..5d4a1bd 100644 --- a/wo/core/services.py +++ b/wo/core/services.py @@ -1,5 +1,6 @@ """WordOps Service Manager""" import subprocess + from wo.core.logging import Log diff --git a/wo/core/shellexec.py b/wo/core/shellexec.py index 9cfd191..979affb 100644 --- a/wo/core/shellexec.py +++ b/wo/core/shellexec.py @@ -1,7 +1,8 @@ """WordOps Shell Functions""" -from wo.core.logging import Log import subprocess +from wo.core.logging import Log + class CommandExecutionError(Exception): """custom Exception for command execution""" diff --git a/wo/core/template.py b/wo/core/template.py index a4057d9..0d50224 100644 --- a/wo/core/template.py +++ b/wo/core/template.py @@ -1,6 +1,8 @@ -from wo.core.logging import Log import os +from wo.core.logging import Log + + """ Render Templates """ diff --git a/wo/core/variables.py b/wo/core/variables.py index 96563b8..10349b5 100644 --- a/wo/core/variables.py +++ b/wo/core/variables.py @@ -1,9 +1,10 @@ """WordOps core variable module""" -import distro -import socket import configparser -import os import datetime +import os +import socket + +import distro class WOVariables():