ó
œ-'Nc           @   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   sb   e  Z d  Z d g Z d   Z e d    Z e d    Z d   Z e d    Z	 e
 d  Z RS(   s`   Specialized configuration for the Landscape Broker.

    @cvar required_options: C{["url"]}
    t   urlc         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  j j |  j d  S(   Nt	   exchanges(   R   R   R   R   (   R   (    (    s;   /usr/lib/python2.7/dist-packages/landscape/broker/config.pyt   record_directory   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 | j d d d d | j d d d1 d d d d d d | j d d d2 d d d d d d | j 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, | j d- d d. | j d/ d( d) d d0 | S(3   sU  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_password}
              - C{computer_title}
              - C{url}
              - C{ssl_public_key}
              - C{exchange_interval} (C{15*60})
              - C{urgent_exchange_interval} (C{1*60})
              - C{ping_url}
              - C{http_proxy}
              - C{https_proxy}
              - C{cloud}
              - C{otp}
              - C{record}
        s   -as   --account-namet   metavart   NAMEt   helps%   The account this computer belongs to.s   -ps   --registration-passwordt   PASSWORDs7   The account-wide password used for registering clients.s   -ts   --computer-titlet   TITLEs   The title of this computers   -us   --urls   The server URL to connect to.s   -ks   --ssl-public-keysM   The public SSL key to verify the server. Only used if the given URL is https.s   --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-urls8   The URL to perform lightweight exchange initiation with.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   --cloudt   actiont
   store_trues-   Set this if your computer is in an EC2 cloud.s   --otps&   The OTP to use in cloud configuration.s   --tagss;   Comma separated list of tag names to be sent to the server.s   --records-   Record data sent to the server on filesystem i  i<   (   R   R   t   make_parsert
   add_option(   R   t   parser(    (    s;   /usr/lib/python2.7/dist-packages/landscape/broker/config.pyR      s@    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_pathX   s    c         C   s   t  t |   j | d | |  j r8 |  j t j d <n |  j rT |  j t j d <n  |  j rp |  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.
        t   accept_nonexistent_configR   R   N(	   R   R   t   loadR   R   R   R
   R   R   (   R   t   argsR$   (    (    s;   /usr/lib/python2.7/dist-packages/landscape/broker/config.pyR%   ]   s    				(   t   __name__t
   __module__t   __doc__t   required_optionsR   t   propertyR   R   R   R#   t   FalseR%   (    (    (    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   