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


Python runner.run函数代码示例

本文整理汇总了Python中salt.runner.run函数的典型用法代码示例。如果您正苦于以下问题:Python run函数的具体用法?Python run怎么用?Python run使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: run

    def run(self):
        '''
        Execute salt-run
        '''
        import salt.runner
        self.parse_args()

        # Setup file logging!
        self.setup_logfile_logger()
        profiling_enabled = self.options.profiling_enabled

        runner = salt.runner.Runner(self.config)
        if self.options.doc:
            runner.print_docs()
            self.exit(os.EX_OK)

        # Run this here so SystemExit isn't raised anywhere else when
        # someone tries to use the runners via the python API
        try:
            if check_user(self.config['user']):
                pr = activate_profile(profiling_enabled)
                try:
                    runner.run()
                finally:
                    output_profile(
                        pr,
                        stats_path=self.options.profiling_path,
                        stop=True)
        except SaltClientError as exc:
            raise SystemExit(str(exc))
开发者ID:DaveQB,项目名称:salt,代码行数:30,代码来源:run.py

示例2: run

    def run(self):
        """
        Execute salt-run
        """
        self.parse_args()

        if self.config["verify_env"]:
            verify_env(
                [self.config["pki_dir"], self.config["cachedir"]],
                self.config["user"],
                permissive=self.config["permissive_pki_access"],
                pki_dir=self.config["pki_dir"],
            )
            if not self.config["log_file"].startswith(("tcp://", "udp://", "file://")):
                # Logfile is not using Syslog, verify
                verify_files([self.config["log_file"]], self.config["user"])

        # Setup file logging!
        self.setup_logfile_logger()

        runner = salt.runner.Runner(self.config)
        if self.options.doc:
            runner._print_docs()
            self.exit(salt.exitcodes.EX_OK)

        # Run this here so SystemExit isn't raised anywhere else when
        # someone tries to use the runners via the python API
        try:
            if check_user(self.config["user"]):
                runner.run()
        except SaltClientError as exc:
            raise SystemExit(str(exc))
开发者ID:wikimedia,项目名称:operations-debs-salt,代码行数:32,代码来源:__init__.py

示例3: run

 def run(self):
     '''
     Execute salt-run
     '''
     runner = salt.runner.Runner(self.opts)
     # Run this here so SystemExit isn't raised
     # anywhere else when someone tries to  use
     # the runners via the python api
     try:
         runner.run()
     except SaltClientError as exc:
         raise SystemExit(str(exc))
开发者ID:DarkSinclair,项目名称:salt,代码行数:12,代码来源:__init__.py

示例4: minion_runner

 def minion_runner(self, load):
     '''
     Execute a runner from a minion, return the runner's function data
     '''
     if 'peer_run' not in self.opts:
         return {}
     if not isinstance(self.opts['peer_run'], dict):
         return {}
     if any(key not in load for key in ('fun', 'arg', 'id', 'tok')):
         return {}
     perms = set()
     for match in self.opts['peer_run']:
         if re.match(match, load['id']):
             # This is the list of funcs/modules!
             if isinstance(self.opts['peer_run'][match], list):
                 perms.update(self.opts['peer_run'][match])
     good = False
     for perm in perms:
         if re.match(perm, load['fun']):
             good = True
     if not good:
         return {}
     # Prepare the runner object
     opts = {'fun': load['fun'],
             'arg': load['arg'],
             'id': load['id'],
             'doc': False,
             'conf_file': self.opts['conf_file']}
     opts.update(self.opts)
     runner = salt.runner.Runner(opts)
     return runner.run()
开发者ID:penta-srl,项目名称:salt,代码行数:31,代码来源:masterapi.py

示例5: run

    def run(self):
        '''
        Execute salt-run
        '''
        self.parse_args()

        runner = salt.runner.Runner(self.config)
        if self.options.doc:
            runner._print_docs()
        else:
            # Run this here so SystemExit isn't raised anywhere else when
            # someone tries to use the runners via the python api
            try:
                runner.run()
            except SaltClientError as exc:
                raise SystemExit(str(exc))
开发者ID:BackSeat,项目名称:salt,代码行数:16,代码来源:__init__.py

