HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/lib/python3.6/site-packages/cloudinit/config/__pycache__/cc_install_hotplug.cpython-36.pyc
3

\�me@�	@s�UdZddlZddlZddlmZddlmZmZmZddl	m
Z
ddlmZddl
mZmZddlmZdd	lmZmZdd
lmZddded
�egeed�ed�ggd�Zeee�Zeje�ZdZdZeee
edd�dd�ZdS)z3Install hotplug udev rules if supported and enabled�N)�dedent)�stages�subp�util)�Cloud)�Config)�
MetaSchema�get_meta_doc)�ALL_DISTROS)�
EventScope�	EventType)�PER_INSTANCEZcc_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�descriptionZdistrosZ	frequencyZexamplesZactivate_by_schema_keysz2/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�args�returncCs d|ko6d|dko6d|ddko6d|dddk}tj|jjtjg�jtjt��k}tj	|j|tjtjd�}|ox|s�t
jjt
�r�tjd�tjt
�tjddd	g�n|r�tjd
�n
tjd�dStjd�s�tjd�dSd
}t
jj|�s�d}tjt
tj|d�d�tjddd	g�dS)NZupdatesZnetworkZwhenZhotplug)�
datasourcerZevent_source_typeZscopez!Uninstalling hotplug, not enabledZudevadmZcontrolz--reload-ruleszOHotplug is unsupported by current datasource. Udev rules will NOT be installed.z%Skipping hotplug install, not enabledz+Skipping hotplug install, udevadm not foundz/usr/libexec/cloud-initz/usr/lib/cloud-init)�
libexecdir)�filenameZcontent)rZHOTPLUGrZget_supported_events�getrZNETWORK�setrZupdate_event_enabled�os�path�exists�HOTPLUG_UDEV_PATH�LOG�debugrZdel_filerZwarningZwhichZ
write_file�HOTPLUG_UDEV_RULES_TEMPLATE�format)rrrrZnetwork_hotplug_enabledZhotplug_supportedZhotplug_enabledr�r#�(/usr/lib/python3.6/cc_install_hotplug.py�handleHs@





r%) �__doc__Zloggingr�textwraprZ	cloudinitrrrZcloudinit.cloudrZcloudinit.configrZcloudinit.config.schemarr	Zcloudinit.distrosr
Zcloudinit.eventrrZcloudinit.settingsr
�metaZ	getLogger�__name__rrr!�str�listr%r#r#r#r$�<module>s6