Current Path : /usr/lib/python2.7/dist-packages/landscape/ |
Current File : //usr/lib/python2.7/dist-packages/landscape/textmessage.pyc |
ó ÍÿŠTc @ sµ d Z d d l Z d d l m Z d d l m Z d d l m Z d d l m Z d e f d „ ƒ YZ d e f d „ ƒ YZ d „ Z d „ Z d „ Z d „ Z e j d „ Z d S( s Support code for the C{landscape-message} utility, which sends a text message to the Landscape web UI via the landscape-client's dbus messaging service (see L{landscape.plugins.dbus_message}). iÿÿÿÿN( t log_failure( t LandscapeReactor( t RemoteBrokerConnector( t Configurationt AcceptedTypeErrorc B s e Z d Z RS( sZ Raised when a message is sent without 'text-message' being an accepted type. ( t __name__t __module__t __doc__( ( ( s9 /usr/lib/python2.7/dist-packages/landscape/textmessage.pyR s t EmptyMessageErrorc B s e Z d Z RS( s( Raised when an empty message is provied.( R R R ( ( ( s9 /usr/lib/python2.7/dist-packages/landscape/textmessage.pyR s c sC ‡ ‡ f d † } i d d 6| d 6‰ ˆ j ƒ } | j | ƒ | S( s Add a message to the queue via a remote broker. The message is of type C{text-message}. @param broker: A connected L{RemoteBroker} object to use to send the message. @return: A L{Deferred} which will fire with the result of the send. c s ˆ j ˆ | t ƒ } | S( N( t send_messaget True( t session_idt response( t messaget broker( s9 /usr/lib/python2.7/dist-packages/landscape/textmessage.pyt got_session_id# s s text-messaget typeR ( t get_session_idt addCallback( t textR R t result( ( R R s9 /usr/lib/python2.7/dist-packages/landscape/textmessage.pyR s c C s d GHd S( Nu Message sent.( ( R ( ( s9 /usr/lib/python2.7/dist-packages/landscape/textmessage.pyt got_result- s c C sŒ t j j p d } t | ƒ d k rD d GHt j j ƒ j | ƒ } n/ d j g | d D] } | j | ƒ ^ qU ƒ } | sˆ t d ƒ ‚ n | S( Ns UTF-8i sN Please enter your message, and send EOF (Control + D after newline) when done.u i s Text messages may not be empty.( t syst stdint encodingt lent readt decodet joinR ( t argsR R t x( ( s9 /usr/lib/python2.7/dist-packages/landscape/textmessage.pyt get_message1 s /c C sG d | k r t d ƒ ‚ n t | ƒ } t | | ƒ } | j t ƒ | S( Ns text-messagesR Text messages may not be created. Is Landscape Client registered with the server?( R R R R R ( t accepted_typesR R R t d( ( s9 /usr/lib/python2.7/dist-packages/landscape/textmessage.pyt got_accepted_types>