ó 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