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


Python service.RunnerContainerService类代码示例

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


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

示例1: test_get_entry_point_absolute_path

 def test_get_entry_point_absolute_path(self):
     service = RunnerContainerService()
     orig_path = cfg.CONF.content.system_packs_base_path
     cfg.CONF.content.system_packs_base_path = '/tests/packs'
     acutal_path = service.get_entry_point_abs_path(pack='foo', entry_point='/foo/bar.py')
     self.assertEqual(acutal_path, '/foo/bar.py', 'Entry point path doesn\'t match.')
     cfg.CONF.content.system_packs_base_path = orig_path
开发者ID:ipv1337,项目名称:st2,代码行数:7,代码来源:test_runner_container_service.py

示例2: test_get_entry_point_absolute_path

 def test_get_entry_point_absolute_path(self):
     service = RunnerContainerService()
     orig_path = cfg.CONF.content.system_packs_base_path
     cfg.CONF.content.system_packs_base_path = "/tests/packs"
     acutal_path = service.get_entry_point_abs_path(pack="foo", entry_point="/tests/packs/foo/bar.py")
     self.assertEqual(acutal_path, "/tests/packs/foo/bar.py", "Entry point path doesn't match.")
     cfg.CONF.content.system_packs_base_path = orig_path
开发者ID:azamsheriff,项目名称:st2,代码行数:7,代码来源:test_runner_container_service.py

示例3: _invoke_post_run

    def _invoke_post_run(self, actionexec_db, action_db):
        LOG.info(
            "Invoking post run for action execution %s. Action=%s; Runner=%s",
            actionexec_db.id,
            action_db.name,
            action_db.runner_type["name"],
        )

        # Get an instance of the action runner.
        runnertype_db = get_runnertype_by_name(action_db.runner_type["name"])
        runner = get_runner(runnertype_db.runner_module)

        # Configure the action runner.
        runner.container_service = RunnerContainerService()
        runner.action = action_db
        runner.action_name = action_db.name
        runner.action_execution_id = str(actionexec_db.id)
        runner.entry_point = RunnerContainerService.get_entry_point_abs_path(
            pack=action_db.pack, entry_point=action_db.entry_point
        )
        runner.context = getattr(actionexec_db, "context", dict())
        runner.callback = getattr(actionexec_db, "callback", dict())
        runner.libs_dir_path = RunnerContainerService.get_action_libs_abs_path(
            pack=action_db.pack, entry_point=action_db.entry_point
        )

        # Invoke the post_run method.
        runner.post_run(actionexec_db.status, actionexec_db.result)
开发者ID:Pulsant,项目名称:st2,代码行数:28,代码来源:base.py

示例4: test_get_entry_point_relative_path

 def test_get_entry_point_relative_path(self):
     service = RunnerContainerService()
     orig_path = cfg.CONF.content.system_packs_base_path
     cfg.CONF.content.system_packs_base_path = "/tests/packs"
     acutal_path = service.get_entry_point_abs_path(pack="foo", entry_point="foo/bar.py")
     expected_path = os.path.join(cfg.CONF.content.system_packs_base_path, "foo", "actions", "foo/bar.py")
     self.assertEqual(acutal_path, expected_path, "Entry point path doesn't match.")
     cfg.CONF.content.system_packs_base_path = orig_path
开发者ID:azamsheriff,项目名称:st2,代码行数:8,代码来源:test_runner_container_service.py

示例5: test_get_entry_point_relative_path

 def test_get_entry_point_relative_path(self):
     service = RunnerContainerService()
     orig_path = cfg.CONF.content.system_packs_base_path
     cfg.CONF.content.system_packs_base_path = '/tests/packs'
     acutal_path = service.get_entry_point_abs_path(pack='foo', entry_point='foo/bar.py')
     expected_path = os.path.join(cfg.CONF.content.system_packs_base_path, 'foo', 'actions',
                                  'foo/bar.py')
     self.assertEqual(acutal_path, expected_path, 'Entry point path doesn\'t match.')
     cfg.CONF.content.system_packs_base_path = orig_path
开发者ID:ipv1337,项目名称:st2,代码行数:9,代码来源:test_runner_container_service.py

