HEX
Server: Apache/2.4.62 (Unix) OpenSSL/1.1.1k
System: Linux ns565604.ip-54-39-133.net 4.18.0-553.50.1.el8_10.x86_64 #1 SMP Tue Apr 15 08:09:22 EDT 2025 x86_64
User: greer489 (1034)
PHP: 8.3.19
Disabled: NONE
Upload Files
File: //usr/lib/python3.6/site-packages/cloudinit/config/__pycache__/cc_fan.cpython-36.pyc
3

\�me�	@s�UdZddlZddlmZddlmZmZddlmZddl	m
Z
ddlmZm
Z
ddlmZd	Zd
gZddd
eeeed�gdgd�Zee
e�Zeje�Zddd�Zdd�Zee
eedd�dd�ZdS)z$Fan: Configure ubuntu fan networking�N)�dedent)�subp�util)�Cloud)�Config)�
MetaSchema�get_meta_doc)�PER_INSTANCEaThis 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.
ZubuntuZcc_fanZFanzConfigure 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)�id�name�title�description�distrosZ	frequencyZexamplesZactivate_by_schema_keysz/etc/network/fan)�config�config_pathcCs�y|jd|�d}Wn6tjk
rJ}zd}tjd||�WYdd}~XnX|jd�s^|d7}tj||dd�y |jd|�|r�tjd	|�Wn2tjk
r�}ztjd
||�WYdd}~XnX|jd|�dS)N�stopFTzfailed to stop %s: %s�
�w)�omode�startzsuccess: %s startedzfailed to start %s: %s�enable)Zmanage_servicerZProcessExecutionError�LOGZwarning�endswithr�
write_file)�distro�service�config_file�contentZstop_failed�e�r �/usr/lib/python3.6/cc_fan.py�stop_update_startCs  
 r")r�cfg�cloud�args�returncCs�|jd�}|si}tj|tg�}|jd�s:tjd|�dStj|jd�|jd�dd�|j}tj	d�sr|j
dg�t|d|jd�|jd�d	�dS)
Nr
rz$%s: no 'fan' config entry. disablingrr)rZfanctlz
ubuntu-fan)rrr)�getrZ
mergemanydict�BUILTIN_CFGr�debugrrrZwhichZinstall_packagesr")rr#r$r%ZcfginZmycfgrr r r!�handleYs 


r*)�__doc__Zlogging�textwraprZ	cloudinitrrZcloudinit.cloudrZcloudinit.configrZcloudinit.config.schemarrZcloudinit.settingsr	ZMODULE_DESCRIPTIONr�metaZ	getLogger�__name__rr(r"�str�listr*r r r r!�<module>s0