def get_dispatchator(args, restrict=True): conf.load_general_conf() dispatchator = make_dispatchator() if restrict and args.server: try: dispatchator.restrict(args.server) except KeyError, e: # on pourrait utiliser la fonction "choices" de argparse, mais # ça obligerait à charger le dispatchator, et donc la conf, # dès le début même si on s'en sert pas LOGGER.error(_("ERROR: %s"), e.message) sys.exit(1)
def setUp(self): setup_db() self.tmpdir = setup_tmpdir() self.old_conf_path = settings["vigiconf"]["confdir"] settings["vigiconf"]["confdir"] = os.path.join(self.tmpdir, "conf.d") os.mkdir(settings["vigiconf"]["confdir"]) # Prepare necessary directories # TODO: commenter les divers repertoires setup_deploy_dir() self.host = Host(conf.hostsConf, "dummy", u"testserver1", u"192.168.1.1", u"Servers") testfactory = TestFactory(confdir=settings["vigiconf"]["confdir"]) test_list = testfactory.get_test("UpTime", self.host.classes) self.host.add_tests(test_list) self.dispatchator = make_dispatchator() # Disable qualification, validation, stop and start scripts for app in self.dispatchator.apps_mgr.applications: app.validation = None app.start_command = None app.stop_command = None # Don't check the installed revisions self.dispatchator.force = ("deploy", "db-sync")