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


Python DirectResponse.exception方法代码示例

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


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

示例1: parseFilter

# 需要导入模块: from Products.ZenUtils.extdirect.router import DirectResponse [as 别名]
# 或者: from Products.ZenUtils.extdirect.router.DirectResponse import exception [as 别名]
 def parseFilter(self, source):
     try:
         response = self._getFacade().parseFilter(source)
         return DirectResponse.succeed(data=response)
     except Exception, e:
         log.exception(e)
         return DirectResponse.exception(e, "Error parsing filter source. Please check your syntax.")
开发者ID:jpeacock-zenoss,项目名称:zenoss-prodbin,代码行数:9,代码来源:triggers.py

示例2: add_event

# 需要导入模块: from Products.ZenUtils.extdirect.router import DirectResponse [as 别名]
# 或者: from Products.ZenUtils.extdirect.router.DirectResponse import exception [as 别名]
    def add_event(self, summary, device, component, severity, evclasskey, evclass=None):
        """
        Create a new event.

        @type  summary: string
        @param summary: New event's summary
        @type  device: string
        @param device: Device uid to use for new event
        @type  component: string
        @param component: Component uid to use for new event
        @type  severity: string
        @param severity: Severity of new event. Can be one of the following:
                         Critical, Error, Warning, Info, Debug, or Clear
        @type  evclasskey: string
        @param evclasskey: The Event Class Key to assign to this event
        @type  evclass: string
        @param evclass: Event class for the new event
        @rtype:   DirectResponse
        """
        try:
            self.zep.create(summary, severity, device, component, eventClassKey=evclasskey, eventClass=evclass)
            return DirectResponse.succeed("Created event")
        except NoConsumersException:
            # This occurs if the event is queued but there are no consumers - i.e. zeneventd is not
            # currently running.
            msg = 'Queued event. Check zeneventd status on <a href="/zport/About/zenossInfo">Daemons</a>'
            return DirectResponse.succeed(msg, sticky=True)
        except PublishException, e:
            # This occurs if there is a failure publishing the event to the queue.
            log.exception("Failed creating event")
            return DirectResponse.exception(e, "Failed to create event")
开发者ID:c0ns0le,项目名称:zenoss-4,代码行数:33,代码来源:zep.py

示例3: add_event

# 需要导入模块: from Products.ZenUtils.extdirect.router import DirectResponse [as 别名]
# 或者: from Products.ZenUtils.extdirect.router.DirectResponse import exception [as 别名]
    def add_event(self, summary, device, component, severity, evclasskey,
                  evclass=None, monitor=None, **kwargs):
        """
        Create a new event.

        @type  summary: string
        @param summary: New event's summary
        @type  device: string
        @param device: Device id to use for new event
        @type  component: string
        @param component: Component uid to use for new event
        @type  severity: string
        @param severity: Severity of new event. Can be one of the following:
                         Critical, Error, Warning, Info, Debug, or Clear
        @type  evclasskey: string
        @param evclasskey: The Event Class Key to assign to this event
        @type  evclass: string
        @param evclass: Event class for the new event
        @rtype:   DirectResponse

        For other parameters please see class Event.
        """
        device = device.strip()  # ZEN-2479: support entries like "localhost "
        try:
            self.zep.create(summary, severity, device, component,
                            eventClassKey=evclasskey, eventClass=evclass,
                            monitor=monitor, **kwargs)
            return DirectResponse.succeed("Created event")
        except NoConsumersException:
            # This occurs if the event is queued but there are no consumers - i.e. zeneventd is not
            # currently running.
            msg = 'Queued event. Check zeneventd status on <a href="/zport/dmd/daemons">Services</a>'
            return DirectResponse.succeed(msg, sticky=True)
        except PublishException, e:
            # This occurs if there is a failure publishing the event to the queue.
            log.exception("Failed creating event")
            return DirectResponse.exception(e, "Failed to create event")
开发者ID:zenoss,项目名称:zenoss-prodbin,代码行数:39,代码来源:zep.py


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