예제 #1
0
def execute(config=None, logger=None):
    """Main Execute"""
    if not config:
        config = getConfig()
    if not logger:
        component = 'LookUpService'
        logger = getLogger("%s/%s/" % (config.get('general', 'logDir'), component), config.get(component, 'logLevel'))
    for siteName in config.get('general', 'sites').split(','):
        policer = LookUpService(config, logger, siteName)
        policer.startwork()
예제 #2
0
 def __init__(self, config, logger):
     self.config = config if config else getConfig()
     self.logger = logger if logger else getLogger(
         "%s/%s/" % (self.config.get('general', 'logDir'), COMPONENT),
         self.config.get('general', 'logLevel'))
     self.fullURL = getFullUrl(self.config,
                               self.config.get('general', 'siteName'))
     self.hostname = self.config.get('agent', 'hostname')
     self.logger.info("====== Debugger Start Work. Hostname: %s",
                      self.hostname)
예제 #3
0
def execute(config=None, logger=None, args=None):
    """Main Execute"""
    if not config:
        config = getConfig(["/etc/dtnrm-site-fe.conf"])
    if not logger:
        component = 'LookUpService'
        logger = getLogger(
            "%s/%s/" % (config.get('general', 'logDir'), component),
            config.get(component, 'logLevel'))
    provisioner = ProvisioningService(config, logger, args)
    provisioner.startwork()
예제 #4
0
 def __init__(self, config, logger):
     self.config = config if config else getConfig()
     self.logger = logger if logger else getLogger(
         "%s/%s/" % (self.config.get('general', 'logDir'), COMPONENT),
         self.config.get('general', 'logLevel'))
     self.workDir = self.config.get('general',
                                    'private_dir') + "/DTNRM/QOS/"
     self.configDir = self.config.get('general',
                                      'private_dir') + "/DTNRM/RulerAgent/"
     self.hostname = self.config.get('agent', 'hostname')
     createDirs(self.workDir)
     self.debug = self.config.getboolean('general', "debug")
     self.agentdb = contentDB(logger=self.logger, config=self.config)
예제 #5
0
 def __init__(self, config, logger):
     self.config = config if config else getConfig()
     self.logger = logger if logger else getLogger(
         "%s/%s/" % (self.config.get('general', 'logDir'), COMPONENT),
         self.config.get('general', 'logLevel'))
     self.workDir = self.config.get('general',
                                    'private_dir') + "/DTNRM/RulerAgent/"
     createDirs(self.workDir)
     self.fullURL = getFullUrl(self.config,
                               self.config.get('general', 'siteName'))
     self.noRules = self.config.getboolean('agent', 'norules')
     self.hostname = self.config.get('agent', 'hostname')
     self.logger.info("====== Ruler Start Work. Hostname: %s",
                      self.hostname)
     self.vInterface = VInterfaces(self.config, self.logger)
예제 #6
0
def execute(config=None, logger=None, args=None):
    """Main Execute"""
    if not config:
        config = getConfig(["/etc/dtnrm-site-fe.conf"])
    if not logger:
        component = 'PolicyService'
        logger = getLogger(
            "%s/%s/" % (config.get('general', 'logDir'), component),
            config.get(component, 'logLevel'), True)

    policer = PolicyService(config, logger)
    if args:
        print policer.parseDeltaRequest(args[1], [], args[2])
    else:
        policer.startwork()
예제 #7
0
def execute(config=None, logger=None, args=None):
    """Main Execute."""
    if not config:
        config = getConfig()
    if not logger:
        component = 'LookUpService'
        logger = getLogger(
            "%s/%s/" % (config.get('general', 'logDir'), component),
            config.get(component, 'logLevel'))
    if args:
        provisioner = ProvisioningService(config, logger, args[1])
        provisioner.startwork()
    else:
        for sitename in config.get('general', 'sites').split(','):
            provisioner = ProvisioningService(config, logger, sitename)
            provisioner.startwork()
예제 #8
0
def execute(config=None, logger=None, args=None):
    """Main Execute"""
    if not config:
        config = getConfig()
    if not logger:
        component = 'PolicyService'
        logger = getLogger("%s/%s/" % (config.get('general', 'logDir'), component),
                           config.get(component, 'logLevel'), True)

    if args:
        policer = PolicyService(config, logger, args[3])
        # This is only for debugging purposes.
        print policer.parseDeltaRequest(args[1], {args[2]: []})
    else:
        for sitename in config.get('general', 'sites').split(','):
            policer = PolicyService(config, logger, sitename)
            policer.startwork()
예제 #9
0
Date			: 2017/09/26
"""
from shutil import copy2
from DTNRMLibs.MainUtilities import evaldict
from DTNRMLibs.MainUtilities import readFile
from DTNRMLibs.MainUtilities import getLogger
from DTNRMLibs.MainUtilities import getConfig
from DTNRMLibs.MainUtilities import getFullUrl
from DTNRMLibs.MainUtilities import createDirs
from DTNRMLibs.MainUtilities import externalCommand
from DTNRMLibs.MainUtilities import getDataFromSiteFE
from DTNRMLibs.CustomExceptions import FailedToParseError

CONFIG = getConfig(["/etc/dtnrm-site-fe.conf"])
COMPONENT = 'ForwardingService'
LOGGER = getLogger("%s/%s/" % (CONFIG.get('general', 'logDir'), COMPONENT),
                   CONFIG.get(COMPONENT, 'logLevel'))


def checkConsistency(inputDict, currentHttpdConf, start, end):
    """Check current config and information from Site FE. Append what is missing."""
    newConfig = []
    changed = False
    print 'Appending the beginning %s lines' % start
    for lineNum in range(0, start):
        newConfig.append(currentHttpdConf[lineNum])
    print 'Starting to check current configuration with what we received from DB'
    newConfig.append("### HERE STARTS PROXYREWRITERULES")
    for lineNum in range(start, end):
        if lineNum == start or lineNum == end:
            continue
        if currentHttpdConf[lineNum].strip().startswith("# PROXYRULE"):