+
    ˜qgjð  ã                   óN  € ^ RI 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IHtHt ^ RIHt ^ RIHt ^ R	IHtHtHtHt ^ R
IHtHt ]P8                  ! ]4      t ! R R]4      t  ! R R]4      t! ! R R]PD                  4      t#RR lt$RR lt%R R lt&RR lt'R# )é    N)ÚEACCES)ÚOptional)Ú
exceptionsÚlexer)Úhandlers)Úb64dÚ
json_dumps©ÚPaths)Ú
PER_ALWAYS)ÚMISSING_JINJA_PREFIXÚJinjaSyntaxParsingExceptionÚdetect_templateÚrender_string)Ú	load_jsonÚload_text_filec                   ó   € ] tR t^tRtR# )ÚJinjaLoadError© N©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__static_attributes__r   ó    ÚC/usr/lib/python3/dist-packages/cloudinit/handlers/jinja_template.pyr   r      ó   † Ûr   r   c                   ó   € ] tR t^tRtR# )ÚNotJinjaErrorr   Nr   r   r   r   r    r       r   r   r    c                   ó>   a € ] tR t^#t o R.tV 3R lR ltR tRtV tR# )ÚJinjaTemplatePartHandlerz## template: jinjac                ó    <€ V ^8„  d   QhRS[ /# )é   Úpathsr
   )ÚformatÚ__classdict__s   "€r   Ú__annotate__Ú%JinjaTemplatePartHandler.__annotate__'   s   ø€ ÷ 3ñ 3™eñ 3r   c                óè   € \         P                  P                  V \        ^R7       Wn        / V n        VP                  R. 4       F(  pVP                  4        F  pW0P
                  V&   K  	  K*  	  R# )é   )ÚversionÚsub_handlersN)r   ÚHandlerÚ__init__r   r%   r-   ÚgetÚ
