�
܍~cl � � � d Z ddlZddlZddlZddlZddlZddlmZmZm Z ddl
mZmZm
Z
mZmZmZ ddlmZ ddlmZ ddlmZ dZdd �Zd
� Zedk r* e� � � � � Z eee� � dS dS )
z(Debug network config format conversions.� N)�distros�log�safeyaml)�eni�netplan�network_manager�
network_state�networkd� sysconfig)�DataSourceAzure)�
DataSourceOVF)� openstackznet-convertc � � | s t j t t �� � } | � ddt
ddd�� � | � dd g d
�dd�� � | � d
dddd�� � | � ddd� t j � � � D � � d�� � | � ddddd�� � | � ddd�� � | � dd g d!�dd"�� � | S )#a Build or extend and arg parser for net-convert 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-pz--network-data�PATHTz!The network configuration to read)�type�metavar�required�helpz-kz--kind)r �network_data.json�yaml�
azure-imds�
vmware-imcz&The format of the given network config)�choicesr r z-dz--directoryzdirectory to place output in)r r r z-Dz--distroc � � g | ] }|D ]}|���
S � r )�.0�sublist�items �A/usr/lib/python3/dist-packages/cloudinit/cmd/devel/net_convert.py�
<listcomp>zget_parser.<locals>.<listcomp>E s9 � �
�
�
���
�
�@D�D�
�
�
�
� )r r z-mz--maczname,mac�appendzinterface name to mac mapping)r �actionr z--debug�
store_truezenable debug logging to stderr.)r% r z-Oz
--output-kind)r r r
r �network-managerz!The network config format to emit) �argparse�ArgumentParser�NAME�__doc__�add_argument�openr �
OSFAMILIES�values)�parsers r! �
get_parserr1 s� � � � I��(�d��H�H�H��
�����
���
0�
� � � � �����
�
�
� �
5� � � � � ������
+�� � � � � �����
�
� '� 2� 9� 9� ;� ;�
�
�
� �
� � � � �������
,� � � � � ����,�-N� � � � � �����N�N�N��
0� � � � � �Mr# c
�@ � |j � d� � s|xj dz
c_ t j � |j � � st j |j � � |j r t j t j �� � nt j t j
�� � |j r+i }|j D ] }|� dd� � \ }}|||< |