o
    wÚ7eÁ  ã                   @   sD   d dl mZ d dl mZ d dlmZ e e¡Zd
dd„Z	dd„ Z
d	S )é    )Úlog)Úutil)ÚSysConfFc           	      C   s    |sd S t | ƒ\}}d}| ¡ D ]\}}|d u rqt|ƒ}t|ƒdkr&|s&q|||< |d7 }q|rNt|ƒg}|s@| dt ¡ ¡ t | d |¡d d¡ d S d S )Nr   é   Ú
i¤  )	Úread_sysconfig_fileÚitemsÚstrÚlenÚinsertr   Úmake_headerÚ
write_fileÚjoin)	ÚfnÚadjustmentsÚallow_emptyÚexistsÚcontentsÚ
updated_amÚkÚvÚlines© r   ú=/usr/lib/python3/dist-packages/cloudinit/distros/rhel_util.pyÚupdate_sysconfig_file   s&   
ÿúr   c                 C   s>   d}zt  | ¡ ¡ }d}W n ty   g }Y nw |t|ƒfS )NFT)r   Ú	load_fileÚ
splitlinesÚIOErrorr   )r   r   r   r   r   r   r   *   s   ÿr   N)F)Ú	cloudinitr   Úloggingr   Ú"cloudinit.distros.parsers.sys_confr   Ú	getLoggerÚ__name__ÚLOGr   r   r   r   r   r   Ú<module>   s   