list_types)Úselfr%   Ú_kwargsÚhandlerÚctypes   &&,  r   r/   Ú!JinjaTemplatePartHandler.__init__'   s`   € Ü×Ñ×!Ñ! $¬
¸AÐ!Ô>ØŒ
ØˆÔØ—{‘{ >°2Ö6ˆGØ ×+Ñ+Ö-�Ø+2×!Ñ! %Ó(ó .ó 7r   c                óF  € V\         P                  9   d   R # V P                  P                  R4      p \	        WCV4      pT'       g   R # \         P                  ! T4      p
T P                  P                  T
4      pT'       g   \        P                  RTT
4       R # TP                  ^8X  d   TP                  YY8YV4       R # TP                  ^8X  d   TP                  YY8T4       R # R #   \
         d,   p	\        P                  RT\        T	4      4        R p	?	R # R p	?	ii ; i)NÚinstance_data_sensitivez=Ignoring jinja template for %s. Failed to render template. %szPIgnoring jinja template for %s. Could not find supported sub-handler for type %s)r   ÚCONTENT_SIGNALSr%   Úget_runpathÚrender_jinja_payload_from_filer   ÚLOGÚwarningÚstrÚtype_from_starts_withr-   r0   Úhandler_versionÚhandle_part)r2   Údatar5   ÚfilenameÚpayloadÚ	frequencyÚheadersÚjinja_json_fileÚrendered_payloadÚeÚsubtypeÚsub_handlers   &&&&&&&     r   rA   Ú$JinjaTemplatePartHandler.handle_part/   s
  € Ø”H×,Ñ,Ô,ÙØŸ*™*×0Ñ0Ð1JÓKˆð	Ü=Ø ?ó Ð÷  ÙÜ×0Ò0Ð1AÓBˆØ×'Ñ'×+Ñ+¨GÓ4ˆßÜ�K‰Kð+àØô	ñ Ø×&Ñ&¨!Ô+Ø×#Ñ#Ø˜X¸öð ×(Ñ(¨AÔ-Ø×#Ñ#Ø˜X¸öñ .øô3 +ô 	Ü�K‰Kð0àÜ�A“ô	õ ûð	ús   ´C* Ã*D Ã5 DÄD )r%   r-   N)	r   r   r   r   Úprefixesr/   rA   r   Ú__classdictcell__)r'   s   @r   r"   r"   #   s!   ø‡ € à$Ð%€H÷3ð 3÷$ð $r   r"   c                óÌ  € \        V 4      ^ ,          R8w  d   \        R4      h/ pRp\        P                  P	                  V4      '       g   \        RV,          4      h \        \        V4      4      p\        YYC4      pT'       g   R# T#   \         dN   pRp\        T\        \        34      '       d   TP                  \        8X  d
   RT,          p\        T4      ThRp?ii ; i)a#  Render a jinja template sourcing variables from jinja_vars_path.

@param payload: String of jinja template content. Should begin with
    ## template: jinja\n.
@param payload_fn: String representing the filename from which the payload
    was read used in error reporting. Generally in part-handling this is
    'part-##'.
@param instance_data_file: A path to a json file containing variables that
    will be used as jinja template variables.

@return: A string of jinja-rendered content with the jinja header removed.
    Returns None on error.
ÚjinjazPayload is not a jinja templateNzFCannot render jinja template vars. Instance data not yet present at %sz"Loading Jinja instance data failedzGCannot render jinja template vars. No read permission on '%s'. Try sudo)r   r    ÚosÚpathÚexistsr   r   r   Ú	ExceptionÚ
isinstanceÚIOErrorÚOSErrorÚerrnor   Úrender_jinja_payload)rD   Ú
payload_fnÚinstance_data_fileÚdebugÚinstance_datarH   rI   Úmsgs   &&&&    r   r;   r;   V   sæ   € ô  �wÓ Õ" gÔ-ÜÐ=Ó>Ð>Ø€MØÐÜ�7‰7�>‰>Ð,×-Ò-ÜðØ1õ2ó
ð 	
ð
)Ü!¤.Ð1CÓ"DÓEˆô ,Ø˜]óÐ÷ ÙØÐøô ô )Ø2ˆÜ�aœ'¤7Ð+×,Ò,Ø�w‰wœ&Ô ð&Ø(:õ;ð ô ˜SÓ! qÐ(ûð)ús   ÁB ÂC#ÂACÃC#c                 óV  € \        VVP                  R . 4      RR7      pV'       d    \        P                  R\	        V4      4        \        W4      p\        P                  ! R\        ,          T4       Uu. uF   pRTP                  \        R4      ,          NK"  	  ppT'       d'   \        P                  R	TR
P!                  T4      4       T#   \        \        P                  \        P                  3 d,   p\        P                  RT\        T4      4        Rp?R# Rp?ii ; iu upi )zbase64-encoded-keysT)Údecode_pathsÚinclude_key_aliaseszConverted jinja variables
%sz"Ignoring jinja template for %s: %sNz%s[^\s]+z'%s'Ú z:Could not render jinja template variables in file '%s': %sz, )Úconvert_jinja_instance_datar0   r<   r\   r	   r   Ú	TypeErrorr   ÚUndefinedErrorÚSecurityErrorr=   r>   ÚreÚfindallr   ÚreplaceÚjoin)	rD   rZ   r]   r\   Úinstance_jinja_varsrH   rI   ÚvarÚwarningss	   &&&&     r   rY   rY   ƒ   s  € Ü5ØØ"×&Ñ&Ð'<¸bÓAØ ôÐ÷
 Ü�	‰	Ø+¬ZÐ8KÓ-Lô	
