Beispiel #1
0
    def _generate(self, loader, validator, nosyncdb=False):
        gendir = os.path.join(settings["vigiconf"].get("libdir"), "deploy")
        shutil.rmtree(gendir, ignore_errors=True)
        if not nosyncdb:
            LOGGER.debug("Syncing with database")
            loader.load_apps_db(self.apps)
            loader.load_conf_db()
            loader.load_vigilo_servers_db()
        LOGGER.info(_("Computing ventilation"))
        self.ventilator = get_ventilator(self.apps)
        self._ventilation = self.ventilator.ventilate()
        LOGGER.debug("Loading ventilation in DB")
        loader.load_ventilation_db(self._ventilation, self.apps)

        LOGGER.debug("Validating ventilation")
        validator.ventilation = self._ventilation
        if not validator.preValidate():
            for errmsg in validator.getSummary(details=True, stats=True):
                LOGGER.error(errmsg)
            raise GenerationError("prevalidation")

        LOGGER.info(_("Running generators"))
        self.run_all_generators(validator)

        if validator.hasErrors():
            for errmsg in validator.getSummary(details=True, stats=True):
                LOGGER.error(errmsg)
            raise GenerationError("validation")
        for msg in validator.getSummary(details=True, stats=True):
            LOGGER.info(msg)
Beispiel #2
0
 def test_ventilator_com(self):
     """The monitoring server in C.E. must always be the localhost"""
     host = Host(conf.hostsConf, "dummy.xml", "testserver1",
                 "192.168.1.1", "Servers")
     nagios = Nagios()
     DBSession.add(tables.Application(name=u"nagios"))
     ventilator = get_ventilator([nagios])
     mapping = ventilator.ventilate()
     mapping = ventilator.ventilation_by_appname(mapping)
     for app, appserver in mapping[host.name].iteritems():
         self.assertEqual(appserver, "localhost",
             "The monitoring server in the Enterprise Edition for the "
             "%s application is not the local host" % app)