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


Python Action.add_or_update方法代码示例

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


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

示例1: setUpClass

# 需要导入模块: from st2common.persistence.action import Action [as 别名]
# 或者: from st2common.persistence.action.Action import add_or_update [as 别名]
    def setUpClass(cls):
        super(TestMistralRunner, cls).setUpClass()
        runners_registrar.register_runner_types()

        for _, fixture in six.iteritems(FIXTURES['actions']):
            instance = ActionAPI(**fixture)
            Action.add_or_update(ActionAPI.to_model(instance))
开发者ID:emptywee,项目名称:st2,代码行数:9,代码来源:test_mistral_v2.py

示例2: setup_action_models

# 需要导入模块: from st2common.persistence.action import Action [as 别名]
# 或者: from st2common.persistence.action.Action import add_or_update [as 别名]
    def setup_action_models(cls):
        action_db = ActionDB()
        action_db.name = 'action-1'
        action_db.description = 'awesomeness'
        action_db.enabled = True
        action_db.pack = 'wolfpack'
        action_db.entry_point = ''
        action_db.runner_type = {'name': 'test-runner'}
        action_db.parameters = {
            'actionstr': {'type': 'string', 'required': True},
            'actionint': {'type': 'number', 'default': 10},
            'runnerdummy': {'type': 'string', 'default': 'actiondummy'},
            'runnerimmutable': {'type': 'string', 'default': 'failed_override'},
            'actionimmutable': {'type': 'string', 'default': 'actionimmutable', 'immutable': True}
        }
        RunnerContainerTest.action_db = Action.add_or_update(action_db)

        action_db = ActionDB()
        action_db.name = 'action-2'
        action_db.description = 'awesomeness'
        action_db.enabled = True
        action_db.pack = 'wolfpack'
        action_db.entry_point = ''
        action_db.runner_type = {'name': 'test-failingrunner'}
        action_db.parameters = {}
        RunnerContainerTest.failingaction_db = Action.add_or_update(action_db)
开发者ID:ojacques,项目名称:st2,代码行数:28,代码来源:test_runner_container.py

示例3: setUpClass

# 需要导入模块: from st2common.persistence.action import Action [as 别名]
# 或者: from st2common.persistence.action.Action import add_or_update [as 别名]
    def setUpClass(cls):
        super(ExecutionCancellationTestCase, cls).setUpClass()
        for _, fixture in six.iteritems(FIXTURES['actions']):
            instance = ActionAPI(**fixture)
            Action.add_or_update(ActionAPI.to_model(instance))

        runners_registrar.register_runners()
开发者ID:nzlosh,项目名称:st2,代码行数:9,代码来源:test_execution_cancellation.py

示例4: test_action_with_notify_crud

# 需要导入模块: from st2common.persistence.action import Action [as 别名]
# 或者: from st2common.persistence.action.Action import add_or_update [as 别名]
    def test_action_with_notify_crud(self):
        runnertype = self._create_save_runnertype(metadata=False)
        saved = self._create_save_action(runnertype, metadata=False)

        # Update action with notification settings
        on_complete = NotificationSubSchema(message='Action complete.')
        saved.notify = NotificationSchema(on_complete=on_complete)
        saved = Action.add_or_update(saved)

        # Check if notification settings were set correctly.
        retrieved = Action.get_by_id(saved.id)
        self.assertEqual(retrieved.notify.on_complete.message, on_complete.message)

        # Now reset notify in action to empty and validate it's gone.
        retrieved.notify = NotificationSchema(on_complete=None)
        saved = Action.add_or_update(retrieved)
        retrieved = Action.get_by_id(saved.id)
        self.assertEqual(retrieved.notify.on_complete, None)

        # cleanup
        self._delete([retrieved])
        try:
            retrieved = Action.get_by_id(saved.id)
        except ValueError:
            retrieved = None
        self.assertIsNone(retrieved, 'managed to retrieve after failure.')
开发者ID:bootinge,项目名称:st2,代码行数:28,代码来源:test_db.py

示例5: setUpClass