ðÜ(¨ÓFÐô —:’:ØÔ.Õ.Ð0@ô
óñ
ˆCð 	�—‘Ô1°2Ó6×6Ð6ñ
ð ð ÷ Ü�‰ØHØØ�I‰I�hÓô	
ð
 Ðøô% 	Ü×!Ñ!Ü× Ñ ðô ô
 	�‰Ð8¸*ÄcÈ!ÃfÔMÝûðüòs   ÁC Á6&D&Ã*D#Ã8 DÄD#c                óF   € V ^8„  d   QhR\         R\        \         ,          /# )r$   Ú	orig_nameÚreturn)r>   r   )r&   s   "r   r(   r(   ¥   s   € ÷ ñ ¬ð ´¼µñ r   c                ób   € \         P                  ! \        P                  RV 4      pW8w  d   V# R# )ac  Return a jinja variable alias, replacing any operators with underscores.

Provide underscore-delimited key aliases to simplify dot-notation
attribute references for keys which contain operators "." or "-".
This provides for simpler short-hand jinja attribute notation
allowing one to avoid quoting keys which contain operators.
{{ ds.v1_0.config.user_network_config }} instead of
{{ ds['v1.0'].config["user.network-config"] }}.

:param orig_name: String representing a jinja variable name to scrub/alias.

:return: A string with any jinja operators replaced if needed. Otherwise,
    none if no alias required.
Ú_N)rg   Úsubr   Úoperator_re)ro   Ú
alias_names   & r   Úget_jinja_variable_aliasrv   ¥   s+   € ô —’œ×)Ñ)¨3°	Ó:€JØÔØÐÙr   c           	     ón  € / pV Uu. uF  qfP                  RR4      NK  	  pp\        V P                  4       4       Fð  w  rxV'       d   RP                  WV4      MTp	W“9   d   \	        V4      p\        V\        4      '       dh   \        VV	VVVR7      WW&   \        P                  ! RV4      '       d8   WW,          P                  4        F  w  r«\        P                  ! V4      WZ&   K  	  MW…V&   V'       g   K½  \        V4      pV'       g   KÒ  \        P                  ! WW,          4      W\&   Kò  	  V# u upi )z–Process instance-data.json dict for use in jinja templates.

Replace hyphens with underscores for jinja templates and decode any
base64_encoded_keys.
Ú-rr   z	{0}{1}{2})Úsepr`   ra   zv\d+$)ri   ÚsortedÚitemsr&   r   rU   Údictrc   rg   ÚmatchÚcopyÚdeepcopyrv   )rB   Úprefixry   r`   ra   ÚresultrR   ÚkeyÚvalueÚkey_pathÚsubkeyÚsubvalueru   s   &&&&&        r   rc   rc   º   s  € ð €FÙ7CÓD±|¨t—L‘L  cÖ*±|€LÐDÜ˜TŸZ™Z›\Ö*‰
ˆß;A�;×%Ñ% f°3Ô7ÀsˆØÔ#Ü˜“KˆEÜ�eœT×"Ò"Ü5ØØØØ)Ø$7ôˆF‰Kô �xŠx˜ #×&Ò&à(.­×(9Ñ(9Ö(;Ñ$�FÜ%)§]¢]°8Ó%<�F“Nñ )<øð  �3‰KßÑÜ1°#Ó6ˆJß‰zÜ%)§]¢]°6µ;Ó%?�Ó"ñ+ +ð, €Mùò/ Es   ‡D2)F)rb   Ú/r   F)(r~   ÚloggingrQ   rg   rX   r   Útypingr   Újinja2r   r   Ú	cloudinitr   Úcloudinit.atomic_helperr   r	   Úcloudinit.helpersr   Úcloudinit.settingsr   Úcloudinit.templaterr   r   r   r   Úcloudinit.utilr   r   Ú	getLoggerr   r<   rT   r   r    r.   r"   r;   rY   rv   rc   r   r   r   Ú<module>r’      sˆ   ðó Û Û 	Û 	Ý Ý ç $å ß 4Ý #Ý )÷ó ÷ 5à×Ò˜Ó!€ô	�Yô 	ô	�Iô 	ô0˜x×/Ñ/ô 0ôf*ôZõDö* r   