ó
˝-'Nc           @   s:   d  d l  m Z d  d l m Z d e f d     YZ d S(   i˙˙˙˙(   t   succeed(   t   get_active_device_infot   Networkc           B   s,   e  Z d  Z d d  Z d   Z d   Z RS(   sÍ   Show information about active network interfaces.

    @param get_device_info: Optionally, a function that returns information
        about network interfaces.  Defaults to L{get_active_device_info}.
    c         C   s"   | d  k r t } n  | |  _ d  S(   N(   t   NoneR   t   _get_device_info(   t   selft   get_device_info(    (    s=   /usr/lib/python2.7/dist-packages/landscape/sysinfo/network.pyt   __init__   s    	c         C   s   | |  _  d S(   se   Register this plugin with the sysinfo system.

        @param sysinfo: The sysinfo registry.
        N(   t   _sysinfo(   R   t   sysinfo(    (    s=   /usr/lib/python2.7/dist-packages/landscape/sysinfo/network.pyt   register   s    c         C   sL   x? |  j    D]1 } | d } | d } |  j j d | |  q Wt d  S(   s   
        Gather information about network interfaces and write it to the
        sysinfo output.

        @return: A succeeded C{Deferred}.
        t	   interfacet
   ip_addresss   IP address for %sN(   R   R   t
   add_headerR    R   (   R   t   infoR   R   (    (    s=   /usr/lib/python2.7/dist-packages/landscape/sysinfo/network.pyt   run   s    

N(   t   __name__t
   __module__t   __doc__R   R   R
   R   (    (    (    s=   /usr/lib/python2.7/dist-packages/landscape/sysinfo/network.pyR      s   	N(   t   twisted.internet.deferR    t   landscape.lib.networkR   t   objectR   (    (    (    s=   /usr/lib/python2.7/dist-packages/landscape/sysinfo/network.pyt   <module>   s   