# 需要导入模块: from st2common.persistence.action import Action [as 别名]
# 或者: from st2common.persistence.action.Action import add_or_update [as 别名]
 def setUpClass(cls):
     super(TestActionExecutionHistoryWorker, cls).setUpClass()
     runners_registrar.register_runners()
     action_local = ActionAPI(**copy.deepcopy(fixture.ARTIFACTS["actions"]["local"]))
     Action.add_or_update(ActionAPI.to_model(action_local))
     action_chain = ActionAPI(**copy.deepcopy(fixture.ARTIFACTS["actions"]["chain"]))
     action_chain.entry_point = fixture.PATH + "/chain.yaml"
     Action.add_or_update(ActionAPI.to_model(action_chain))
开发者ID:pixelrebel,项目名称:st2,代码行数:10,代码来源:test_executions.py

示例6: setUpClass

# 需要导入模块: from st2common.persistence.action import Action [as 别名]
# 或者: from st2common.persistence.action.Action import add_or_update [as 别名]
    def setUpClass(cls):
        super(TestStreamController, cls).setUpClass()

        instance = RunnerTypeAPI(**RUNNER_TYPE_1)
        RunnerType.add_or_update(RunnerTypeAPI.to_model(instance))

        instance = ActionAPI(**ACTION_1)
        Action.add_or_update(ActionAPI.to_model(instance))
开发者ID:lyandut,项目名称:st2,代码行数:10,代码来源:test_stream.py

示例7: setUpClass

# 需要导入模块: from st2common.persistence.action import Action [as 别名]
# 或者: from st2common.persistence.action.Action import add_or_update [as 别名]
 def setUpClass(cls):
     super(TestActionExecutionHistoryWorker, cls).setUpClass()
     runners_registrar.register_runner_types()
     action_local = ActionAPI(**copy.deepcopy(fixture.ARTIFACTS['actions']['local']))
     Action.add_or_update(ActionAPI.to_model(action_local))
     action_chain = ActionAPI(**copy.deepcopy(fixture.ARTIFACTS['actions']['chain']))
     action_chain.entry_point = fixture.PATH + '/chain.yaml'
     Action.add_or_update(ActionAPI.to_model(action_chain))
开发者ID:Kailashkatheth1,项目名称:st2,代码行数:10,代码来源:test_executions.py

示例8: test_request_disabled_action

# 需要导入模块: from st2common.persistence.action import Action [as 别名]
# 或者: from st2common.persistence.action.Action import add_or_update [as 别名]
 def test_request_disabled_action(self):
     self.actiondb.enabled = False
     Action.add_or_update(self.actiondb)
     parameters = {'hosts': 'localhost', 'cmd': 'uname -a'}
     execution = LiveActionDB(action=ACTION_REF, parameters=parameters)
     self.assertRaises(ValueError, action_service.request, execution)
     self.actiondb.enabled = True
     Action.add_or_update(self.actiondb)
开发者ID:hejin,项目名称:st2,代码行数:10,代码来源:test_action.py

示例9: setUp

# 需要导入模块: from st2common.persistence.action import Action [as 别名]
# 或者: from st2common.persistence.action.Action import add_or_update [as 别名]
 def setUp(self):
     RUNNER_TYPE.id = None
     RunnerType.add_or_update(RUNNER_TYPE)
     ACTION.id = None
     ACTION.runner_type = {'name': RUNNER_TYPE.name}
     Action.add_or_update(ACTION)
     TRIGGER.id = None
     Trigger.add_or_update(TRIGGER)
开发者ID:ojacques,项目名称:st2,代码行数:10,代码来源:test_rules.py

示例10: setUpClass

# 需要导入模块: from st2common.persistence.action import Action [as 别名]
# 或者: from st2common.persistence.action.Action import add_or_update [as 别名]
 def setUpClass(cls):
     super(TestMistralRunner, cls).setUpClass()
     runners_registrar.register_runner_types()
     metadata = fixture.ARTIFACTS['metadata']
     action_local = ActionAPI(**copy.deepcopy(metadata['actions']['local']))
     Action.add_or_update(ActionAPI.to_model(action_local))
     action_wkflow = ActionAPI(**copy.deepcopy(metadata['actions']['workflow-v2']))
     Action.add_or_update(ActionAPI.to_model(action_wkflow))
