Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
ó
čEYc@sÙddlZddlZddlZddlZddlmZddlmZddlZddl	m
Z
ddl	mZddlm
Z
ddlmZddlmZejd	d
gddd
dddƒejdddd
ddeddƒejdd
dgdejdddƒejdddƒgddƒejdd
dddƒgZejeƒZd„Zejejƒde fd „ƒYƒZ!e"e"e"d!„Z#d"e fd#„ƒYZ$d$e$fd%„ƒYZ%dS(&iÿÿÿÿN(tcfg(t	timeutils(t	extension(tnamed(t_LE(t
serializer(t	transporttdrivertdefaulttdeprecated_nametnotification_drivertdeprecated_grouptDEFAULTthelpstThe Drivers(s) to handle sending notifications. Possible values are messaging, messagingv2, routing, log, test, noopt
transport_urltnotification_transport_urltsecrets‚A URL representing the messaging driver to use for notifications. If not set, we fall back to the same configuration used for RPC.ttopicst
notificationstdeprecated_optstgroupt
rpc_notifier2tnotification_topicss,AMQP topic used for OpenStack notifications.tretrys—The maximum number of attempts to re-send a notification message which failed to be delivered due to a recoverable error. 0 - No retry, -1 - indefinitecCsptjddƒ}|jdddƒ|jdddƒ|jddd	ƒ|jd
dddd
ƒ|jdddddƒ|jddddd$dd
ƒ|jddddtjdƒjƒddƒ|jdƒ|jƒ}tjƒ}|gd|j	r
|j	gnd#ƒt|d |jƒ}t
||jd!|jd"|jƒ}|ji|j|j|jƒd#S(%s1Command line tool to send notifications manually.tdescriptions#Oslo.messaging notification sendings
--config-fileR
sPath to configuration files--transport-urls
Transport URLs--publisher-idsPublisher IDs--event-typeRttests
Event types--topictnargst*sTopic to send tos
--prioritytinfotchoicestaudittwarnterrortcriticaltsamples--drivertmessagingv2soslo.messaging.notify.driverssNotification drivertpayloadtdefault_config_filesturlRRN(sinfosauditswarnserrorscriticalssample(targparsetArgumentParsertadd_argumentRtExtensionManagertnamest
parse_argsRt
ConfigOptstconfig_filetNonetget_notification_transportRtNotifiertpublisher_idttopicRt_notifyt
event_typeR$tpriority(tparsertargstconfRtnotifier((sS/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_messaging/notify/notifier.pyt_send_notificationBsJ		
	tDrivercBs)eZdZd„Zejd„ƒZRS(sBase driver for NotificationscCs||_||_||_dS(s§base driver initialization

        :param conf: configuration options
        :param topics: list of topics
        :param transport: transport driver to use
        N(R9RR(tselfR9RR((sS/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_messaging/notify/notifier.pyt__init__qs		cCsdS(s"send a single notification with a specific priority

        :param ctxt: current request context
        :param msg: message to be sent
        :type msg: str
        :param priority: priority of the message
        :type priority: str
        :param retry: connection retries configuration (used by the messaging
                      driver):
                      None or -1 means to retry forever.
                      0 means no retry is attempted.
                      N means attempt at most N retries.
        :type retry: int
        N((R=tctxttmsgR6R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_messaging/notify/notifier.pytnotify|s(t__name__t
__module__t__doc__R>tabctabstractmethodRA(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_messaging/notify/notifier.pyR<ms	cCsD|jtddƒ|dkr.|jj}ntj||||ƒS(sbA factory method for Transport objects for notifications.

    This method should be used for notifications, in case notifications are
    being sent over a different message bus than normal messaging
    functionality; for example, using a different driver, or with different
    access permissions.

    If no transport URL is provided, the URL in the notifications section of
    the config file will be used.  If that URL is also absent, the same
    transport as specified in the messaging section will be used.

    If a transport URL is provided, then this function works exactly the same
    as get_transport.

    :param conf: the user configuration
    :type conf: cfg.ConfigOpts
    :param url: a transport URL, see :py:class:`transport.TransportURL`
    :type url: str or TransportURL
    :param allowed_remote_exmods: a list of modules which a client using this
                                  transport will deserialize remote exceptions
                                  from
    :type allowed_remote_exmods: list
    :param aliases: A map of transport alias to transport name
    :type aliases: dict
    Rtoslo_messaging_notificationsN(t
register_optst_notifier_optsR/RGRt
msg_transportt_get_transport(R9R&tallowed_remote_exmodstaliases((sS/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_messaging/notify/notifier.pyR0sR1cBs›eZdZdddddd„ZeƒZeed„Zddd„Zd„Z	d„Z
d„Zd„ZeZ
d„Zd	„Zd
„Zd„ZRS(
s7Send notification messages.

    The Notifier class is used for sending notification messages over a
    messaging transport or other means.

    Notification messages follow the following format::

        {'message_id': six.text_type(uuid.uuid4()),
         'publisher_id': 'compute.host1',
         'timestamp': timeutils.utcnow(),
         'priority': 'WARN',
         'event_type': 'compute.create_instance',
         'payload': {'instance_id': 12, ... }}

    A Notifier object can be instantiated with a transport object and a
    publisher ID:

        notifier = messaging.Notifier(get_notification_transport(CONF),
                                      'compute')

    and notifications are sent via drivers chosen with the driver
    config option and on the topics chosen with the topics config
    option in [oslo_messaging_notifications] section.

    Alternatively, a Notifier object can be instantiated with a specific
    driver or topic::

        transport = notifier.get_notification_transport(CONF)
        notifier = notifier.Notifier(transport,
                                     'compute.host',
                                     driver='messaging',
                                     topics=['notifications'])

    Notifier objects are relatively expensive to instantiate (mostly the cost
    of loading notification drivers), so it is possible to specialize a given
    Notifier object with a different publisher id using the prepare() method::

        notifier = notifier.prepare(publisher_id='compute')
        notifier.info(ctxt, event_type, payload)
    c
Csý|j}|jtddƒ||_||_|d
k	rF||_n|jj|_|d
k	rj|gn	|jj|_	|d
k	r‘||_
n|jj|_
|p¯tj
ƒ|_tjdd|j	dtd|gdi|j
d6|jd	6ƒ|_d
S(sƒConstruct a Notifier object.

        :param transport: the transport to use for sending messages
        :type transport: oslo_messaging.Transport
        :param publisher_id: field in notifications sent, for example
                             'compute.host1'
        :type publisher_id: str
        :param driver: a driver to lookup from oslo_messaging.notify.drivers
        :type driver: str
        :param serializer: an optional entity serializer
        :type serializer: Serializer
        :param retry: connection retries configuration (used by the messaging
                      driver):
                      None or -1 means to retry forever.
                      0 means no retry is attempted.
                      N means attempt at most N retries.
        :type retry: int
        :param topics: the topics which to send messages on
        :type topics: list of strings
        RRGsoslo.messaging.notify.driversR+tinvoke_on_loadtinvoke_argstinvoke_kwdsRRN(R9RHRIRR2R/RRGRt
_driver_namest_topicsRtmsg_serializertNoOpSerializert_serializerRtNamedExtensionManagertTruet_driver_mgr(R=RR2RRRRR9((sS/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_messaging/notify/notifier.pyR>Ýs,					
cCstj||d|ƒS(s¸Return a specialized Notifier instance.

        Returns a new Notifier instance with the supplied publisher_id. Allows
        sending notifications from multiple publisher_ids without the overhead
        of notification driver loading.

        :param publisher_id: field in notifications sent, for example
                             'compute.host1'
        :type publisher_id: str
        :param retry: connection retries configuration (used by the messaging
                      driver):
                      None or -1 means to retry forever.
                      0 means no retry is attempted.
                      N means attempt at most N retries.
        :type retry: int
        R(t_SubNotifiert_prepare(R=R2R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_messaging/notify/notifier.pytpreparescs¼ˆjjˆˆƒ‰ˆjjˆƒ‰tdtjtjƒƒd|pNˆjd|dˆdˆdtjt	j
ƒƒƒ‰‡‡‡‡‡‡fd†}ˆjjr¸ˆjj
|ƒndS(Nt
message_idR2R5R6R$t	timestampcsey&|jjˆˆˆˆp!ˆjƒWn8tk
r`}tjtdƒtd|dˆƒƒnXdS(NsNProblem '%(e)s' attempting to send to notification system. Payload=%(payload)steR$(tobjRARt	Exceptiont_LOGt	exceptionRtdict(textR^(R?R@R$R6RR=(sS/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_messaging/notify/notifier.pyt	do_notify4s
&(RUtserialize_entitytserialize_contextRctsixt	text_typetuuidtuuid4R2RtutcnowRXt
extensionstmap(R=R?R5R$R6R2RRe((R?R@R$R6RR=sS/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_messaging/notify/notifier.pyR4(scCs|j|||dƒdS(svSend a notification at audit level.

        :param ctxt: a request context dict
        :type ctxt: dict
        :param event_type: describes the event, for example
                           'compute.create_instance'
        :type event_type: str
        :param payload: the notification payload
        :type payload: dict
        :raises: MessageDeliveryFailure
        tAUDITN(R4(R=R?R5R$((sS/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_messaging/notify/notifier.pyR?scCs|j|||dƒdS(svSend a notification at debug level.

        :param ctxt: a request context dict
        :type ctxt: dict
        :param event_type: describes the event, for example
                           'compute.create_instance'
        :type event_type: str
        :param payload: the notification payload
        :type payload: dict
        :raises: MessageDeliveryFailure
        tDEBUGN(R4(R=R?R5R$((sS/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_messaging/notify/notifier.pytdebugMscCs|j|||dƒdS(suSend a notification at info level.

        :param ctxt: a request context dict
        :type ctxt: dict
        :param event_type: describes the event, for example
                           'compute.create_instance'
        :type event_type: str
        :param payload: the notification payload
        :type payload: dict
        :raises: MessageDeliveryFailure
        tINFON(R4(R=R?R5R$((sS/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_messaging/notify/notifier.pyR[scCs|j|||dƒdS(sxSend a notification at warning level.

        :param ctxt: a request context dict
        :type ctxt: dict
        :param event_type: describes the event, for example
                           'compute.create_instance'
        :type event_type: str
        :param payload: the notification payload
        :type payload: dict
        :raises: MessageDeliveryFailure
        tWARNN(R4(R=R?R5R$((sS/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_messaging/notify/notifier.pyRiscCs|j|||dƒdS(svSend a notification at error level.

        :param ctxt: a request context dict
        :type ctxt: dict
        :param event_type: describes the event, for example
                           'compute.create_instance'
        :type event_type: str
        :param payload: the notification payload
        :type payload: dict
        :raises: MessageDeliveryFailure
        tERRORN(R4(R=R?R5R$((sS/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_messaging/notify/notifier.pyR yscCs|j|||dƒdS(sySend a notification at critical level.

        :param ctxt: a request context dict
        :type ctxt: dict
        :param event_type: describes the event, for example
                           'compute.create_instance'
        :type event_type: str
        :param payload: the notification payload
        :type payload: dict
        :raises: MessageDeliveryFailure
        tCRITICALN(R4(R=R?R5R$((sS/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_messaging/notify/notifier.pyR!‡scCs|j|||dƒdS(sZSend a notification at sample level.

        Sample notifications are for high-frequency events
        that typically contain small payloads. eg: "CPU = 70%"

        Not all drivers support the sample level
        (log, for example) so these could be dropped.

        :param ctxt: a request context dict
        :type ctxt: dict
        :param event_type: describes the event, for example
                           'compute.create_instance'
        :type event_type: str
        :param payload: the notification payload
        :type payload: dict
        :raises: MessageDeliveryFailure
        tSAMPLEN(R4(R=R?R5R$((sS/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_messaging/notify/notifier.pyR"•scCs|jjƒdgkS(s«Check if the notifier will emit notifications anywhere.

        :return: false if the driver of the notifier is set only to noop, true
                 otherwise
        tnoop(RXR+(R=((sS/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_messaging/notify/notifier.pyt
is_enabled©sN(RBRCRDR/R>tobjectt_markerR[R4RRqRRtwarningR R!R"Rx(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_messaging/notify/notifier.pyR1²s")	4								RYcBs8eZejZd„Zd„Zeeed„ƒZRS(cCsI||_|j|_||_||_|jj|_|jj|_dS(N(t_baseRR2RRURX(R=tbaseR2R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_messaging/notify/notifier.pyR>¶s			cCs#tt|ƒj||||ƒdS(N(tsuperRYR4(R=R?R5R$R6((sS/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_messaging/notify/notifier.pyR4¿scCsI||jkr|j}n||jkr6|j}n|||d|ƒS(NR(RzR2R(tclsR}R2R((sS/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_messaging/notify/notifier.pyRZÂs
(RBRCR1RzR>R4tclassmethodRZ(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_messaging/notify/notifier.pyRY²s
				(&RER'tloggingRjtoslo_configRt
oslo_utilsRRht	stevedoreRRtoslo_messaging._i18nRtoslo_messagingRRSRRJtMultiStrOpttStrOptRWtListOptt
DeprecatedOpttIntOptRIt	getLoggerRBRaR;t
add_metaclasstABCMetaRyR<R/R0R1RY(((sS/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_messaging/notify/notifier.pyt<module>sN		+!"ÿ