f UdZddlZddlmZddlmZmZddlmZddl m Z ddl m Z m Z ddlmZd Zd gZd d d eeeedgdgdZe ed<e eZej(eZdddZdZdede dededdf dZy)z$Fan: Configure ubuntu fan networkingN)dedent)subputil)Cloud)Config) MetaSchema get_meta_doc) PER_INSTANCEa 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) Additionally, the ``ubuntu-fan`` package will be automatically installed if not present. ubuntucc_fanFanzConfigure ubuntu fan networkinga 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 fan)idnametitle descriptiondistros frequencyexamplesactivate_by_schema_keysmetaz/etc/network/fan)config config_pathc |jd|d}|j ds|dz }t j||d |jd||rtj d ||jd |y#tj$r#}d}tj d||Yd}~d}~wwxYw#tj$r!}tj d ||Yd}~{d}~wwxYw) NstopFTzfailed to stop %s: %s womodestartzsuccess: %s startedzfailed to start %s: %senable)manage_servicerProcessExecutionErrorLOGwarningendswithr write_file)distroservice config_filecontent stop_failedes 9/usr/lib/python3/dist-packages/cloudinit/config/cc_fan.pystop_update_startr/Cs9fg.   D !4OOK4:gw/  KK-w 7 (G,  % %9  +Wa889  % %: ,gq99:s/B*B;B8B33B8;C/C**C/rcfgcloudargsreturnc|jd}|si}tj|tg}|jdstj d|ytj |jd|jdd|j}tjds|jdgt|d|jd|jd y) Nrrz$%s: no 'fan' config entry. disablingrrrfanctlz ubuntu-fan)r)r*r+) getr mergemanydict BUILTIN_CFGr$debugr'r(rwhichinstall_packagesr/)rr0r1r2cfginmycfgr(s r.handler>Ys GGENE    {3 4E 99X  8$?OOEIIm,eii.AM \\F ::h /IIm, (# )__doc__loggingtextwrapr cloudinitrrcloudinit.cloudrcloudinit.configrcloudinit.config.schemarr cloudinit.settingsr MODULE_DESCRIPTIONrr__annotations__ getLogger__name__r$r8r/strlistr>r?r.rOs + !#<+  *   .%   !&w+j0 t g!% -,6%tr?