当前位置: 首页>>代码示例>>Python>>正文


Python ExternalCommandManager.load_arbiter方法代码示例

本文整理汇总了Python中shinken.external_command.ExternalCommandManager.load_arbiter方法的典型用法代码示例。如果您正苦于以下问题:Python ExternalCommandManager.load_arbiter方法的具体用法?Python ExternalCommandManager.load_arbiter怎么用?Python ExternalCommandManager.load_arbiter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在shinken.external_command.ExternalCommandManager的用法示例。


在下文中一共展示了ExternalCommandManager.load_arbiter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setup_with_file

# 需要导入模块: from shinken.external_command import ExternalCommandManager [as 别名]
# 或者: from shinken.external_command.ExternalCommandManager import load_arbiter [as 别名]
 def setup_with_file(self, path):
     # i am arbiter-like
     self.broks = {}
     self.me = None
     self.log = logger
     self.log.load_obj(self)
     self.config_files = [path]
     self.conf = Config()
     buf = self.conf.read_config(self.config_files)
     raw_objects = self.conf.read_config_buf(buf)
     self.conf.create_objects_for_type(raw_objects, 'arbiter')
     self.conf.create_objects_for_type(raw_objects, 'module')
     self.conf.early_arbiter_linking()
     self.conf.create_objects(raw_objects)
     self.conf.old_properties_names_to_new()
     self.conf.instance_id = 0
     self.conf.instance_name = 'test'
     # Hack push_flavor, that is set by the dispatcher
     self.conf.push_flavor = 0
     self.conf.linkify_templates()
     self.conf.apply_inheritance()
     self.conf.explode()
     print "Aconf.services has %d elements" % len(self.conf.services)
     self.conf.create_reversed_list()
     self.conf.remove_twins()
     self.conf.apply_implicit_inheritance()
     self.conf.fill_default()
     self.conf.remove_templates()
     print "conf.services has %d elements" % len(self.conf.services)
     self.conf.create_reversed_list()
     self.conf.pythonize()
     self.conf.linkify()
     self.conf.apply_dependencies()
     self.conf.explode_global_conf()
     self.conf.propagate_timezone_option()
     self.conf.create_business_rules()
     self.conf.create_business_rules_dependencies()
     self.conf.is_correct()
     self.confs = self.conf.cut_into_parts()
     self.conf.show_errors()
     self.dispatcher = Dispatcher(self.conf, self.me)
     
     scheddaemon = Shinken(None, False, False, False, None)
     self.sched = Scheduler(scheddaemon)
     
     scheddaemon.sched = self.sched
             
     m = MacroResolver()
     m.init(self.conf)
     self.sched.load_conf(self.conf)
     e = ExternalCommandManager(self.conf, 'applyer')
     self.sched.external_command = e
     e.load_scheduler(self.sched)
     e2 = ExternalCommandManager(self.conf, 'dispatcher')
     e2.load_arbiter(self)
     self.external_command_dispatcher = e2
     self.sched.schedule()
开发者ID:jfbutkiewicz,项目名称:Windows-Setup-for-Shinken,代码行数:59,代码来源:shinken_test.py

示例2: setup_with_file

# 需要导入模块: from shinken.external_command import ExternalCommandManager [as 别名]
# 或者: from shinken.external_command.ExternalCommandManager import load_arbiter [as 别名]
    def setup_with_file(self, path):
        time_hacker.set_my_time()
        self.print_header()
        # i am arbiter-like
        self.broks = {}
        self.me = None
        self.log = logger
        self.log.load_obj(self)
        self.config_files = [path]
        self.conf = Config()
        buf = self.conf.read_config(self.config_files)
        raw_objects = self.conf.read_config_buf(buf)
        self.conf.create_objects_for_type(raw_objects, 'arbiter')
        self.conf.create_objects_for_type(raw_objects, 'module')
        self.conf.early_arbiter_linking()

        # If we got one arbiter defined here (before default) we should be in a case where
        # the tester want to load/test a module, so we simulate an arbiter daemon
        # and the modules loading phase. As it has its own modulesmanager, should
        # not impact scheduler modules ones, especially we are asking for arbiter type :)
        if len(self.conf.arbiters) == 1:
            arbdaemon = Arbiter([''],[''], False, False, None, None)
            # only load if the module_dir is reallyexisting, so was set explicitly
            # in the test configuration
            if os.path.exists(getattr(self.conf, 'modules_dir', '')):
                arbdaemon.modules_dir = self.conf.modules_dir
                arbdaemon.load_modules_manager()

                # we request the instances without them being *started*
                # (for those that are concerned ("external" modules):
                # we will *start* these instances after we have been daemonized (if requested)
                me = None
                for arb in self.conf.arbiters:
                    me = arb
                    arbdaemon.modules_manager.set_modules(arb.modules)
                    arbdaemon.do_load_modules()
                    arbdaemon.load_modules_configuration_objects(raw_objects)

        self.conf.create_objects(raw_objects)
        self.conf.instance_id = 0
        self.conf.instance_name = 'test'
        # Hack push_flavor, that is set by the dispatcher
        self.conf.push_flavor = 0
        self.conf.load_triggers()
        #import pdb;pdb.set_trace()
        self.conf.linkify_templates()
        #import pdb;pdb.set_trace()
        self.conf.apply_inheritance()
        #import pdb;pdb.set_trace()
        self.conf.explode()
        #print "Aconf.services has %d elements" % len(self.conf.services)
        self.conf.apply_implicit_inheritance()
        self.conf.fill_default()
        self.conf.remove_templates()
        self.conf.compute_hash()
        #print "conf.services has %d elements" % len(self.conf.services)
        self.conf.override_properties()
        self.conf.linkify()
        self.conf.apply_dependencies()
        self.conf.set_initial_state()
        self.conf.explode_global_conf()
        self.conf.propagate_timezone_option()
        self.conf.create_business_rules()
        self.conf.create_business_rules_dependencies()
        self.conf.is_correct()
        if not self.conf.conf_is_correct:
            print "The conf is not correct, I stop here"
            self.conf.dump()
            return
        self.conf.clean()

        self.confs = self.conf.cut_into_parts()
        self.conf.prepare_for_sending()
        self.conf.show_errors()
        self.dispatcher = Dispatcher(self.conf, self.me)

        scheddaemon = Shinken(None, False, False, False, None, None)
        self.scheddaemon = scheddaemon
        self.sched = scheddaemon.sched
        scheddaemon.modules_dir = modules_dir
        scheddaemon.load_modules_manager()
        # Remember to clean the logs we just created before launching tests
        self.clear_logs()
        m = MacroResolver()
        m.init(self.conf)
        self.sched.load_conf(self.conf, in_test=True)
        e = ExternalCommandManager(self.conf, 'applyer')
        self.sched.external_command = e
        e.load_scheduler(self.sched)
        e2 = ExternalCommandManager(self.conf, 'dispatcher')
        e2.load_arbiter(self)
        self.external_command_dispatcher = e2
        self.sched.conf.accept_passive_unknown_check_results = False

        self.sched.schedule()
