Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/landscape/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/landscape/textmessage.pyc

ó
ÍÿŠTc@sµdZddlZddlmZddlmZddlmZddlm	Z	de
fd„ƒYZd	e
fd
„ƒYZd„Z
d„Zd
„Zd„Zejd„ZdS(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(tlog_failure(tLandscapeReactor(tRemoteBrokerConnector(t
ConfigurationtAcceptedTypeErrorcBseZdZRS(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.pyRstEmptyMessageErrorcBseZdZRS(s(Raised when an empty message is provied.(RRR(((s9/usr/lib/python2.7/dist-packages/landscape/textmessage.pyRscsC‡‡fd†}idd6|d6‰ˆjƒ}|j|ƒ|S(sAdd 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.
    csˆjˆ|tƒ}|S(N(tsend_messagetTrue(t
session_idtresponse(tmessagetbroker(s9/usr/lib/python2.7/dist-packages/landscape/textmessage.pytgot_session_id#sstext-messagettypeR
(tget_session_idtaddCallback(ttextRRtresult((R
Rs9/usr/lib/python2.7/dist-packages/landscape/textmessage.pyR	s
	
cCs	dGHdS(Nu
Message sent.((R((s9/usr/lib/python2.7/dist-packages/landscape/textmessage.pyt
got_result-scCsŒtjjpd}t|ƒdkrDdGHtjjƒj|ƒ}n/djg|dD]}|j|ƒ^qUƒ}|sˆtdƒ‚n|S(NsUTF-8isNPlease enter your message, and send EOF (Control + D after newline) when done.u isText messages may not be empty.(tsyststdintencodingtlentreadtdecodetjoinR(targsRR
tx((s9/usr/lib/python2.7/dist-packages/landscape/textmessage.pytget_message1s/cCsGd|krtdƒ‚nt|ƒ}t||ƒ}|jtƒ|S(Nstext-messagesRText messages may not be created.  Is Landscape Client registered with the server?(RRR	RR(taccepted_typesRRR
td((s9/usr/lib/python2.7/dist-packages/landscape/textmessage.pytgot_accepted_types>s
cs¦tƒ‰tƒ}|jˆƒ‡fd†}d„}tˆ|ƒ‰ˆjƒ}|j|ƒ|j|ƒ|j‡fd†ƒ|j‡fd†ƒˆjƒ|S(s‡Send a message to Landscape.

    This function runs a Twisted reactor, prints various status
    messages, and exits the process.
    cs|jƒ}|jt|ˆƒS(N(tget_accepted_message_typesRR"(RR(R(s9/usr/lib/python2.7/dist-packages/landscape/textmessage.pytgot_connectionRscSst|ƒdS(N(R(tfailure((s9/usr/lib/python2.7/dist-packages/landscape/textmessage.pyt	got_errorVscs
ˆjƒS(N(t
disconnect(R(t	connector(s9/usr/lib/python2.7/dist-packages/landscape/textmessage.pyt<lambda>]scsˆjdˆjjƒS(Ni(t
call_latert_reactortstop(tignored(treactor(s9/usr/lib/python2.7/dist-packages/landscape/textmessage.pyR)bs(	RRtloadRtconnectRt
addErrbacktaddBothtrun(RtconfigR$R&R((R.RR(s9/usr/lib/python2.7/dist-packages/landscape/textmessage.pyR3Hs		
	


(RRtlandscape.lib.logRtlandscape.reactorRtlandscape.broker.ampRtlandscape.deploymentRt	ExceptionRRR	RRR"targvR3(((s9/usr/lib/python2.7/dist-packages/landscape/textmessage.pyt<module>s