� oB�]c@sxdZddlmZddlmZddlmZeje�Z eZ id d6dd6Z e d�Zd �Zd S( s< Fan --- **Summary:** configure ubuntu fan networking This module installs, configures and starts the ubuntu fan network system. For more information about Ubuntu Fan, see: ``https://wiki.ubuntu.com/FanNetworking``. If cloud-init sees a ``fan`` entry in cloud-config it will: - write ``config_path`` with the contents of the ``config`` key - install the package ``ubuntu-fan`` if it is not installed - ensure the service is started (or restarted if was previously running) **Internal name:** ``cc_fan`` **Module frequency:** per instance **Supported distros:** ubuntu **Config keys**:: fan: config: | # fan 240 10.0.0.0/8 eth0/16 dhcp 10.0.0.0/8 eth1/16 dhcp off # fan 241 241.0.0.0/8 eth0/16 dhcp config_path: /etc/network/fan i����(tlog(t PER_INSTANCE(tutiltconfigs/etc/network/fant config_pathcs!|r?idd�gd6dd�gd6dd�gd6}n iddgd6ddgd6}�fd�}||ddd�� }|jd �s�|d 7}ntj||d d �||ddd ��}|r�|r�tjd ��nd|kr||ddd��}n|S(Nt systemctltstoptstarttenabletservicecsKytj|dt�SWn-tjk rF}tjd�||�tSXdS(Ntcapturesfailed: %s (%s): %s(RtsubptTruetProcessExecutionErrortLOGtwarningtFalse(tcmdtmsgte(R (s;/usr/lib/python2.7/site-packages/cloudinit/config/cc_fan.pytrun?s Rsstop %ss tomodetwsstart %sssuccess: %s starteds enable %s(tendswithRt write_fileRR(R t config_filetcontenttsystemdtcmdsRt stop_failedtret((R s;/usr/lib/python2.7/site-packages/cloudinit/config/cc_fan.pytstop_update_start6s"   c Cs�|jd�}|si}ntj|tg�}|jd�sVtjd|�dStj|jd�|jd�dd�|j}tjd�s�|j dg�nt d dd |jd�d |jd�d |j ��dS( NtfanRs$%s: no 'fan' config entry. disablingRRRtfanctls ubuntu-fanR RRR( tgetRt mergemanydictt BUILTIN_CFGRtdebugRtdistrotwhichtinstall_packagesRt uses_systemd(tnametcfgtcloudRtargstcfgintmycfgR&((s;/usr/lib/python2.7/site-packages/cloudinit/config/cc_fan.pythandleUs ( N(t__doc__t cloudinitRtloggingtcloudinit.settingsRRt getLoggert__name__Rt frequencytNoneR$RRR0(((s;/usr/lib/python2.7/site-packages/cloudinit/config/cc_fan.pyt&s