| Server IP : 162.144.4.212 / Your IP : 216.73.216.108 Web Server : Apache System : Linux gator2125.hostgator.com 5.14.0-162.23.1.9991722448259.nf.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 31 18:11:45 UTC 2024 x86_64 User : cozeellc ( 2980) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /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"