HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //lib/python3.6/site-packages/cloudinit/cmd/devel/__pycache__/make_mime.cpython-36.opt-1.pyc
3

\�meZ�@s�dZddlZddlZddlZddlmZddlmZddlm	Z	dZ
eje�Z
dZdd	�Zd
d�Zddd
�Zddd�Zdd�Zdd�Zedkr�eje��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Cs�g}g}x|t|�D]p\}\}}}|j�}t||tj��}|jdd|�|j�j�}	|	t�krxd|	|df}
|j	|
�|j	|�qWt
�}x|D]}
|j|
�q�W||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�appendrZattach)�filesZsub_messages�errors�iZfh�filenameZformat_type�contentsZsub_message�content_type�msg�combined_message�r�/usr/lib/python3.6/make_mime.py�create_mime_messages$


rcCs^y$|jdd�\}}t|d�||j�fStk
rX}ztj|d|�|�WYdd}~XnXdS)z@Return file content type by reading the first line of the input.�:r�rzInvalid value for %rN)�split�open�strip�
ValueError�argparseZ
ArgumentError)�textrr�errr�file_content_type.s
r!c
Cs^|stj�}t|_t|_|jdddtdgddd�|jdd	d
ddd
�|jddd
ddd
�|S)aBuild 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.)r$r%r'z-fz--forcez$Ignore unknown content-type warnings)r�ArgumentParser�__doc__�description�EPILOGZepilog�add_argumentr!)�parserrrr�
get_parser9s4r/Fcst�fdd�tj�D��S)z�Return a list of cloud-init supported content types.  Optionally
    strip out the leading 'text/' of the type if strip_prefix=True.
    cs g|]}�r|jdd�n|�qS)ztext/�)�replace)�.0Zctype)�strip_prefixrr�
<listcomp>gsz%get_content_types.<locals>.<listcomp>)�sortedr�values)r3r)r3rras
rcCs�|jrtdjtdd���dSt|j�\}}|rz|jr:dnd}x$|D]}tjj	|�d|�d��qDWtjj	d�|jszd	St|�dS)
a<Create a multi-part MIME archive for use as user-data.  Optionally
       print out the list of supported content types of cloud-init.

    Also setup CLI log handlers to report to stderr since this is a development
    utility which should be run by a human on the CLI.

    @return 0 on success, 1 on failure.
    �
T)r3rZWARNINGZERRORz: z-Invalid content-types, override with --force
r)
Z
list_types�print�joinrrr
�forcer�stderr�write)�name�argsrr�level�errorrrr�handle_argsms	
rAcCst�j�}tt|�S)N)r/�
parse_argsrA�NAME)r>rrr�main�s
rD�__main__)N)F)r*rZloggingrZemail.mime.multipartrZemail.mime.textrZcloudinit.handlersrrCZ	getLogger�__name__ZLOGr,rr!r/rrArD�exitrrrr�<module>s"

(