def __init__(self, cfgfile): self._checkInterval = 10 self.vermontInstances = [] self._exitWorker = False self._logFile = None self._server = None self._allowedIP = "" self.__dynconfEnabled = False self._workerRunning = False if cfgfile is not None: VermontLogger.init("vmanager", "", True) self._readConfig(cfgfile) self._configurator = VermontConfigurator() self._configurator.parseConfigs(self.vermontInstances) VermontLogger.init("vmanager", self._logFile, True)
def __init__(self, configfile): self.dir = None self.cfgfile = None self.logfile = None self.moninterval = None self.allowedIp = None self.xpaths = [] self.names = [] self.server = None self.vMonitor = None self.rInterface = None self.controllerlogfile = None try: VermontLogger.init("vcontroller", "", True) self._readConfig(configfile) VermontLogger.init("vcontroller", self.controllerlogfile, True) except: print "failed to read configuration file!" logger().error(traceback.format_exc())
import os import sys import time import logging d = os.path.dirname(sys.argv[0]) sys.path.insert(0, d + 'common') sys.path.insert(0, d + 'controller') sys.path.insert(0, d + 'webinterface') import LocalVermontInstance import VermontConfigurator import VermontInstanceManager import VermontLogger VermontLogger.init("testapp", "tmp/test.log", True) VermontLogger.logger().info("starting test") lvi = LocalVermontInstance.LocalVermontInstance("tmp", "tmp.conf", "tmp.log", True) vim = VermontInstanceManager.VermontInstanceManager("tmp", False) vim.vermontInstances = (lvi) vim._checkInterval = 5 vc = VermontConfigurator.VermontConfigurator() vc.parseConfigs([lvi]) vim.vermontInstances = [lvi] vim._configurator = vc vim.startConfigThread() time.sleep(10)