| Server IP : 159.203.156.69 / Your IP : 216.73.216.28 Web Server : nginx/1.24.0 System : Linux main-ubuntu 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.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /usr/lib/python3/dist-packages/cloudinit/cmd/devel/__pycache__/ |
Upload File : |
�
�t�h � �T � d Z ddlZddlZddlZddlmZ ddlmZ ddlm Z m
Z
ddlmZ dZ
ej e� ZdZd � Zd
efd�Z dde
ej* d
ej* fd�Zdded
e e fd�Zdedej2 d
efd�Zd� Zedk( r ej: e� � yy)z0Generate multi-part mime messages for user-data.� N)�
MIMEMultipart)�MIMEText)�List�Optional)�INCLUSION_TYPES_MAPz make-mimezUExample: make-mime -a config.yaml:cloud-config -a script.sh:x-shellscript > user-datac � � g }g }t | � D ]� \ }\ }}}|j � }t ||t j � � }|j dd|z � |j
� j � } | t � vrd| �d|dz �d�}
|j |
� |j |� �� t � }|D ] }
|j |
� � ||fS )NzContent-Dispositionzattachment; filename="%s"z
content type z for attachment � z may be incorrect!)� enumerate�readr �sys�getdefaultencoding�
add_header�get_content_type�lower�get_content_types�appendr �attach)�files�sub_messages�errors�i�fh�filename�format_type�contents�sub_message�content_type�msg�combined_messages �?/usr/lib/python3/dist-packages/cloudinit/cmd/devel/make_mime.py�create_mime_messager! s� � ��L��F�*3�E�*:�
)�&��&�B��+��7�7�9���x��c�6L�6L�6N�O�����!�#>�(�#K�
� #�3�3�5�;�;�=���0�2�2���A���C�
�M�M�#�����K�(�
)� %���� %������$�%��f�%�%� �textc � � | j dd� \ }}t |d� ||j � fS # t $ r}t j
dd| z � |�d}~ww xY w)z@Return file content type by reading the first line of the input.�:r �rNzInvalid value for %r)�split�open�strip�
ValueError�argparse�
ArgumentError)r# r r �es r �file_content_typer. / sj � ��!%���C��!3���,��X�s�#�X�|�/A�/A�/C�D�D��� ��$�$��(�D�1�
�� ���s �14 � A�A�A�parser�returnc
�� � | st j � } t | _ t | _ | j
dddt dg dd�� | j
dd d
dd�
� | j
ddd
dd�
� | S )a Build or extend and arg parser for make-mime utility.
@param parser: Optional existing ArgumentParser instance representing the
subcommand which will be extended to support the args of this utility.
@returns: ArgumentParser with proper argument configuration.
z-az--attachr r z<file>:<content-type>z3attach the given file as the specified content-type)�dest�type�action�default�metavar�helpz-lz--list-types�
store_trueFz&List support cloud-init content types.)r4 r5 r7 z-fz--forcez$Ignore unknown content-type warnings)r+ �ArgumentParser�__doc__�description�EPILOG�epilog�add_argumentr. )r/ s r �
get_parserr? : s� � � ��(�(�*�� �F���F�M�
�����
�
���'�
B� � � �������
5� � � �������
3� � � �Mr"