本文整理汇总了Python中st2common.persistence.action.Action.get_by_ref方法的典型用法代码示例。如果您正苦于以下问题:Python Action.get_by_ref方法的具体用法?Python Action.get_by_ref怎么用?Python Action.get_by_ref使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类st2common.persistence.action.Action
的用法示例。
在下文中一共展示了Action.get_by_ref方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_runner_ref
# 需要导入模块: from st2common.persistence.action import Action [as 别名]
# 或者: from st2common.persistence.action.Action import get_by_ref [as 别名]
def _get_runner_ref(self, action_ref):
"""
Retrieve a runner reference for the provided action.
:rtype: ``str``
"""
action = Action.get_by_ref(action_ref)
return action['runner_type']['name']
示例2: get_action_by_ref
# 需要导入模块: from st2common.persistence.action import Action [as 别名]
# 或者: from st2common.persistence.action.Action import get_by_ref [as 别名]
def get_action_by_ref(ref):
"""
Returns the action object from db given a string ref.
:param ref: Reference to the trigger type db object.
:type ref: ``str``
:rtype action: ``object``
"""
try:
return Action.get_by_ref(ref)
except ValueError as e:
LOG.debug('Database lookup for ref="%s" resulted ' + "in exception : %s.", ref, e, exc_info=True)
return None
示例3: _register_action_alias
# 需要导入模块: from st2common.persistence.action import Action [as 别名]
# 或者: from st2common.persistence.action.Action import get_by_ref [as 别名]
def _register_action_alias(self, pack, action_alias):
action_alias_db = self._get_action_alias_db(pack=pack,
action_alias=action_alias)
try:
action_alias_db.id = ActionAlias.get_by_name(action_alias_db.name).id
except StackStormDBObjectNotFoundError:
LOG.debug('ActionAlias %s not found. Creating new one.', action_alias)
action_ref = action_alias_db.action_ref
action_db = Action.get_by_ref(action_ref)
if not action_db:
LOG.warning('Action %s not found in DB. Did you forget to register the action?',
action_ref)
try:
action_alias_db = ActionAlias.add_or_update(action_alias_db)
extra = {'action_alias_db': action_alias_db}
LOG.audit('Action alias updated. Action alias %s from %s.', action_alias_db,
action_alias, extra=extra)
except Exception:
LOG.exception('Failed to create action alias %s.', action_alias_db.name)
raise
示例4: _get_runner
# 需要导入模块: from st2common.persistence.action import Action [as 别名]
# 或者: from st2common.persistence.action.Action import get_by_ref [as 别名]
def _get_runner(self, action_ref):
action = Action.get_by_ref(action_ref)
return action['runner_type']['name']