HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //proc/self/root/usr/share/netplan/netplan_cli/cli/commands/__pycache__/set.cpython-310.pyc
o

ϐxeJ�@sPdZddlZddlZddlZddlmZddlZdZddgZGdd	�d	e�Z	dS)
znetplan set command line�N�)�NetplanCommandz70-netplan-set.yaml�renderer�versioncs,eZdZ�fdd�Zdd�Zdd�Z�ZS)�
NetplanSetcst�jdddd�dS)N�setzTAdd new setting by specifying a dotted key=value pair like ethernets.eth0.dhcp4=trueT)�
command_id�description�leaf)�super�__init__��self��	__class__��2/usr/share/netplan/netplan_cli/cli/commands/set.pyr!s
�zNetplanSet.__init__cCsR|jjdtdd�|jjdtdd�|jjdddd	�|j|_|��|��dS)
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_commandr
rrr�run&s
�
�
�zNetplanSet.runcCs�|jdurt|j�dkrtd��|jrd�|jdf�}nd}|j�dd�}t|�dkr/td��|\}}|�d	�s?d�d	|f�}d
d�t�d|�D�}t�	�}t
����}t�|||�|�
�|�dtj�|�|�|�|j�|�dtj�|�|�t��}|�|�|r�t�	�}	|�dtj�|	�|�|�dtj�|	j||d
�|	�|j�|�dtj�|	�|�t��}
|
�|	�|
�||j�n|�t|j�Wd�dSWd�dS1s�wYdS)NrzInvalid/empty origin-hint�.�yaml�=�rzInvalid value specified�networkcSsg|]}|�dd��qS)z\.r )�replace)�.0�srrr�
<listcomp>Dsz*NetplanSet.command_set.<locals>.<listcomp>z	(?<!\\)\.)�
constraint)�origin_hint�len�	Exception�joinr�split�
startswith�re�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�	yaml_pathr�tmp�state�parser_output_file�state_output_filerrrr4sN







�8"�zNetplanSet.command_set)�__name__�
__module__�__qualname__rrr�
__classcell__rrrrrsr)
�__doc__r3r0r8�utilsrr1rC�GLOBAL_KEYSrrrrr�<module>s