Current File : //usr/share/netplan/netplan_cli/cli/commands/__pycache__/set.cpython-312.pyc
�

Z9
gJ��V�dZddlZddlZddlZddlmZddlZdZddgZGd�d	e�Z	y)
znetplan set command line�N�)�NetplanCommandz70-netplan-set.yaml�renderer�versionc�*��eZdZ�fd�Zd�Zd�Z�xZS)�
NetplanSetc�*��t�|�ddd��y)N�setzTAdd new setting by specifying a dotted key=value pair like ethernets.eth0.dhcp4=trueT)�
command_id�description�leaf)�super�__init__)�self�	__class__s ��2/usr/share/netplan/netplan_cli/cli/commands/set.pyrzNetplanSet.__init__!s���
���E�%{�"�	�	$�c�*�|jjdtd��|jjdtd��|jjddd�	�|j|_|j�|j
�y)
N�	key_valuezNThe nested key=value pair in dotted format. Value can be NULL to delete a key.)�type�helpz
--origin-hintz�Can be used to help choose a name for the overwrite YAML file.                                        A .yaml suffix will be appended automatically.z
--root-dir�/zAOverwrite configuration files in this root directory instead of /)�defaultr)�parser�add_argument�str�command_set�func�
parse_args�run_command)rs r�runzNetplanSet.run&s������ � ��3�&v�	!�	x���� � ��s�'W�	!�	X�	
��� � ��s�&i�	!�	k��$�$��	��������rc�D�|j�#t|j�dk(rtd��|jrdj|jdf�}nd}|jjdd�}t|�dk7rtd��|\}}|j
d	�sdjd	|f�}tj
d
|�D�cgc]}|jdd���}}tj�}tj�5}tj|||�|j�|jdt j"�|j%|�|j'|j(�|jdt j"�|j+|�tj,�}	|	j/|�|�rtj�}
|jdt j"�|
j%|�|jdt j"�|
j1||��|
j'|j(�|jdt j"�|
j+|�tj,�}|j/|
�|j3||j(�n |	j5t6|j(�ddd�ycc}w#1swYyxYw)
NrzInvalid/empty origin-hint�.�yaml�=�rzInvalid value specified�networkz	(?<!\\)\.z\.)�
constraint)�origin_hint�len�	Exception�joinr�split�
startswith�re�replace�netplan�Parser�tempfile�
TemporaryFile�_create_yaml_patch�flush�seek�io�SEEK_SET�load_nullable_fields�load_yaml_hierarchy�root_dir�	load_yaml�State�import_parser_results�_load_nullable_overrides�_write_yaml_file�_update_yaml_hierarchy�FALLBACK_FILENAME)r�filenamer-�key�value�s�	yaml_pathr�tmp�state�parser_output_file�state_output_files            rrzNetplanSet.command_set4st�����'�C��0@�0@�,A�Q�,F��7�8�8�����x�x��!1�!1�6� :�;�H��H����$�$�S�!�,���u�:��?��5�6�6��
��U��~�~�i�(��(�(�I�s�+�,�C�57�H�H�\�3�4O�P�q�Q�Y�Y�u�c�*�P�	�P����!��
�
#�
#�
%�:	O���&�&�y�%��=��I�I�K�
�H�H�Q����$��'�'��,�
�&�&�t�}�}�5�
�H�H�Q����$����S�!��M�M�O�E��'�'��/��%,�^�^�%5�"�����B�K�K�(�"�7�7��<�����B�K�K�(�"�;�;�C�H�;�U�#�6�6�t�}�}�E�����B�K�K�(�"�,�,�S�1�
%,�M�M�O�!�!�7�7�8J�K�!�2�2�8�T�]�]�K��,�,�->��
�
�N�u:	O�:	O��Q�:	O�:	O�s�L�G3L�L)�__name__�
__module__�__qualname__rr!r�
__classcell__)rs@rrrs���$�
�MOrr)
�__doc__r3r/r8�utilsrr1rC�GLOBAL_KEYSr�rr�<module>rUs9��$��	�	�"��)���9�%��bO��bOr