Server IP : 209.38.156.173 / Your IP : 216.73.216.122 [ Web Server : Apache/2.4.52 (Ubuntu) System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.1.2-1ubuntu2.22 Disable Function : NONE Domains : 2 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /proc/thread-self/root/usr/share/netplan/netplan/cli/commands/__pycache__/ |
Upload File : |
o |hEc� � @ sX d Z ddlZddlZddlZddlZddlm mZ ddlm Z G dd� dej �ZdS )znetplan get command line� Nc s4 e Zd Z� fdd�Zdd� Zdd� Zdd� Z� ZS ) � NetplanGetc s t � jdddd� d S )N�getzRGet a setting by specifying a nested key like "ethernets.eth0.addresses", or "all"T)� command_id�description�leaf)�super�__init__��self�� __class__� �./usr/share/netplan/netplan/cli/commands/get.pyr s �zNetplanGet.__init__c C sD | j jdtdddd� | j jdddd � | j| _| �� | �� d S ) N�key�?�allzThe nested key in dotted format)�type�nargs�default�helpz --root-dir�/z>Read configuration files from this root directory instead of /)r r )�parser�add_argument�str�command_get�func� parse_args�run_commandr r r r �run# s �zNetplanGet.runc C s� |dkr|j |d� d S |�d�sd�d|f�}t�dd|��dd�}t�� �}|j |d� tj |||d� W d � d S 1 sAw Y d S )Nr )�output_file�network�.z (?<!\\)\.� z\.) � dump_yaml� startswith�join�re�sub�replace�tempfile�NamedTemporaryFile� libnetplan�dump_yaml_subtree)r r �np_stater �tmp_inr r r � dump_state- s "�zNetplanGet.dump_statec C s� t �� }|j| jd� t �� }|�|� z tj�� tj}W n t j y, t�� }Y nw | � | j||� |tjkrT|�� |�d� tj�|�� �d�� |�� d S d S )N)�rootdirr zutf-8)r+ �Parser�load_yaml_hierarchy�root_dir�State�import_parser_results�sys�stdout�fileno�io�UnsupportedOperationr) � TemporaryFiler/ r �flush�seek�write�read�decode�close)r r r- r r r r r ; s"