| Server IP : 23.254.227.96 / Your IP : 216.73.216.21 Web Server : Apache/2.4.62 (Unix) OpenSSL/1.1.1k System : Linux hwsrv-1277026.hostwindsdns.com 4.18.0-477.13.1.el8_8.x86_64 #1 SMP Tue May 30 14:53:41 EDT 2023 x86_64 User : viralblo ( 1001) PHP Version : 8.1.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib/python3.6/site-packages/cloudinit/config/__pycache__/ |
Upload File : |
3
��b: � @ s� U d Z ddlZddlmZ ddlmZmZmZ ddlm Z m
Z
mZ ddlm
Z
ddlmZmZ ddlmZ eZe
gZd d
ded�eed
�ed�ged�Ze dddddddgddddddddddgd�d�id�id�id�Ze
ee�Z d Zd!Zd"d#� ZdS )$z3Install hotplug udev rules if supported and enabled� N)�dedent)�stages�subp�util)�
MetaSchema�get_meta_doc�validate_cloudconfig_schema)�ALL_DISTROS)�
EventScope� EventType)�PER_INSTANCEZcc_install_hotplugzInstall Hotplugz(Install hotplug if supported and enabledas 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�distrosZexamples� frequency�object�updatesF�network�whenZarray�stringzboot-new-instancezboot-legacyZboot�hotplug)�type�additionalProperties�enum)r r �items)r Zrequiredr �
properties)r r r )r r z2/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"
c C s, t |t� d|ko@d|d ko@d|d d ko@d|d d d k}tj|jjtjg�jtjt � �k}t
j|j|tjtjd�}|o�|s�tj
jt�r�|jd� tjt� tjddd g� n|r�|jd
� n
|jd� d S tjd�s�|jd� d S d
}tj
j|��sd}tjttj|d�d� tjddd g� d S )Nr r r r )�
datasource�cfgZevent_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 �schemar ZHOTPLUGr Zget_supported_events�getr
ZNETWORK�setr Zupdate_event_enabled�os�path�exists�HOTPLUG_UDEV_PATH�debugr Zdel_filer ZwarningZwhichZ
write_file�HOTPLUG_UDEV_RULES_TEMPLATE�format) �_namer Zcloud�logZ_argsZnetwork_hotplug_enabledZhotplug_supportedZhotplug_enabledr � r. �(/usr/lib/python3.6/cc_install_hotplug.py�handlek sB
r0 )�__doc__r% �textwrapr Z cloudinitr r r Zcloudinit.config.schemar r r Zcloudinit.distrosr Zcloudinit.eventr
r Zcloudinit.settingsr r r �metar"