| Current Path : /lib/python3/dist-packages/cloudinit/cmd/devel/__pycache__/ |
| Current File : //lib/python3/dist-packages/cloudinit/cmd/devel/__pycache__/hotplug_hook.cpython-38.pyc |
U
�Ad�# � @ s( d Z ddlZddlZddlZddlZddlZddlmZmZm Z ddl
mZmZ ddl
mZ ddlmZ ddlmZ ddlmZmZ dd lmZ e�e�Zd
Zddd�ZG d
d� dej�ZG dd� de�Zdeej fiZ!dd� Z"ee#d�dd�Z$ed�dd�Z%dd� Z&edk�r$e� �'� Z(e&ee(� dS )z)Handle reconfiguration on hotplug events.� N)�log� reporting�stages)�
EventScope� EventType)�read_sys_net_safe)�parse_net_config_data)�events)�
DataSource�DataSourceNotFoundException)�Initzhotplug-hookc C s� | st jttd�} t| _| jdddddgd� | jdd d
�}d|_|jddd
� |jddd
�}|jdddddd� |jddddddgd� | 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 ZhandlezHandle the hotplug event.z-dz --devpath�PATHzSysfs path to hotplugged device)r �metavarr z-uz--udevactionzSpecify action to take.�add�remove) �argparse�ArgumentParser�NAME�__doc__r �add_argumentZadd_subparsersr Z
add_parser)�parserZ
subparsersZ
parser_handle� r! �B/usr/lib/python3/dist-packages/cloudinit/cmd/devel/hotplug_hook.py�
get_parser sL � � � ���r# c @ s` e Zd Zdd� Zejdd� �Zeejdd� ��Zeje d�dd ��Z
d
d� Zdd
� Zdd� Z
dS )�
UeventHandlerc C s"