开发者ID:bjoernbessert,项目名称:st2,代码行数:10,代码来源:test_mistral_v2.py

示例11: setUpClass

# 需要导入模块: from st2common.persistence.action import Action [as 别名]
# 或者: from st2common.persistence.action.Action import add_or_update [as 别名]
    def setUpClass(cls):
        super(DSLTransformTestCase, cls).setUpClass()

        for _, fixture in six.iteritems(FIXTURES['runners']):
            instance = RunnerTypeAPI(**fixture)
            RunnerType.add_or_update(RunnerTypeAPI.to_model(instance))

        for _, fixture in six.iteritems(FIXTURES['actions']):
            instance = ActionAPI(**fixture)
            Action.add_or_update(ActionAPI.to_model(instance))
开发者ID:StackStorm,项目名称:st2,代码行数:12,代码来源:test_util_mistral_dsl_transform.py

示例12: setUpClass

# 需要导入模块: from st2common.persistence.action import Action [as 别名]
# 或者: from st2common.persistence.action.Action import add_or_update [as 别名]
    def setUpClass(cls):
        super(MistralValidationControllerTest, cls).setUpClass()

        for _, fixture in six.iteritems(FIXTURES['runners']):
            instance = RunnerTypeAPI(**fixture)
            RunnerType.add_or_update(RunnerTypeAPI.to_model(instance))

        for _, fixture in six.iteritems(FIXTURES['actions']):
            instance = ActionAPI(**fixture)
            Action.add_or_update(ActionAPI.to_model(instance))
开发者ID:AlexeyDeyneko,项目名称:st2,代码行数:12,代码来源:test_validator_mistral.py

示例13: setUpClass

# 需要导入模块: from st2common.persistence.action import Action [as 别名]
# 或者: from st2common.persistence.action.Action import add_or_update [as 别名]
    def setUpClass(cls):
        super(MistralValidationTest, cls).setUpClass()

        for _, fixture in six.iteritems(FIXTURES["runners"]):
            instance = RunnerTypeAPI(**fixture)
            RunnerType.add_or_update(RunnerTypeAPI.to_model(instance))

        for _, fixture in six.iteritems(FIXTURES["actions"]):
            instance = ActionAPI(**fixture)
            Action.add_or_update(ActionAPI.to_model(instance))

        cls.validator = wf_validation_utils.get_validator()
开发者ID:azamsheriff,项目名称:st2,代码行数:14,代码来源:test_validator_mistral.py

示例14: setUpClass

# 需要导入模块: from st2common.persistence.action import Action [as 别名]
# 或者: from st2common.persistence.action.Action import add_or_update [as 别名]
    def setUpClass(cls):
        super(DSLTransformTestCase, cls).setUpClass()
        runners_registrar.register_runner_types()

        action_local = ActionAPI(**copy.deepcopy(FIXTURES['actions']['local.yaml']))
        Action.add_or_update(ActionAPI.to_model(action_local))

        for action_name in ['action1', 'action2', 'action3']:
            metadata = copy.deepcopy(FIXTURES['actions']['local.yaml'])
            metadata['name'] = action_name
            metadata['pack'] = 'demo'
            action = ActionAPI(**metadata)
            Action.add_or_update(ActionAPI.to_model(action))
开发者ID:Kailashkatheth1,项目名称:st2,代码行数:15,代码来源:test_mistral_dsl_transform.py

示例15: test_request_disabled_action

# 需要导入模块: from st2common.persistence.action import Action [as 别名]
# 或者: from st2common.persistence.action.Action import add_or_update [as 别名]
    def test_request_disabled_action(self):
        actiondb = self.actiondbs[ACTION['name']]
        actiondb.enabled = False
        Action.add_or_update(actiondb)

        try:
            parameters = {'hosts': 'localhost', 'cmd': 'uname -a'}
            execution = LiveActionDB(action=ACTION_REF, parameters=parameters)
            self.assertRaises(ValueError, action_service.request, execution)
        except Exception as e:
            raise e
        finally:
            actiondb.enabled = True
            Action.add_or_update(actiondb)
开发者ID:logikal,项目名称:st2,代码行数:16,代码来源:test_action.py


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