+
    i                        R t ^ RIt^ RIt^ RIt^ RIHt ^ RIHt ^ RIH	t	H
t
 ^ RIHt Rt]P                  ! ]4      tRtR tR	 R
 ltRR R lltRR R lltR R ltR t]R8X  d   ]P0                  ! ]! 4       4       R# R# )z0Generate multi-part mime messages for user-data.N)MIMEMultipart)MIMEText)ListOptional)INCLUSION_TYPES_MAPz	make-mimezUExample: make-mime -a config.yaml:cloud-config -a script.sh:x-shellscript > user-datac                    . p. p\        V 4       F  w  pw  rEpVP                  4       p\        Wv\        P                  ! 4       4      pVP                  R RV,          4       VP                  4       P                  4       p	V	\        4       9  d$   RV	: RV^,           : R2p
VP                  V
4       VP                  V4       K  	  \        4       pV F  p
VP                  V
4       K  	  W3# )zContent-Dispositionzattachment; filename="%s"zcontent type z for attachment z may be incorrect!)	enumeratereadr   sysgetdefaultencoding
add_headerget_content_typelowerget_content_typesappendr   attach)filessub_messageserrorsifhfilenameformat_typecontentssub_messagecontent_typemsgcombined_messages   &           ?/usr/lib/python3/dist-packages/cloudinit/cmd/devel/make_mime.pycreate_mime_messager      s    LF*3E*:&&B+779xc6L6L6NO!#>(#K	
 #335;;=022AC MM#K( +; %$ %%    c                $    V ^8  d   QhR\         /# )   text)str)formats   "r   __annotate__r&   /   s      C r    c                     V P                  R^4      w  r\        VR4      WP                  4       3#   \         d%   p\        P
                  ! RRT ,          4      ThRp?ii ; i)z@Return file content type by reading the first line of the input.:rNzInvalid value for %r)splitopenstrip
ValueErrorargparseArgumentError)r#   r   r   es   &   r   file_content_typer1   /   sf    !%C!3Xs#X/A/A/CDD $$(D1
	s   /2 A!AA!c                n    V ^8  d   QhR\         \        P                  ,          R\        P                  /# )r"   parserreturn)r   r.   ArgumentParser)r%   s   "r   r&   r&   :   s-     ' 'X,,-''r    c                    V '       g   \         P                  ! 4       p \        V n        \        V n        V P                  RRR\        R. RRR7       V P                  RR	R
RRR7       V P                  RRR
RRR7       V # )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)desttypeactiondefaultmetavarhelpz-lz--list-types
store_trueFz&List support cloud-init content types.)r9   r:   r<   z-fz--forcez$Ignore unknown content-type warnings)r.   r5   __doc__descriptionEPILOGepilogadd_argumentr1   )r3   s   &r   
get_parserrC   :   s     ((* FFM
'B  	 5   3   Mr    c                F    V ^8  d   QhR\         R\        \        ,          /# )r"   strip_prefixr4   )boolr   r$   )r%   s   "r   r&   r&   d   s     	 	D 	T#Y 	r    c           	         \        \        P                  ! 4        Uu. uF  pV '       d   VP                  RR4      MTNK!  	  up4      # u upi )zReturn a list of cloud-init supported content types.  Optionally
strip out the leading 'text/' of the type if strip_prefix=True.
ztext/ )sortedr   valuesreplace)rE   ctypes   & r   r   r   d   sN      -335	
5 +7EMM'2&EA5	
 	
s
   A	A	c                P    V ^8  d   QhR\         R\        P                  R\        /# )r"   nameargsr4   )r$   r.   	Namespaceint)r%   s   "r   r&   r&   p   s'      c !3!3  r    c                   VP                   '       d'   \        RP                  \        RR7      4      4       ^ # \	        VP
                  4      w  r#V'       dx   VP                  '       d   RMRpV F(  p\        P                  P                  V RV R24       K*  	  \        P                  P                  R4       VP                  '       g   ^# \        V4       ^ # )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)rE   WARNINGERRORz: z-Invalid content-types, override with --force
)

list_typesprintjoinr   r   r   forcer
   stderrwrite)rN   rO   r   r   levelerrors   &&    r   handle_argsr^   p   s     dii)t<=>24::>!ZZZ	WEJJwbr23 

IJzzz	
r    c                  R    \        4       P                  4       p \        \        V 4      # N)rC   
parse_argsr^   NAME)rO   s    r   mainrc      s    <""$DtT""r    __main__r`   )F)r>   r.   loggingr
   email.mime.multipartr   email.mime.textr   typingr   r   cloudinit.handlersr   rb   	getLogger__name__LOGr@   r   r1   rC   r   r^   rc   exit r    r   <module>ro      sz   
 7   
 . $ ! 2!- &.'T	2#
 zHHTV r    