Your IP : 216.73.217.13


Current Path : /lib/python3/dist-packages/cloudinit/config/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/cloudinit/config/__pycache__/cc_fan.cpython-38.pyc

U

�Adp�	@s�UdZddlmZddlmZddlmZddlmZmZddl	m
Z
ddlmZddl
mZmZdd	lmZd
ZdgZdd
deeeed�gdgd�Zeed<ee�Ze�e�Zddd�Zdd�Zeee
eedd�dd�ZdS)z$Fan: Configure ubuntu fan networking�)�Logger)�dedent)�log)�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�titleZdescription�distrosZ	frequencyZexamplesZactivate_by_schema_keys�metaNz/etc/network/fan)�config�config_pathc
Cs�z|�d|�d}Wn6tjk
rJ}zd}t�d||�W5d}~XYnX|�d�s^|d7}tj||dd�z |�d|�|r�t�d	|�Wn2tjk
r�}zt�d
||�W5d}~XYnX|�d|�dS)N�stopFTzfailed to stop %s: %s�
�w�Zomode�startzsuccess: %s startedzfailed to start %s: %s�enable)Zmanage_servicerZProcessExecutionError�LOGZwarning�endswithr�
write_file)�distro�service�config_file�contentZstop_failed�e�r"�9/usr/lib/python3/dist-packages/cloudinit/config/cc_fan.py�stop_update_startDs  
 r$)r�cfg�cloudr�args�returncCs�|�d�}|si}t�|tg�}|�d�s:t�d|�dStj|�d�|�d�dd�|j}t�	d�sr|�
dg�t|d|�d�|�d�d	�dS)
Nrrz$%s: no 'fan' config entry. disablingrrrZfanctlz
ubuntu-fan)rrr )�getrZ
mergemanydict�BUILTIN_CFGr�debugrrrZwhichZinstall_packagesr$)rr%r&rr'ZcfginZmycfgrr"r"r#�handleZs"


�r,)�__doc__Zloggingr�textwraprZ	cloudinitrrrZcloudinit.cloudrZcloudinit.configrZcloudinit.config.schemar	r
Zcloudinit.settingsrZMODULE_DESCRIPTIONrr�__annotations__Z	getLogger�__name__rr*r$�str�listr,r"r"r"r#�<module>sF���
��