當前位置: 首頁>>代碼示例>>Python>>正文


Python RunnerContainerService.get_action_libs_abs_path方法代碼示例

本文整理匯總了Python中st2actions.container.service.RunnerContainerService.get_action_libs_abs_path方法的典型用法代碼示例。如果您正苦於以下問題:Python RunnerContainerService.get_action_libs_abs_path方法的具體用法?Python RunnerContainerService.get_action_libs_abs_path怎麽用?Python RunnerContainerService.get_action_libs_abs_path使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在st2actions.container.service.RunnerContainerService的用法示例。


在下文中一共展示了RunnerContainerService.get_action_libs_abs_path方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_get_action_libs_abs_path

# 需要導入模塊: from st2actions.container.service import RunnerContainerService [as 別名]
# 或者: from st2actions.container.service.RunnerContainerService import get_action_libs_abs_path [as 別名]
    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,代碼行數:18,代碼來源:test_runner_container_service.py

示例2: _invoke_post_run

# 需要導入模塊: from st2actions.container.service import RunnerContainerService [as 別名]
# 或者: from st2actions.container.service.RunnerContainerService import get_action_libs_abs_path [as 別名]
    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,代碼行數:30,代碼來源:base.py

示例3: test_get_action_libs_abs_path

# 需要導入模塊: from st2actions.container.service import RunnerContainerService [as 別名]
# 或者: from st2actions.container.service.RunnerContainerService import get_action_libs_abs_path [as 別名]
    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,代碼行數:19,代碼來源:test_runner_container_service.py

示例4: _get_action_libs_abs_path

# 需要導入模塊: from st2actions.container.service import RunnerContainerService [as 別名]
# 或者: from st2actions.container.service.RunnerContainerService import get_action_libs_abs_path [as 別名]
 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,代碼行數:5,代碼來源:base.py


注:本文中的st2actions.container.service.RunnerContainerService.get_action_libs_abs_path方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。