File "make_mime.cpython-36.pyc"
Full Path: /home/attunedd/public_html/byp/izo/con7ext_sym404/rintoar.txt/usr/lib/python3.6/site-packages/cloudinit/cmd/devel/__pycache__/make_mime.cpython-36.pyc
File size: 3.8 KB
MIME-type: text/x-bytecode.python
Charset: 8 bit
3
\meZ @ s d Z ddlZddlZddlZddlmZ ddlmZ ddlm Z dZ
ejeZ
dZdd Zd
d Zddd
ZdddZdd Zdd Zedkreje 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 }x|t | D ]p\}\}}}|j }t||tj }|jdd| |j j } | t krxd| |d f }
|j |
|j | qW t
}x|D ]}
|j|
qW ||fS )NzContent-Dispositionzattachment; filename="%s"z3content type %r for attachment %s may be incorrect! ) enumeratereadr sysgetdefaultencodingZ
add_headerZget_content_typelowerget_content_typesappendr Zattach)filesZsub_messageserrorsiZfhfilenameZformat_typecontentsZsub_messagecontent_typemsgcombined_message r /usr/lib/python3.6/make_mime.pycreate_mime_message s$
r c C s^ y$| j dd\}}t|d||j fS tk
rX } ztj| d| |W Y dd}~X nX dS )z@Return file content type by reading the first line of the input.:r rzInvalid value for %rN)splitopenstrip
ValueErrorargparseZ
ArgumentError)textr r er r r file_content_type. s
r! c
C s^ | st j } t| _t| _| jdddtdg ddd | jdd d
ddd
| jddd
ddd
| 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)desttypeactiondefaultmetavarhelpz-lz--list-types
store_trueFz&List support cloud-init content types.)r$ r% r'