示例6: run

    def run(self):
        '''
        Execute salt-run
        '''
        import salt.runner
        self.parse_args()

        if self.config['verify_env']:
            verify_env([
                    self.config['pki_dir'],
                    self.config['cachedir'],
                ],
                self.config['user'],
                permissive=self.config['permissive_pki_access'],
                pki_dir=self.config['pki_dir'],
            )
            if not self.config['log_file'].startswith(('tcp://',
                                                       'udp://',
                                                       'file://')):
                # Logfile is not using Syslog, verify
                verify_files(
                    [self.config['log_file']],
                    self.config['user']
                )

        # Setup file logging!
        self.setup_logfile_logger()

        runner = salt.runner.Runner(self.config)
        if self.options.doc:
            runner.print_docs()
            self.exit(os.EX_OK)

        # Run this here so SystemExit isn't raised anywhere else when
        # someone tries to use the runners via the python API
        try:
            if check_user(self.config['user']):
                runner.run()
        except SaltClientError as exc:
            raise SystemExit(str(exc))
开发者ID:qzchenwl,项目名称:saltstack-verify,代码行数:40,代码来源:run.py

示例7: run_run_plus

 def run_run_plus(self, fun, options='', *arg):
     '''
     Execute Salt run and the salt run function and return the data from
     each in a dict
     '''
     ret = {}
     ret['out'] = self.run_run(
         '{0} {1} {2}'.format(options, fun, ' '.join(arg))
     )
     opts = salt.config.master_config(
         os.path.join(INTEGRATION_TEST_DIR, 'files', 'conf', 'master')
     )
     opts.update({'doc': False, 'fun': fun, 'arg': arg})
     runner = salt.runner.Runner(opts)
     ret['fun'] = runner.run()
     return ret
开发者ID:BackSeat,项目名称:salt,代码行数:16,代码来源:__init__.py

示例8: run_run_plus

 def run_run_plus(self, fun, options='', *arg):
     '''
     Execute Salt run and the salt run function and return the data from
     each in a dict
     '''
     ret = {}
     ret['out'] = self.run_run(
         '{0} {1} {2}'.format(options, fun, ' '.join(arg))
     )
     opts = salt.config.master_config(
         self.get_config_file_path('master')
     )
     opts.update({'doc': False, 'fun': fun, 'arg': arg})
     with RedirectStdStreams():
         runner = salt.runner.Runner(opts)
         ret['fun'] = runner.run()
     return ret
开发者ID:bemehow,项目名称:salt,代码行数:17,代码来源:__init__.py

示例9: minion_runner

 def minion_runner(self, clear_load):
     '''
     Execute a runner from a minion, return the runner's function data
     '''
     if 'peer_run' not in self.opts:
         return {}
     if not isinstance(self.opts['peer_run'], dict):
         return {}
     if 'fun' not in clear_load\
             or 'arg' not in clear_load\
             or 'id' not in clear_load\
             or 'tok' not in clear_load:
         return {}
     if not self.__verify_minion(clear_load['id'], clear_load['tok']):
         # The minion is not who it says it is!
         # We don't want to listen to it!
         msg = 'Minion id {0} is not who it says it is!'.format(
                 clear_load['id'])
         log.warn(msg)
         return {}
     perms = set()
     for match in self.opts['peer_run']:
         if re.match(match, clear_load['id']):
             # This is the list of funcs/modules!
             if isinstance(self.opts['peer_run'][match], list):
                 perms.update(self.opts['peer_run'][match])
     good = False
     for perm in perms:
         if re.match(perm, clear_load['fun']):
             good = True
     if not good:
         return {}
     # Prepare the runner object
     opts = {'fun': clear_load['fun'],
             'arg': clear_load['arg'],
             'doc': False,
             'conf_file': self.opts['conf_file']}
     opts.update(self.opts)
     runner = salt.runner.Runner(opts)
     return runner.run()
开发者ID:abh,项目名称:salt,代码行数:40,代码来源:master.py

示例10: run

 def run(self):
     '''
     Execute the salt call!
     '''
     runner = salt.runner.Runner(self.opts)
     runner.run()
开发者ID:atoponce,项目名称:salt,代码行数:6,代码来源:__init__.py

示例11: run

 def run(self):
     '''
     Execute salt-run
     '''
     runner = salt.runner.Runner(self.opts)
     runner.run()
开发者ID:cmek,项目名称:salt,代码行数:6,代码来源:__init__.py


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