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@sdZddlZddlZddlZddlmZddlmZddlm	Z	dZ
ejeZ
dZdd	Zd
dZddd
ZdddZddZddZedkrejedS)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Csg}g}x|t|D]p\}\}}}|j}t||tj}|jdd||jj}	|	tkrxd|	|df}
|j	|
|j	|qWt
}x|D]}
|j|
qW||fS)NzContent-Dispositionzattachment; filename="%s"z3content type %r for attachment %s may be incorrect!)	enumeratereadrsysgetdefaultencodingZ
add_headerZget_content_typelowerget_content_typesappendrZattach)filesZsub_messageserrorsiZfhfilenameZformat_typecontentsZsub_messagecontent_typemsgcombined_messager/usr/lib/python3.6/make_mime.pycreate_mime_messages$


rcCs^y$|jdd\}}t|d||jfStk
rX}ztj|d||WYdd}~XnXdS)z@Return file content type by reading the first line of the input.:rrzInvalid value for %rN)splitopenstrip
ValueErrorargparseZ
ArgumentError)textrrerrrfile_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)desttypeactiondefaultmetavarhelpz-lz--list-types
store_trueFz&List support cloud-init content types.)r$r%r'z-fz--forcez$Ignore unknown content-type warnings)rArgumentParser__doc__descriptionEPILOGZepilogadd_argumentr!)parserrrr
get_parser9s4r/FcstfddtjDS)zReturn a list of cloud-init supported content types.  Optionally
    strip out the leading 'text/' of the type if strip_prefix=True.
    cs g|]}r|jddn|qS)ztext/)replace).0Zctype)strip_prefixrr
<listcomp>gsz%get_content_types.<locals>.<listcomp>)sortedrvalues)r3r)r3rras
rcCs|jrtdjtdddSt|j\}}|rz|jr:dnd}x$|D]}tjj	|d|dqDWtjj	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_typesprintjoinrrr
forcerstderrwrite)nameargsrrlevelerrorrrrhandle_argsms	
rAcCstj}tt|S)N)r/
parse_argsrANAME)r>rrrmains
rD__main__)N)F)r*rZloggingrZemail.mime.multipartrZemail.mime.textrZcloudinit.handlersrrCZ	getLogger__name__ZLOGr,rr!r/rrArDexitrrrr<module>s"

(