| Server IP : 61.19.30.66 / Your IP : 216.73.216.15 Web Server : Apache/2.2.22 (Ubuntu) System : Linux klw 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 User : www-data ( 33) PHP Version : 5.3.10-1ubuntu3.48 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /usr/lib/python2.7/dist-packages/landscape/broker/ |
Upload File : |
ó
}9Rc @ 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 d l
m Z d d l m
Z
d e f d
„ ƒ YZ d e f d „ ƒ YZ d
e f d „ ƒ YZ d S( s
Implementation of a lightweight exchange-triggering mechanism via
small HTTP requests asking if we should do a full exchange.
iÿÿÿÿN( t info( t Failure( t defer( t loads( t fetch( t log_failuret
PingClientc B s, e Z d Z d d „ Z d „ Z d „ Z RS( s: An HTTP client which knows how to talk to the ping server.c C s+ | d k r t } n | | _ | | _ d S( N( t NoneR t _reactort get_page( t selft reactorR ( ( s9 /usr/lib/python2.7/dist-packages/landscape/broker/ping.pyt __init__ s c sœ | d k r i d d 6} t j i | d 6ƒ } t j ƒ ‰ ‡ f d † } | j j ˆ j | | j | d t d | d | ƒˆ j
| j ƒ ˆ St j t
ƒ S( sr Ask the question: are there messages for this computer ID?
@param url: The URL of the ping server to hit.
@param insecure_id: This client's insecure ID, if C{None} no HTTP
request will be performed and the result will be C{False}.
@return: A deferred resulting in True if there are messages
and False otherwise.
s! application/x-www-form-urlencodeds Content-Typet insecure_idc s ˆ j t | | | ƒ ƒ d S( N( t errbackR ( t typet valuet tb( t
page_deferred( s9 /usr/lib/python2.7/dist-packages/landscape/broker/ping.pyR ) s t postt datat headersN( R t urllibt urlencodeR t DeferredR t call_in_threadt callbackR t Truet addCallbackt _got_resultt succeedt False( R
t urlR
R R R ( ( R s9 /usr/lib/python2.7/dist-packages/landscape/broker/ping.pyt ping s
c C s! t | ƒ i t d 6k r t Sd S( sº
Given a response that came from a ping server, return True if
the response indicates that their are messages waiting for
this computer, False otherwise.
t messagesN( R R ( R
t webtext( ( s9 /usr/lib/python2.7/dist-packages/landscape/broker/ping.pyR 3 s N( t __name__t
__module__t __doc__R R R! R ( ( ( s9 /usr/lib/python2.7/dist-packages/landscape/broker/ping.pyR s t Pingerc B sk e Z d Z e d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z
d „ Z d „ Z d
„ Z
RS( s‰
A plugin which pings the Landscape server with HTTP requests to
see if a full exchange should be initiated.
@param reactor: The reactor to schedule calls with.
@param identity: The L{Identity} holding the insecure ID used when pinging.
@param exchanger: The L{MessageExchange} to trigger exchanges with.
@param config: The L{BrokerConfiguration} to get the 'ping_url' and
'ping_interval' parameters from. The 'ping_url' specifies what URL
to hit when pinging, and 'ping_interval' how frequently to ping.
Changes in the configuration object will take effect from the next
scheduled ping.
c C sV | | _ | | _ | | _ | | _ d | _ d | _ | | _ | j d | j ƒ d S( Nt message(
t _configt _identityR t
_exchangerR t _call_idt _ping_clientt ping_client_factoryt call_ont _handle_set_intervals( R
R t identityt exchangert configR. ( ( s9 /usr/lib/python2.7/dist-packages/landscape/broker/ping.pyR L s c C s
| j j S( N( R) t ping_url( R
( ( s9 /usr/lib/python2.7/dist-packages/landscape/broker/ping.pyt get_urlW s c C s
| j j S( N( R) t
ping_interval( R
( ( s9 /usr/lib/python2.7/dist-packages/landscape/broker/ping.pyt get_intervalZ s c C s# | j | j ƒ | _ | j ƒ d S( s Start pinging.N( R. R R- t _schedule( R
( ( s9 /usr/lib/python2.7/dist-packages/landscape/broker/ping.pyt start] s c s[ ˆ j j ˆ j j ˆ j j ƒ } | j ˆ j ƒ | j ˆ j ƒ | j
‡ f d † ƒ d S( s8 Perform a ping; if there are messages, fire an exchange.c s
ˆ j ƒ S( N( R8 ( t _( R
( s9 /usr/lib/python2.7/dist-packages/landscape/broker/ping.pyt <lambda>h s N( R- R! R) R4 R* R
R R t
addErrbackt
_got_errort addBoth( R
t deferred( ( R
s9 /usr/lib/python2.7/dist-packages/landscape/broker/ping.pyR! b s
c C s* | r&