本文整理汇总了Python中st2common.models.db.action.ActionDB.entry_point方法的典型用法代码示例。如果您正苦于以下问题:Python ActionDB.entry_point方法的具体用法?Python ActionDB.entry_point怎么用?Python ActionDB.entry_point使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类st2common.models.db.action.ActionDB
的用法示例。
在下文中一共展示了ActionDB.entry_point方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_action_models
# 需要导入模块: from st2common.models.db.action import ActionDB [as 别名]
# 或者: from st2common.models.db.action.ActionDB import entry_point [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)
示例2: _register_action
# 需要导入模块: from st2common.models.db.action import ActionDB [as 别名]
# 或者: from st2common.models.db.action.ActionDB import entry_point [as 别名]
def _register_action(self, pack, action):
content = self._meta_loader.load(action)
action_ref = ResourceReference(pack=pack, name=str(content['name']))
model = action_utils.get_action_by_ref(action_ref)
if not model:
model = ActionDB()
model.name = content['name']
model.description = content['description']
model.enabled = content['enabled']
model.pack = pack
model.entry_point = content['entry_point']
model.parameters = content.get('parameters', {})
runner_type = str(content['runner_type'])
valid_runner_type, runner_type_db = self._has_valid_runner_type(runner_type)
if valid_runner_type:
model.runner_type = {'name': runner_type_db.name}
else:
LOG.exception('Runner type %s doesn\'t exist.', runner_type)
raise
try:
model = Action.add_or_update(model)
LOG.audit('Action created. Action %s from %s.', model, action)
except Exception:
LOG.exception('Failed to write action to db %s.', model.name)
raise
示例3: setup_action_models
# 需要导入模块: from st2common.models.db.action import ActionDB [as 别名]
# 或者: from st2common.models.db.action.ActionDB import entry_point [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.ref = ResourceReference(name=action_db.name, pack=action_db.pack).ref
action_db.entry_point = ''
action_db.runner_type = {'name': 'test-runner'}
action_db.parameters = {
'actionstr': {'type': 'string', 'position': 1, 'required': True},
'actionint': {'type': 'number', 'default': 10, 'position': 0},
'runnerdummy': {'type': 'string', 'default': 'actiondummy'}
}
ActionDBUtilsTestCase.action_db = Action.add_or_update(action_db)
liveaction_db = LiveActionDB()
liveaction_db.status = 'initializing'
liveaction_db.start_timestamp = get_datetime_utc_now()
liveaction_db.action = ActionDBUtilsTestCase.action_db.ref
params = {
'actionstr': 'foo',
'some_key_that_aint_exist_in_action_or_runner': 'bar',
'runnerint': 555
}
liveaction_db.parameters = params
ActionDBUtilsTestCase.liveaction_db = LiveAction.add_or_update(liveaction_db)
示例4: _register_action
# 需要导入模块: from st2common.models.db.action import ActionDB [as 别名]
# 或者: from st2common.models.db.action.ActionDB import entry_point [as 别名]
def _register_action(self, pack, action):
with open(action, 'r') as fd:
try:
content = json.load(fd)
except ValueError:
LOG.exception('Failed loading action json from %s.', action)
raise
try:
model = Action.get_by_name(str(content['name']))
except ValueError:
model = ActionDB()
model.name = content['name']
model.description = content['description']
model.enabled = content['enabled']
model.pack = pack
model.entry_point = content['entry_point']
model.parameters = content.get('parameters', {})
runner_type = str(content['runner_type'])
valid_runner_type, runner_type_db = self._has_valid_runner_type(runner_type)
if valid_runner_type:
model.runner_type = {'name': runner_type_db.name}
else:
LOG.exception('Runner type %s doesn\'t exist.')
raise
try:
model = Action.add_or_update(model)
LOG.audit('Action created. Action %s from %s.', model, action)
except Exception:
LOG.exception('Failed to write action to db %s.', model.name)
raise
示例5: _setup_action_models
# 需要导入模块: from st2common.models.db.action import ActionDB [as 别名]
# 或者: from st2common.models.db.action.ActionDB import entry_point [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', 'immutable': True},
'runnerimmutable': {'type': 'string', 'default': 'failed_override'},
'actionimmutable': {'type': 'string', 'default': 'actionimmutable', 'immutable': True}
}
ParamsUtilsTest.action_db = action_db
示例6: _create_save_action
# 需要导入模块: from st2common.models.db.action import ActionDB [as 别名]
# 或者: from st2common.models.db.action.ActionDB import entry_point [as 别名]
def _create_save_action(runnertype, metadata=False):
created = ActionDB()
created.name = 'action-1'
created.description = 'awesomeness'
created.enabled = True
created.entry_point = '/tmp/action.py'
created.pack = 'wolfpack'
created.ref = ResourceReference(pack=created.pack, name=created.name).ref
created.runner_type = {'name': runnertype.name}
if not metadata:
created.parameters = {'p1': None, 'p2': None, 'p3': None}
else:
created.parameters = {
'p1': {'type': 'string', 'required': True},
'p2': {'type': 'number', 'default': 2868},
'p3': {'type': 'boolean', 'default': False}
}
return Action.add_or_update(created)