示例6: test_get_entry_point_absolute_path_empty

 def test_get_entry_point_absolute_path_empty(self):
     service = RunnerContainerService()
     orig_path = cfg.CONF.content.packs_base_path
     cfg.CONF.content.packs_base_path = '/tests/packs'
     acutal_path = service.get_entry_point_abs_path(pack='foo', entry_point=None)
     self.assertEqual(acutal_path, None, 'Entry point path doesn\'t match.')
     acutal_path = service.get_entry_point_abs_path(pack='foo', entry_point='')
     self.assertEqual(acutal_path, None, 'Entry point path doesn\'t match.')
     cfg.CONF.content.packs_base_path = orig_path
开发者ID:bjoernbessert,项目名称:st2,代码行数:9,代码来源:test_runner_container_service.py

示例7: test_get_action_libs_abs_path

    def test_get_action_libs_abs_path(self):
        service = RunnerContainerService()
        orig_path = cfg.CONF.content.system_packs_base_path
        cfg.CONF.content.system_packs_base_path = '/tests/packs'

        # entry point relative.
        acutal_path = service.get_action_libs_abs_path(pack='foo', entry_point='foo/bar.py')
        expected_path = os.path.join(cfg.CONF.content.system_packs_base_path, 'foo', 'actions',
                                     os.path.join('foo', ACTION_LIBS_DIR))
        self.assertEqual(acutal_path, expected_path, 'Action libs path doesn\'t match.')

        # entry point absolute.
        acutal_path = service.get_action_libs_abs_path(pack='foo', entry_point='/tmp/foo.py')
        expected_path = os.path.join('/tmp', ACTION_LIBS_DIR)
        self.assertEqual(acutal_path, expected_path, 'Action libs path doesn\'t match.')
        cfg.CONF.content.system_packs_base_path = orig_path
开发者ID:ipv1337,项目名称:st2,代码行数:16,代码来源:test_runner_container_service.py

示例8: test_get_action_libs_abs_path

    def test_get_action_libs_abs_path(self):
        service = RunnerContainerService()
        orig_path = cfg.CONF.content.system_packs_base_path
        cfg.CONF.content.system_packs_base_path = "/tests/packs"

        # entry point relative.
        acutal_path = service.get_action_libs_abs_path(pack="foo", entry_point="foo/bar.py")
        expected_path = os.path.join(
            cfg.CONF.content.system_packs_base_path, "foo", "actions", os.path.join("foo", ACTION_LIBS_DIR)
        )
        self.assertEqual(acutal_path, expected_path, "Action libs path doesn't match.")

        # entry point absolute.
        acutal_path = service.get_action_libs_abs_path(pack="foo", entry_point="/tests/packs/foo/tmp/foo.py")
        expected_path = os.path.join("/tests/packs/foo/tmp", ACTION_LIBS_DIR)
        self.assertEqual(acutal_path, expected_path, "Action libs path doesn't match.")
        cfg.CONF.content.system_packs_base_path = orig_path
开发者ID:azamsheriff,项目名称:st2,代码行数:17,代码来源:test_runner_container_service.py

示例9: get_one

    def get_one(self, action_id):
        """
            Outputs the file associated with action entry_point

            Handles requests:
                GET /actions/views/entry_point/1
        """
        LOG.info('GET /actions/views/overview with id=%s', action_id)
        action_db = LookupUtils._get_action_by_id(action_id)

        pack = getattr(action_db, 'pack', None)
        entry_point = getattr(action_db, 'entry_point', None)

        abs_path = RunnerContainerService.get_entry_point_abs_path(pack, entry_point)

        if not abs_path:
            raise StackStormDBObjectNotFoundError('Action id=%s has no entry_point to output'
                                                  % action_id)

        with open(abs_path) as file:
            content = file.read()

        return content
开发者ID:bjoernbessert,项目名称:st2,代码行数:23,代码来源:actionviews.py

示例10: _get_action_libs_abs_path

 def _get_action_libs_abs_path(self, pack, entry_point):
     return RunnerContainerService.get_action_libs_abs_path(pack=pack,
                                                            entry_point=entry_point)
开发者ID:beryah,项目名称:st2,代码行数:3,代码来源:base.py

示例11: test_report_result_json

 def test_report_result_json(self):
     service = RunnerContainerService()
     result = '["foo", {"bar": ["baz", null, 1.0, 2]}]'
     service.report_result(result)
     self.assertEqual(json.dumps(service.get_result()), result,
                      'JON results aren\'t handled right')
开发者ID:bjoernbessert,项目名称:st2,代码行数:6,代码来源:test_runner_container_service.py


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