| Server IP : 159.223.102.202 / Your IP : 216.73.216.195 Web Server : nginx/1.26.0 System : Linux Gen1-cloudpanel2ubuntu2404-1vcpu-1gb-nyc1-01 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64 User : albasshbotta ( 1021) PHP Version : 8.2.19 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 : |
�
�!f � �f � d Z ddlZddlZddlZddlZddlZddlmZ G d� dej � Z y)znetplan generate command line� N� )�utilsc �* � � e Zd Z� fd�Zd� Zd� Z� xZS )�NetplanGeneratec �* �� t �| � ddd�� y )N�generatezFGenerate backend specific configuration files from /etc/netplan/*.yamlT)�
command_id�description�leaf)�super�__init__)�self� __class__s ��7/usr/share/netplan/netplan_cli/cli/commands/generate.pyr
zNetplanGenerate.__init__ s �� �
���J�&A�"� � $� c �� � | j j dd�� | j j dd�� | j | _ | j � | j � y )N�
--root-dirzOSearch for and generate configuration files in this root directory instead of /)�help� --mappingzFDisplay the netplan device ID/backend/interface name mapping and exit.)�parser�add_argument�command_generate�func�
parse_args�run_command)r s r �runzNetplanGenerate.run% sa � ���� � ��&w� !� y���� � ��&n� !� p� �)�)�� ��������r c
� � dt j v rct j d� }|�t d� �t j |ddddddd g� }|d
k7 r|dk( rt d� �t d
|z � �y t j � g}| j r|d| j gz
}| j r|d| j gz
}t j d|� t j |� } t j � t# j$ |� y # t
j $ r}t j |� Y d }~�Cd }~ww xY w)N�SNAP�busctlzmissing busctl utility�callz--quietz--systemzio.netplan.Netplanz/io/netplan/Netplan�Generater � z8PermissionError: failed to communicate with dbus servicez?RuntimeError: failed to communicate with dbus service: error %sr r zcommand generate: running %s)�os�environ�shutil�which�RuntimeError�
subprocessr �PermissionErrorr �get_generator_path�root_dir�mapping�logging�debug�systemctl_daemon_reload�CalledProcessError�warning�sys�exit)r r �res�argv�es r r z NetplanGenerate.command_generate0 s@ � ��R�Z�Z�� �\�\�(�+�F��~�"�#;�<�<� �/�/�6�6�9�j�#7�#8�#7�#-� #%� &�C� �a�x��#�:�)�R�T� T� '�Y�\_�_�a� a� ��(�(�*�+���=�=��\�4�=�=�1�1�D��<�<��[�$�,�,�/�/�D��
�
�4�d�;��o�o�d�#�� ��)�)�+� ����
�� �,�,� ��O�O�A���� �s �1D �E
�.E�E
)�__name__�
__module__�__qualname__r
r r �
__classcell__)r s @r r r s �� �$� �,r r )
�__doc__r- r# r2 r( r% � r �NetplanCommandr � r r �<module>r? s. ��$ $� � �
� �
� �?�e�*�*� ?r