File: //lib/python2.7/site-packages/firewall/core/io/ifcfg.pyc
�
�G�`c           @   s�   d  Z  d g Z d d l Z d d l Z d d l Z d d l Z d d l m Z d d l	 m
 Z
 m Z m Z d e
 f d �  �  YZ d S(   s   ifcfg file parsert   ifcfgi����N(   t   log(   t   b2ut   u2bt   PY2c           B   sP   e  Z d  �  Z d �  Z d �  Z d �  Z d �  Z d �  Z d �  Z d �  Z	 RS(   c         C   s)   i  |  _  g  |  _ | |  _ |  j �  d  S(   N(   t   _configt   _deletedt   filenamet   clear(   t   selfR   (    (    s:   /usr/lib/python2.7/site-packages/firewall/core/io/ifcfg.pyt   __init__#   s    			c         C   s   i  |  _  g  |  _ d  S(   N(   R   R   (   R	   (    (    s:   /usr/lib/python2.7/site-packages/firewall/core/io/ifcfg.pyR   )   s    	c         C   s   |  j  j �  d  S(   N(   R   R   (   R	   (    (    s:   /usr/lib/python2.7/site-packages/firewall/core/io/ifcfg.pyt   cleanup-   s    c         C   s   |  j  j | j �  � S(   N(   R   t   gett   strip(   R	   t   key(    (    s:   /usr/lib/python2.7/site-packages/firewall/core/io/ifcfg.pyR   0   s    c         C   sQ   t  | j �  � } t  | j �  � |  j | <| |  j k rM |  j j | � n  d  S(   N(   R   R
   R   R   t   remove(   R	   R   t   valuet   _key(    (    s:   /usr/lib/python2.7/site-packages/firewall/core/io/ifcfg.pyt   set3   s    c         C   sa   d } xD |  j  j �  D]3 \ } } | r5 | d 7} n  | d | | f 7} q Wt r] t | � S| S(   Nt    s   
s   %s=%s(   R   t   itemsR   R   (   R	   t   sR   R   (    (    s:   /usr/lib/python2.7/site-packages/firewall/core/io/ifcfg.pyt   __str__9   s    
c         C   s�  |  j  �  y t |  j d � } Wn, t k
 rN } t j d |  j | � �  n XxL| D]D} | sf Pn  | j �  } t | � d k  sV | d d
 k r� qV n  g  | j d d � D] } | j �  ^ q� } t | � d k r� qV n  t | d � d k r1| d j	 d	 � r1| d j
 d	 � r1| d d d
 !| d <n  | d d k rGqV n>