Sort import, create class DMN
This commit is contained in:
@@ -1,14 +1,16 @@
|
|||||||
"""Clean Plugin for WordOps."""
|
"""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 os
|
||||||
import urllib.request
|
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):
|
def wo_clean_hook(app):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -1,21 +1,23 @@
|
|||||||
"""Debug Plugin for WordOps"""
|
"""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 configparser
|
||||||
import glob
|
import glob
|
||||||
|
import os
|
||||||
import signal
|
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):
|
def wo_debug_hook(app):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
from cement.core.controller import CementBaseController, expose
|
|
||||||
from cement.core import handler, hook
|
from cement.core import handler, hook
|
||||||
|
from cement.core.controller import CementBaseController, expose
|
||||||
|
|
||||||
from wo.core.logging import Log
|
from wo.core.logging import Log
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
"""WOInfo Plugin for WordOps"""
|
"""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
|
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):
|
def wo_info_hook(app):
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import os
|
|||||||
|
|
||||||
from cement.core import handler, hook
|
from cement.core import handler, hook
|
||||||
from cement.core.controller import CementBaseController, expose
|
from cement.core.controller import CementBaseController, expose
|
||||||
|
|
||||||
from wo.cli.plugins.site_functions import logwatch
|
from wo.cli.plugins.site_functions import logwatch
|
||||||
from wo.core.fileutils import WOFileUtils
|
from wo.core.fileutils import WOFileUtils
|
||||||
from wo.core.logging import Log
|
from wo.core.logging import Log
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
from cement.core import handler, hook
|
from cement.core import handler, hook
|
||||||
from cement.core.controller import CementBaseController, expose
|
from cement.core.controller import CementBaseController, expose
|
||||||
|
|
||||||
from wo.core.aptget import WOAptGet
|
from wo.core.aptget import WOAptGet
|
||||||
from wo.core.logging import Log
|
from wo.core.logging import Log
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
from wo.core.database import Base
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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 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.shellexec import WOShellExec
|
||||||
from wo.core.variables import WOVariables
|
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):
|
def wo_secure_hook(app):
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ from cement.core.controller import CementBaseController, expose
|
|||||||
from wo.cli.plugins.site_functions import *
|
from wo.cli.plugins.site_functions import *
|
||||||
from wo.cli.plugins.sitedb import (addNewSite, deleteSiteInfo, getAllsites,
|
from wo.cli.plugins.sitedb import (addNewSite, deleteSiteInfo, getAllsites,
|
||||||
getSiteInfo, updateSiteInfo)
|
getSiteInfo, updateSiteInfo)
|
||||||
from wo.core.domainvalidate import GetDomainlevel, ValidateDomain
|
from wo.core.domainvalidate import DMN
|
||||||
from wo.core.fileutils import WOFileUtils
|
from wo.core.fileutils import WOFileUtils
|
||||||
from wo.core.git import WOGit
|
from wo.core.git import WOGit
|
||||||
from wo.core.logging import Log
|
from wo.core.logging import Log
|
||||||
@@ -57,7 +57,7 @@ class WOSiteController(CementBaseController):
|
|||||||
|
|
||||||
pargs.site_name = pargs.site_name.strip()
|
pargs.site_name = pargs.site_name.strip()
|
||||||
# validate domain name
|
# 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
|
# check if site exists
|
||||||
if not check_domain_exists(self, wo_domain):
|
if not check_domain_exists(self, wo_domain):
|
||||||
@@ -94,7 +94,7 @@ class WOSiteController(CementBaseController):
|
|||||||
Log.debug(self, str(e))
|
Log.debug(self, str(e))
|
||||||
Log.error(self, 'could not input site name')
|
Log.error(self, 'could not input site name')
|
||||||
pargs.site_name = pargs.site_name.strip()
|
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
|
# check if site exists
|
||||||
if not check_domain_exists(self, wo_domain):
|
if not check_domain_exists(self, wo_domain):
|
||||||
Log.error(self, "site {0} does not exist".format(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.debug(self, str(e))
|
||||||
Log.error(self, 'could not input site name')
|
Log.error(self, 'could not input site name')
|
||||||
pargs.site_name = pargs.site_name.strip()
|
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_domain_type, wo_root_domain) = GetDomainlevel(wo_domain)
|
(wo_domain_type, wo_root_domain) = DMN.getdomainlevel(self, wo_domain)
|
||||||
wo_db_name = ''
|
wo_db_name = ''
|
||||||
wo_db_user = ''
|
wo_db_user = ''
|
||||||
wo_db_pass = ''
|
wo_db_pass = ''
|
||||||
@@ -186,7 +186,7 @@ class WOSiteController(CementBaseController):
|
|||||||
def log(self):
|
def log(self):
|
||||||
pargs = self.app.pargs
|
pargs = self.app.pargs
|
||||||
pargs.site_name = pargs.site_name.strip()
|
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
|
wo_site_webroot = getSiteInfo(self, wo_domain).site_path
|
||||||
|
|
||||||
if not check_domain_exists(self, wo_domain):
|
if not check_domain_exists(self, wo_domain):
|
||||||
@@ -208,7 +208,7 @@ class WOSiteController(CementBaseController):
|
|||||||
Log.error(self, 'could not input site name')
|
Log.error(self, 'could not input site name')
|
||||||
# TODO Write code for wo site edit command here
|
# TODO Write code for wo site edit command here
|
||||||
pargs.site_name = pargs.site_name.strip()
|
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):
|
if not check_domain_exists(self, wo_domain):
|
||||||
Log.error(self, "site {0} does not exist".format(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')
|
Log.error(self, 'Unable to read input, please try again')
|
||||||
|
|
||||||
pargs.site_name = pargs.site_name.strip()
|
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):
|
if not check_domain_exists(self, wo_domain):
|
||||||
Log.error(self, "site {0} does not exist".format(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')
|
Log.error(self, 'Unable to read input, Please try again')
|
||||||
|
|
||||||
pargs.site_name = pargs.site_name.strip()
|
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):
|
if not check_domain_exists(self, wo_domain):
|
||||||
Log.error(self, "site {0} does not exist".format(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!")
|
Log.error(self, "Unable to input site name, Please try again!")
|
||||||
|
|
||||||
pargs.site_name = pargs.site_name.strip()
|
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():
|
if not wo_domain.strip():
|
||||||
Log.error(self, "Invalid domain name, "
|
Log.error(self, "Invalid domain name, "
|
||||||
"Provide valid domain name")
|
"Provide valid domain name")
|
||||||
@@ -718,7 +718,7 @@ class WOSiteCreateController(CementBaseController):
|
|||||||
"`tail /var/log/wo/wordops.log` and please try again")
|
"`tail /var/log/wo/wordops.log` and please try again")
|
||||||
|
|
||||||
if pargs.letsencrypt:
|
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
|
data['letsencrypt'] = True
|
||||||
letsencrypt = True
|
letsencrypt = True
|
||||||
if data['letsencrypt'] is True:
|
if data['letsencrypt'] is True:
|
||||||
@@ -931,7 +931,7 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
Log.error(self, 'Unable to input site name, Please try again!')
|
Log.error(self, 'Unable to input site name, Please try again!')
|
||||||
|
|
||||||
pargs.site_name = pargs.site_name.strip()
|
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
|
wo_site_webroot = WOVariables.wo_webroot + wo_domain
|
||||||
check_site = getSiteInfo(self, wo_domain)
|
check_site = getSiteInfo(self, wo_domain)
|
||||||
|
|
||||||
@@ -1129,7 +1129,7 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
pargs.php73 = False
|
pargs.php73 = False
|
||||||
|
|
||||||
if pargs.letsencrypt:
|
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':
|
if pargs.letsencrypt == 'on':
|
||||||
data['letsencrypt'] = True
|
data['letsencrypt'] = True
|
||||||
letsencrypt = True
|
letsencrypt = True
|
||||||
@@ -1858,7 +1858,7 @@ class WOSiteDeleteController(CementBaseController):
|
|||||||
Log.error(self, 'could not input site name')
|
Log.error(self, 'could not input site name')
|
||||||
|
|
||||||
pargs.site_name = pargs.site_name.strip()
|
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_db_name = ''
|
||||||
wo_prompt = ''
|
wo_prompt = ''
|
||||||
wo_nginx_prompt = ''
|
wo_nginx_prompt = ''
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import getpass
|
import getpass
|
||||||
import glob
|
import glob
|
||||||
|
import json
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import json
|
|
||||||
import re
|
import re
|
||||||
import string
|
import string
|
||||||
import subprocess
|
import subprocess
|
||||||
@@ -10,13 +10,13 @@ from subprocess import CalledProcessError
|
|||||||
|
|
||||||
from wo.cli.plugins.sitedb import getSiteInfo
|
from wo.cli.plugins.sitedb import getSiteInfo
|
||||||
from wo.cli.plugins.stack import WOStackController
|
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.aptget import WOAptGet
|
||||||
from wo.core.fileutils import WOFileUtils
|
from wo.core.fileutils import WOFileUtils
|
||||||
from wo.core.git import WOGit
|
from wo.core.git import WOGit
|
||||||
from wo.core.logging import Log
|
from wo.core.logging import Log
|
||||||
from wo.core.mysql import WOMysql
|
from wo.core.mysql import WOMysql
|
||||||
from wo.core.services import WOService
|
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.shellexec import CommandExecutionError, WOShellExec
|
||||||
from wo.core.sslutils import SSL
|
from wo.core.sslutils import SSL
|
||||||
from wo.core.variables import WOVariables
|
from wo.core.variables import WOVariables
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
from sqlalchemy import Column, DateTime, String, Integer, Boolean
|
from sqlalchemy import (Boolean, Column, DateTime, ForeignKey, Integer, String,
|
||||||
from sqlalchemy import ForeignKey, func
|
func)
|
||||||
from sqlalchemy.orm import relationship, backref
|
|
||||||
from sqlalchemy.ext.declarative import declarative_base
|
from sqlalchemy.ext.declarative import declarative_base
|
||||||
from wo.core.logging import Log
|
from sqlalchemy.orm import backref, relationship
|
||||||
from wo.core.database import db_session
|
|
||||||
from wo.cli.plugins.models import SiteDB
|
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,
|
def addNewSite(self, site, stype, cache, path,
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ from wo.core.apt_repo import WORepo
|
|||||||
from wo.core.aptget import WOAptGet
|
from wo.core.aptget import WOAptGet
|
||||||
from wo.core.checkfqdn import check_fqdn_ip
|
from wo.core.checkfqdn import check_fqdn_ip
|
||||||
from wo.core.cron import WOCron
|
from wo.core.cron import WOCron
|
||||||
from wo.core.domainvalidate import GetDomainlevel
|
|
||||||
from wo.core.extract import WOExtract
|
from wo.core.extract import WOExtract
|
||||||
from wo.core.fileutils import WOFileUtils
|
from wo.core.fileutils import WOFileUtils
|
||||||
from wo.core.git import WOGit
|
from wo.core.git import WOGit
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import os
|
|||||||
|
|
||||||
from cement.core import handler, hook
|
from cement.core import handler, hook
|
||||||
from cement.core.controller import CementBaseController, expose
|
from cement.core.controller import CementBaseController, expose
|
||||||
|
|
||||||
from wo.core.aptget import WOAptGet
|
from wo.core.aptget import WOAptGet
|
||||||
from wo.core.logging import Log
|
from wo.core.logging import Log
|
||||||
from wo.core.services import WOService
|
from wo.core.services import WOService
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import shutil
|
|||||||
|
|
||||||
from cement.core import handler, hook
|
from cement.core import handler, hook
|
||||||
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
|
||||||
from wo.core.aptget import WOAptGet
|
from wo.core.aptget import WOAptGet
|
||||||
from wo.core.download import WODownload
|
from wo.core.download import WODownload
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import glob
|
|||||||
|
|
||||||
from cement.core import handler, hook
|
from cement.core import handler, hook
|
||||||
from cement.core.controller import CementBaseController, expose
|
from cement.core.controller import CementBaseController, expose
|
||||||
|
|
||||||
from wo.cli.plugins.sitedb import getAllsites, updateSiteInfo
|
from wo.cli.plugins.sitedb import getAllsites, updateSiteInfo
|
||||||
from wo.core.fileutils import WOFileUtils
|
from wo.core.fileutils import WOFileUtils
|
||||||
from wo.core.logging import Log
|
from wo.core.logging import Log
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import time
|
|||||||
|
|
||||||
from cement.core import handler, hook
|
from cement.core import handler, hook
|
||||||
from cement.core.controller import CementBaseController, expose
|
from cement.core.controller import CementBaseController, expose
|
||||||
|
|
||||||
from wo.core.download import WODownload
|
from wo.core.download import WODownload
|
||||||
from wo.core.logging import Log
|
from wo.core.logging import Log
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
"""WordOps Swap Creation"""
|
"""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 os
|
||||||
|
|
||||||
import psutil
|
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():
|
class WOSwap():
|
||||||
"""Manage Swap"""
|
"""Manage Swap"""
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
"""WordOps packages repository operations"""
|
"""WordOps packages repository operations"""
|
||||||
|
import os
|
||||||
|
|
||||||
|
from wo.core.logging import Log
|
||||||
from wo.core.shellexec import WOShellExec
|
from wo.core.shellexec import WOShellExec
|
||||||
from wo.core.variables import WOVariables
|
from wo.core.variables import WOVariables
|
||||||
from wo.core.logging import Log
|
|
||||||
import os
|
|
||||||
|
|
||||||
|
|
||||||
class WORepo():
|
class WORepo():
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
"""WordOps package installation using apt-get module."""
|
"""WordOps package installation using apt-get module."""
|
||||||
import apt
|
|
||||||
import sys
|
|
||||||
import subprocess
|
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 wo.core.apt_repo import WORepo
|
||||||
from sh import apt_get
|
from wo.core.logging import Log
|
||||||
from sh import ErrorReturnCode
|
|
||||||
|
|
||||||
|
|
||||||
class WOAptGet():
|
class WOAptGet():
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
import requests
|
||||||
|
|
||||||
from wo.core.shellexec import WOShellExec
|
from wo.core.shellexec import WOShellExec
|
||||||
from wo.core.variables import WOVariables
|
from wo.core.variables import WOVariables
|
||||||
import requests
|
|
||||||
|
|
||||||
|
|
||||||
def check_fqdn(self, wo_host):
|
def check_fqdn(self, wo_host):
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
from wo.core.shellexec import WOShellExec
|
|
||||||
from wo.core.logging import Log
|
from wo.core.logging import Log
|
||||||
|
from wo.core.shellexec import WOShellExec
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Set CRON on LINUX system.
|
Set CRON on LINUX system.
|
||||||
|
|||||||
@@ -3,49 +3,50 @@ import os
|
|||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
|
|
||||||
def ValidateDomain(url):
|
class DOMN:
|
||||||
"""
|
|
||||||
This function returns domain name removing http:// and https://
|
|
||||||
returns domain name only with or without www as user provided.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Check if http:// or https:// present remove it if present
|
def validatedomain(self, url):
|
||||||
domain_name = url.split('/')
|
"""
|
||||||
if 'http:' in domain_name or 'https:' in domain_name:
|
This function returns domain name removing http:// and https://
|
||||||
domain_name = domain_name[2]
|
returns domain name only with or without www as user provided.
|
||||||
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)
|
# 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):
|
def getdomainlevel(self, domain):
|
||||||
"""
|
"""
|
||||||
This function returns the domain type : domain, subdomain,
|
This function returns the domain type : domain, subdomain,
|
||||||
"""
|
"""
|
||||||
domain_name = domain.lower().strip().split('.')
|
domain_name = domain.lower().strip().split('.')
|
||||||
if domain_name[0] == 'www':
|
if domain_name[0] == 'www':
|
||||||
domain_name = domain_name[1:]
|
domain_name = domain_name[1:]
|
||||||
domain_type = ''
|
domain_type = ''
|
||||||
if os.path.isfile("/var/lib/wo/public_suffix_list.dat"):
|
if os.path.isfile("/var/lib/wo/public_suffix_list.dat"):
|
||||||
# Read mode opens a file for reading only.
|
# Read mode opens a file for reading only.
|
||||||
suffix_file = open(
|
suffix_file = open(
|
||||||
"/var/lib/wo/public_suffix_list.dat", encoding='utf-8', )
|
"/var/lib/wo/public_suffix_list.dat", encoding='utf-8', )
|
||||||
# Read all the lines into a list.
|
# Read all the lines into a list.
|
||||||
for domain_suffix in suffix_file:
|
for domain_suffix in suffix_file:
|
||||||
if (str(domain_suffix).strip()) == ('.'.join(domain_name[1:])):
|
if (str(domain_suffix).strip()) == ('.'.join(domain_name[1:])):
|
||||||
domain_type = 'domain'
|
domain_type = 'domain'
|
||||||
root_domain = ('.'.join(domain_name[0:]))
|
root_domain = ('.'.join(domain_name[0:]))
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
domain_type = 'subdomain'
|
domain_type = 'subdomain'
|
||||||
root_domain = ('.'.join(domain_name[1:]))
|
root_domain = ('.'.join(domain_name[1:]))
|
||||||
suffix_file.close()
|
suffix_file.close()
|
||||||
|
|
||||||
return (domain_type, root_domain)
|
return (domain_type, root_domain)
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
"""WordOps download core classes."""
|
"""WordOps download core classes."""
|
||||||
import urllib.request
|
|
||||||
import urllib.error
|
|
||||||
import os
|
import os
|
||||||
|
import urllib.error
|
||||||
|
import urllib.request
|
||||||
|
|
||||||
from wo.core.logging import Log
|
from wo.core.logging import Log
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
"""WordOps Extract Core """
|
"""WordOps Extract Core """
|
||||||
import tarfile
|
|
||||||
import os
|
import os
|
||||||
|
import tarfile
|
||||||
|
|
||||||
from wo.core.logging import Log
|
from wo.core.logging import Log
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
"""WordOps file utils core classes."""
|
"""WordOps file utils core classes."""
|
||||||
import shutil
|
import fileinput
|
||||||
import os
|
import os
|
||||||
import pwd
|
import pwd
|
||||||
import fileinput
|
import shutil
|
||||||
|
|
||||||
from wo.core.logging import Log
|
from wo.core.logging import Log
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
"""WordOps GIT module"""
|
"""WordOps GIT module"""
|
||||||
from sh import git, ErrorReturnCode
|
|
||||||
from wo.core.logging import Log
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from sh import ErrorReturnCode, git
|
||||||
|
|
||||||
|
from wo.core.logging import Log
|
||||||
|
|
||||||
|
|
||||||
class WOGit:
|
class WOGit:
|
||||||
"""Intialization of core variables"""
|
"""Intialization of core variables"""
|
||||||
|
|||||||
@@ -3,10 +3,11 @@
|
|||||||
Real time log files watcher supporting log rotation.
|
Real time log files watcher supporting log rotation.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
import time
|
|
||||||
import errno
|
import errno
|
||||||
|
import os
|
||||||
import stat
|
import stat
|
||||||
|
import time
|
||||||
|
|
||||||
from wo.core.logging import Log
|
from wo.core.logging import Log
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
"""WordOps MySQL core classes."""
|
"""WordOps MySQL core classes."""
|
||||||
import pymysql
|
|
||||||
from pymysql import connections, DatabaseError, Error
|
|
||||||
from os.path import expanduser
|
|
||||||
import os
|
import os
|
||||||
|
from os.path import expanduser
|
||||||
|
|
||||||
|
import pymysql
|
||||||
|
from pymysql import DatabaseError, Error, connections
|
||||||
|
|
||||||
from wo.core.logging import Log
|
from wo.core.logging import Log
|
||||||
from wo.core.variables import WOVariables
|
from wo.core.variables import WOVariables
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
"""WordOps Hash Bucket Calculator"""
|
"""WordOps Hash Bucket Calculator"""
|
||||||
from wo.core.fileutils import WOFileUtils
|
import fileinput
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
import fileinput
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
from wo.core.fileutils import WOFileUtils
|
||||||
|
|
||||||
|
|
||||||
def hashbucket(self):
|
def hashbucket(self):
|
||||||
# Check Nginx Hashbucket error
|
# Check Nginx Hashbucket error
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import smtplib
|
|
||||||
import os
|
import os
|
||||||
from email.mime.multipart import MIMEMultipart
|
import smtplib
|
||||||
|
from email import encoders
|
||||||
from email.mime.base import MIMEBase
|
from email.mime.base import MIMEBase
|
||||||
|
from email.mime.multipart import MIMEMultipart
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
from email.utils import COMMASPACE, formatdate
|
from email.utils import COMMASPACE, formatdate
|
||||||
from email import encoders
|
|
||||||
|
|
||||||
|
|
||||||
def WOSendMail(send_from, send_to, subject, text, files, server="localhost",
|
def WOSendMail(send_from, send_to, subject, text, files, server="localhost",
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
"""WordOps Service Manager"""
|
"""WordOps Service Manager"""
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from wo.core.logging import Log
|
from wo.core.logging import Log
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
"""WordOps Shell Functions"""
|
"""WordOps Shell Functions"""
|
||||||
from wo.core.logging import Log
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
from wo.core.logging import Log
|
||||||
|
|
||||||
|
|
||||||
class CommandExecutionError(Exception):
|
class CommandExecutionError(Exception):
|
||||||
"""custom Exception for command execution"""
|
"""custom Exception for command execution"""
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
from wo.core.logging import Log
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from wo.core.logging import Log
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Render Templates
|
Render Templates
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
"""WordOps core variable module"""
|
"""WordOps core variable module"""
|
||||||
import distro
|
|
||||||
import socket
|
|
||||||
import configparser
|
import configparser
|
||||||
import os
|
|
||||||
import datetime
|
import datetime
|
||||||
|
import os
|
||||||
|
import socket
|
||||||
|
|
||||||
|
import distro
|
||||||
|
|
||||||
|
|
||||||
class WOVariables():
|
class WOVariables():
|
||||||
|
|||||||
Reference in New Issue
Block a user