HEX
Server: Apache/2.4.67 (Debian)
System: Linux vps-b2547eb4 6.1.0-41-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.158-1 (2025-11-09) x86_64
User: root (0)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/cloudinit/config/__pycache__/cc_install_hotplug.cpython-311.pyc
�

܍~c=��*�UdZddlZddlmZddlmZddlmZmZm	Z	ddl
mZddlm
Z
ddlmZmZdd	lmZdd
lmZmZddlmZdd
ded��egeed��ed��ggd�Zeed<ee��ZdZdZdede
dedededdfd�ZdS)z3Install hotplug udev rules if supported and enabled�N)�Logger)�dedent)�stages�subp�util)�Cloud)�Config)�
MetaSchema�get_meta_doc)�ALL_DISTROS)�
EventScope�	EventType)�PER_INSTANCE�cc_install_hotplugzInstall Hotplugas        This module will install the udev rules to enable hotplug if
        supported by the datasource and enabled in the userdata. The udev
        rules will be installed as
        ``/etc/udev/rules.d/10-cloud-init-hook-hotplug.rules``.

        When hotplug is enabled, newly added network devices will be added
        to the system by cloud-init. After udev detects the event,
        cloud-init will referesh the instance metadata from the datasource,
        detect the device in the updated metadata, then apply the updated
        network configuration.

        Currently supported datasources: Openstack, EC2
    z�            # Enable hotplug of network devices
            updates:
              network:
                when: ["hotplug"]
        z�            # Enable network hotplug alongside boot event
            updates:
              network:
                when: ["boot", "hotplug"]
        )�id�name�title�description�distros�	frequency�examples�activate_by_schema_keys�metaz2/etc/udev/rules.d/10-cloud-init-hook-hotplug.rulesz�# Installed by cloud-init due to network hotplug userdata
ACTION!="add|remove", GOTO="cloudinit_end"
LABEL="cloudinit_hook"
SUBSYSTEM=="net", RUN+="{libexecdir}/hook-hotplug"
LABEL="cloudinit_end"
r�cfg�cloud�log�args�returnc���d|vo/d|dvo%d|ddvod|dddv}tj|j�tjg���t
jt����v}tj	|j|tjt
j���}|r|s�tj�t��rE|�d��tjt��t#jgd���n-|r|�d��n|�d	��dSt#jd
��s|�d��dSd}tj�|��sd
}tjtt*�|������t#jgd���dS)N�updates�network�when�hotplug)�
datasourcer�event_source_type�scopez!Uninstalling hotplug, not enabled)�udevadm�controlz--reload-ruleszOHotplug is unsupported by current datasource. Udev rules will NOT be installed.z%Skipping hotplug install, not enabledr'z+Skipping hotplug install, udevadm not foundz/usr/libexec/cloud-initz/usr/lib/cloud-init)�
libexecdir)�filename�content)r�HOTPLUGr$�get_supported_events�getr
�NETWORK�setr�update_event_enabled�os�path�exists�HOTPLUG_UDEV_PATH�debugr�del_filer�warning�which�
write_file�HOTPLUG_UDEV_RULES_TEMPLATE�format)	rrrrr�network_hotplug_enabled�hotplug_supported�hotplug_enabledr)s	         �E/usr/lib/python3/dist-packages/cloudinit/config/cc_install_hotplug.py�handlerAGs��	�S��	;���Y��'�	;��c�)�n�Y�/�/�	;�
��Y��	�2�6�:�:�	�"�)�
��-�-�y�/@�.A�B�B�F�F������	
�	
���
�1��#��#�+�� �	���O�
��/��
�7�>�>�+�,�,�
	?��I�I�9�:�:�:��M�+�,�,�,��I�>�>�>�?�?�?�?�
$�	?��K�K�4�
�
�
�
�

�I�I�=�>�>�>����:�i� � ���	�	�?�@�@�@���+�J�
�7�>�>�*�%�%�+�*�
��O�"�+�2�2�j�2�I�I�����	�I�6�6�6�7�7�7�7�7�)�__doc__r2�loggingr�textwrapr�	cloudinitrrr�cloudinit.cloudr�cloudinit.configr	�cloudinit.config.schemar
r�cloudinit.distrosr�cloudinit.eventr
r�cloudinit.settingsrr�__annotations__r5r;�str�listrA�rBr@�<module>rQs���9�9�9�	�	�	�	�������������(�(�(�(�(�(�(�(�(�(�!�!�!�!�!�!�#�#�#�#�#�#�<�<�<�<�<�<�<�<�)�)�)�)�)�)�1�1�1�1�1�1�1�1�+�+�+�+�+�+���
B��6�
	��� �}����
�	
�	
�	��
�	
�	
��$ "�Q)�)��j�)�)�)�V�,�t�
�
��I����-8�

�-8��-8�#(�-8�/5�-8�=A�-8�	�-8�-8�-8�-8�-8�-8rB