ó
ÍÿŠTc           @   s<   d  Z  d d l Z d d l m Z d e f d „  ƒ  YZ d S(   s#   Configuration class for the broker.iÿÿÿÿN(   t   Configurationt   BrokerConfigurationc           B   sG   e  Z d  Z d „  Z e d „  ƒ Z d „  Z e d „  ƒ Z d „  Z RS(   s`   Specialized configuration for the Landscape Broker.

    @cvar required_options: C{["url"]}
    c         C   sA   t  t |  ƒ j ƒ  t j j d ƒ |  _ t j j d ƒ |  _ d  S(   Nt
   http_proxyt   https_proxy(   t   superR   t   __init__t   ost   environt   gett   _original_http_proxyt   _original_https_proxy(   t   self(    (    s;   /usr/lib/python2.7/dist-packages/landscape/broker/config.pyR      s    c         C   s   t  j j |  j d ƒ S(   Ns   exchange.database(   R   t   patht   joint	   data_path(   R   (    (    s;   /usr/lib/python2.7/dist-packages/landscape/broker/config.pyt   exchange_store_path   s    c      
   C   s:  t  t |  ƒ j ƒ  } | j d d d d d d ƒ| j d d d d	 d d
 ƒ| j d d d d d d ƒ| j d d d' d d d d d d ƒ| j d d d( d d d d d d ƒ| j d d d d d d d d d ƒ| j d d d d d ƒ| j d  d d d d! ƒ| j d" d d# d d$ ƒ| j d% d d& ƒ| S()   s±  Parser factory for broker-specific options.

        @return: An L{OptionParser} preset for all the options
            from L{Configuration.make_parser} plus:
              - C{account_name}
              - C{registration_key}
              - C{computer_title}
              - C{exchange_interval} (C{15*60})
              - C{urgent_exchange_interval} (C{1*60})
              - C{http_proxy}
              - C{https_proxy}
        s   -as   --account-namet   metavart   NAMEt   helps%   The account this computer belongs to.s   -ps   --registration-keyt   KEYs2   The account-wide key used for registering clients.s   -ts   --computer-titlet   TITLEs   The title of this computers   --exchange-intervalt   defaulti   i<   t   typet   intt   INTERVALs/   The number of seconds between server exchanges.s   --urgent-exchange-intervali   s6   The number of seconds between urgent server exchanges.s   --ping-intervali   s$   The number of seconds between pings.s   --http-proxyt   URLs,   The URL of the HTTP proxy, if one is needed.s   --https-proxys-   The URL of the HTTPS proxy, if one is needed.s   --access-groupt    s)   Suggested access group for this computer.s   --tagss;   Comma separated list of tag names to be sent to the server.i„  i<   (   R   R   t   make_parsert
   add_option(   R   t   parser(    (    s;   /usr/lib/python2.7/dist-packages/landscape/broker/config.pyR      s2    c         C   s   t  j j |  j d ƒ S(   s"   Get the path to the message store.t   messages(   R   R   R   R   (   R   (    (    s;   /usr/lib/python2.7/dist-packages/landscape/broker/config.pyt   message_store_pathD   s    c         C   sŠ   t  t |  ƒ j | ƒ |  j r2 |  j t j d <n |  j rN |  j t j d <n  |  j rj |  j t j d <n |  j r† |  j t j d <n  d S(   sø   
        Load options from command line arguments and a config file.

        Load the configuration with L{Configuration.load}, and then set
        C{http_proxy} and C{https_proxy} environment variables based on
        that config data.
        R   R   N(	   R   R   t   loadR   R   R   R	   R   R
   (   R   t   args(    (    s;   /usr/lib/python2.7/dist-packages/landscape/broker/config.pyR    I   s    				(	   t   __name__t
   __module__t   __doc__R   t   propertyR   R   R   R    (    (    (    s;   /usr/lib/python2.7/dist-packages/landscape/broker/config.pyR      s   		-(   R$   R   t   landscape.deploymentR    R   (    (    (    s;   /usr/lib/python2.7/dist-packages/landscape/broker/config.pyt   <module>   s   