| Server IP : 159.223.102.202 / Your IP : 216.73.216.195 Web Server : nginx/1.26.0 System : Linux Gen1-cloudpanel2ubuntu2404-1vcpu-1gb-nyc1-01 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64 User : albasshbotta ( 1021) PHP Version : 8.2.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /lib/python3/dist-packages/cloudinit/cmd/devel/__pycache__/ |
Upload File : |
�
�fL+ � �� � d Z ddlZddlZddlZddlZddlZddlZddlZddlm Z m
Z
mZmZ ddl
mZ ddlmZmZ ddlmZ ddlmZ ddlmZ dd lmZmZ dd
lmZ ej: e� ZdZ dd�Z! G d
� dejD � Z# G d� de#� Z$de$ejJ fiZ&d� Z'dede(fd�Z)defd�Z*dede+fd�Z,d� Z-edk( r e!� j] � Z/ e-e e/� yy)z)Handle reconfiguration on hotplug events.� N)�log� reporting�stages�util)�install_hotplug)�
EventScope� EventType)�read_sys_net_safe)�parse_net_config_data)�events)�
DataSource�DataSourceNotFoundException)�Initzhotplug-hookc � � | st j t t �� } t | _ | j dddddg�� | j
dd �
� }d|_ |j dd�
� |j dd�
� }|j ddddd�� |j ddddddg�� |j dd�
� | S )a Build or extend an arg parser for hotplug-hook utility.
@param parser: Optional existing ArgumentParser instance representing the
subcommand which will be extended to support the args of this utility.
@returns: ArgumentParser with proper argument configuration.
)�prog�descriptionz-sz--subsystemTzsubsystem to act on�net)�required�help�choiceszHotplug Action�hotplug_action)�title�dest�queryz0Query if hotplug is enabled for given subsystem.)r �handlezHandle the hotplug event.z-dz --devpath�PATHzSysfs path to hotplugged device)r �metavarr z-uz--udevactionzSpecify action to take.�add�remove�enablez%Enable hotplug for a given subsystem.) �argparse�ArgumentParser�NAME�__doc__r �add_argument�add_subparsersr �
add_parser)�parser�
subparsers�
parser_handles �B/usr/lib/python3/dist-packages/cloudinit/cmd/devel/hotplug_hook.py�
get_parserr, s � � ��(�(�d��H�� �F��
������
"��� � � �&�&��%5� '� �J� �J������H� � � �)�)��2� *� �M� �������
.� � � ������
&���!� � � ����>� � � �M� c � � e Zd Zd� Zej
d� � Zeej
d� � � Zej
de fd�� Z
d� Zd� Zd� Z
y )
�
UeventHandlerc �J � || _ || _ || _ || _ || _ y �N)�id�
datasource�devpath�action�
success_fn)�selfr2 r3 r4 r5 r6 s r+ �__init__zUeventHandler.__init__Q s% � ����&0���������$��r- c � � t � �r1 ��NotImplementedError�r7 s r+ �applyzUeventHandler.applyX � � �!�#�#r- c � � t � �r1 r: r<