| Server IP : 162.19.112.25 / Your IP : 216.73.216.88 Web Server : LiteSpeed System : Linux qamar.tasjeel.ae 5.14.0-611.55.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 19 15:19:29 EDT 2026 x86_64 User : archiart ( 1428) PHP Version : 8.2.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/lib/python3.9/site-packages/cloudinit/cmd/devel/__pycache__/ |
Upload File : |
a
'�DgZ � @ s� d Z ddlZddlZddlZddlmZ ddlmZ ddlm Z dZ
e�e�Z
dZdd � Zd
d� Zddd
�Zddd�Zdd� Zdd� Zedkr�e�e� � dS )z0Generate multi-part mime messages for user-data.� N)�
MIMEMultipart)�MIMEText)�INCLUSION_TYPES_MAPz make-mimezUExample: make-mime -a config.yaml:cloud-config -a script.sh:x-shellscript > user-datac C s� g }g }t | �D ]p\}\}}}|�� }t||t�� �}|�dd| � |�� �� } | t� vrvd| |d f }
|� |
� |� |� qt
� }|D ]}
|�|
� q�||fS )NzContent-Dispositionzattachment; filename="%s"z3content type %r for attachment %s may be incorrect!� )� enumerate�readr �sys�getdefaultencodingZ
add_headerZget_content_type�lower�get_content_types�appendr Zattach)�filesZsub_messages�errors�iZfh�filenameZformat_type�contentsZsub_message�content_type�msg�combined_message� r �A/usr/lib/python3.9/site-packages/cloudinit/cmd/devel/make_mime.py�create_mime_message s( �
�
r c
C sb z&| � dd�\}}t|d�||�� fW S ty\ } zt�| d| �|�W Y d}~n
d}~0 0 dS )z@Return file content type by reading the first line of the input.�:r �rzInvalid value for %rN)�split�open�strip�
ValueError�argparse�
ArgumentError)�textr r �er r r �file_content_type. s ��r"