HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux ip-10-0-8-47 6.8.0-1021-aws #23~22.04.1-Ubuntu SMP Tue Dec 10 16:31:58 UTC 2024 aarch64
User: ubuntu (1000)
PHP: 8.1.2-1ubuntu2.22
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/cloudinit/config/__pycache__/cc_fan.cpython-310.pyc
o

�Adp�@s�UdZddlmZddlmZddlmZddlmZmZddl	m
Z
ddlmZddl
mZmZdd	lmZd
ZdgZdd
deeeed�gdgd�Zeed<ee�Ze�e�Zddd�Zdd�Zdedede
dededdf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.
�ubuntu�cc_fan�FanzConfigure 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�distros�	frequency�examples�activate_by_schema_keys�metaNz/etc/network/fan)�config�config_pathc
Cs�z
|�d|�d}Wntjy&}zd}t�d||�WYd}~nd}~ww|�d�s0|d7}tj||dd�z|�d|�|rGt�d	|�Wntjyb}z
t�d
||�WYd}~nd}~ww|�d|�dS)N�stopFTzfailed to stop %s: %s�
�w��omode�startzsuccess: %s startedzfailed to start %s: %s�enable)�manage_servicer�ProcessExecutionError�LOG�warning�endswithr�
write_file)�distro�service�config_file�content�stop_failed�e�r.�9/usr/lib/python3/dist-packages/cloudinit/config/cc_fan.py�stop_update_startDs*��
���r0r�cfg�cloudr�args�returncCs�|�d�}|s	i}t�|tg�}|�d�st�d|�dStj|�d�|�d�dd�|j}t�	d�s9|�
dg�t|d|�d�|�d�d	�dS)
Nrrz$%s: no 'fan' config entry. disablingrrr�fanctlz
ubuntu-fan)r)r*r+)�getr�
mergemanydict�BUILTIN_CFGr$�debugr'r(r�which�install_packagesr0)rr1r2rr3�cfgin�mycfgr(r.r.r/�handleZs"



�r>)�__doc__�loggingr�textwrapr�	cloudinitrrr�cloudinit.cloudr�cloudinit.configr�cloudinit.config.schemar	r
�cloudinit.settingsr�MODULE_DESCRIPTIONrr�__annotations__�	getLogger�__name__r$r8r0�str�listr>r.r.r.r/�<module>sT���
�������