开发者ID:Aimage,项目名称:shinken,代码行数:97,代码来源:shinken_test.py

示例3: setup_with_file

# 需要导入模块: from shinken.external_command import ExternalCommandManager [as 别名]
# 或者: from shinken.external_command.ExternalCommandManager import load_arbiter [as 别名]
    def setup_with_file(self, path):
        time_hacker.set_my_time()
        self.print_header()
        # i am arbiter-like
        self.broks = {}
        self.me = None
        self.log = logger
        self.log.load_obj(self)
        self.config_files = [path]
        self.conf = Config()
        buf = self.conf.read_config(self.config_files)
        raw_objects = self.conf.read_config_buf(buf)
        self.conf.create_objects_for_type(raw_objects, 'arbiter')
        self.conf.create_objects_for_type(raw_objects, 'module')
        self.conf.early_arbiter_linking()
        self.conf.create_objects(raw_objects)
        self.conf.instance_id = 0
        self.conf.instance_name = 'test'
        # Hack push_flavor, that is set by the dispatcher
        self.conf.push_flavor = 0
        self.conf.load_triggers()
        #import pdb;pdb.set_trace()
        self.conf.linkify_templates()
        #import pdb;pdb.set_trace()
        self.conf.apply_inheritance()
        #import pdb;pdb.set_trace()
        self.conf.explode()
        #print "Aconf.services has %d elements" % len(self.conf.services)
        self.conf.apply_implicit_inheritance()
        self.conf.fill_default()
        self.conf.remove_templates()
        self.conf.compute_hash()
        #print "conf.services has %d elements" % len(self.conf.services)
        self.conf.override_properties()
        self.conf.linkify()
        self.conf.apply_dependencies()
        self.conf.explode_global_conf()
        self.conf.propagate_timezone_option()
        self.conf.create_business_rules()
        self.conf.create_business_rules_dependencies()
        self.conf.is_correct()
        if not self.conf.conf_is_correct:
            print "The conf is not correct, I stop here"
            self.conf.dump()
            return
        self.conf.clean()

        self.confs = self.conf.cut_into_parts()
        self.conf.prepare_for_sending()
        self.conf.show_errors()
        self.dispatcher = Dispatcher(self.conf, self.me)

        scheddaemon = Shinken(None, False, False, False, None, None)
        self.sched = Scheduler(scheddaemon)

        scheddaemon.sched = self.sched
        scheddaemon.modules_dir = modules_dir
        scheddaemon.load_modules_manager()
        # Remember to clean the logs we just created before launching tests
        self.clear_logs()
        m = MacroResolver()
        m.init(self.conf)
        self.sched.load_conf(self.conf, in_test=True)
        e = ExternalCommandManager(self.conf, 'applyer')
        self.sched.external_command = e
        e.load_scheduler(self.sched)
        e2 = ExternalCommandManager(self.conf, 'dispatcher')
        e2.load_arbiter(self)
        self.external_command_dispatcher = e2
        self.sched.conf.accept_passive_unknown_check_results = False

        self.sched.schedule()
开发者ID:MPOWER4RU,项目名称:shinken,代码行数:74,代码来源:shinken_test.py


注:本文中的shinken.external_command.ExternalCommandManager.load_arbiter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。