Ë
    œf-  ã            
       óþ   — U d Z ddlZddlmZ ddlmZmZmZ ddlm	Z	 ddl
mZ ddlmZmZ ddlmZ dd	lmZ d
ZeZdddeege ed«      gg dœZeed<    ej.                  e«      Z ee«      Z dZdedede	deddf
d„Zy)z@Final Message: Output final message when cloud-init has finishedé    N)Údedent)Ú	templaterÚutilÚversion)ÚCloud)ÚConfig)Ú
MetaSchemaÚget_meta_doc)ÚALL_DISTROS)Ú
PER_ALWAYSaŒ  This module configures the final message that cloud-init writes. The message is
specified as a jinja template with the following variables set:

    - ``version``: cloud-init version
    - ``timestamp``: time at cloud-init finish
    - ``datasource``: cloud-init data source
    - ``uptime``: system uptime

This message is written to the cloud-init log (usually /var/log/cloud-init.log)
as well as stderr (which usually redirects to /var/log/cloud-init-output.log).

Upon exit, this module writes the system uptime, timestamp, and cloud-init
version to ``/var/lib/cloud/instance/boot-finished`` independent of any
user data specified for this module.
Úcc_final_messagezFinal Messagez1Output final message when cloud-init has finishedz×            final_message: |
              cloud-init has finished
              version: $version
              timestamp: $timestamp
              datasource: $datasource
              uptime: $uptime
            )ÚidÚnameÚtitleÚdescriptionÚdistrosÚ	frequencyÚexamplesÚactivate_by_schema_keysÚmetazy## template: jinja
Cloud-init v. {{version}} finished at {{timestamp}}. Datasource {{datasource}}.  Up {{uptime}} secondsr   ÚcfgÚcloudÚargsÚreturnc           
      óH  — d}t        |«      dk7  rt        |d   «      }nt        j                  |dd«      }|j	                  «       }|st
        }t        j                  «       }t        j                  «       }t        j                  «       }	 |||t        |j                  «      dœ}|j                  t        |j                  «       D 	
cg c]  \  }	}
|	j                  «       |
f‘Œ c}
}	«      «       t        j                  dt!        j"                  ||«      z  ddt$        ¬«       |j,                  j.                  }	 |›d|›d|›d}t        j0                  ||d¬«       |j                  j2                  rt$        j5                  d«       y y c c}
}	w # t         j&                  $ r.}t        j(                  t$        d	t        |«      «       Y d }~Œ©d }~wt*        $ r t        j(                  t$        d
«       Y ŒÑw xY w# t*        $ r t        j(                  t$        d|«       Y ŒÁw xY w)NÚ r   Úfinal_message)ÚuptimeÚ	timestampr   Ú
datasourcez%s
FT)ÚconsoleÚstderrÚlogz,Failed to render templated final message: %sz'Failed to render final message templatez - z - v. ú
)Úensure_dir_existsz%Failed to write boot finished file %szUsed fallback datasource)ÚlenÚstrr   Úget_cfg_option_strÚstripÚFINAL_MESSAGE_DEFr   Útime_rfc2822r   Úversion_stringr    ÚupdateÚdictÚitemsÚupperÚ	multi_logr   Úrender_stringÚLOGÚJinjaSyntaxParsingExceptionÚlogexcÚ	ExceptionÚpathsÚboot_finishedÚ
write_fileÚis_disconnectedÚwarning)r   r   r   r   Úmsg_inr   ÚtsÚcverÚsubsÚkÚvÚeÚboot_fin_fnÚcontentss                 úC/usr/lib/python3/dist-packages/cloudinit/config/cc_final_message.pyÚhandlerF   F   s¼  € à€FÜ
ˆ4ƒyA‚~ÜT˜!‘W“‰ä×(Ñ(¨¨o¸rÓBˆà\‰\‹^€FÙÜ"ˆä[‰[‹]€FÜ	×	Ñ	Ó	€BÜ×!Ñ!Ó#€DðDàØØÜ˜e×.Ñ.Ó/ñ	
ˆð 	‰”D°T·Z±Z³\×B©T¨Q°˜1Ÿ7™7›9 aš.ÓBÓCÔDÜ‰Ø”i×-Ñ-¨f°dÓ;Ñ<ØØÜõ		
ð —+‘+×+Ñ+€KðOÚ*0²"²dÐ;ˆÜ‰˜ XÀÕGð ×Ñ×'Ò'Ü‰Ð.Õ/ð (ùó+ Cøô ×0Ñ0ò 
Ü‰ÜÐ?ÄÀQÃ÷	
ñ 	
ûô ò DÜ‰”CÐBÖCðDûô ò OÜ‰”CÐ@À+ÖNðOúsC   Â=F Ã	FÃ%A F Ä<#G: ÆF ÆG7Æ%$GÇ&G7Ç6G7Ç:$H!È H!)Ú__doc__ÚloggingÚtextwrapr   Ú	cloudinitr   r   r   Úcloudinit.cloudr   Úcloudinit.configr   Úcloudinit.config.schemar	   r
   Úcloudinit.distrosr   Úcloudinit.settingsr   ÚMODULE_DESCRIPTIONr   r   Ú__annotations__Ú	getLoggerÚ__name__r3   r*   r'   ÚlistrF   © ó    rE   ú<module>rW      s¾   ðò Gã Ý ç .Ñ .Ý !Ý #ß <Ý )Ý )ðÐ ð  €	à
ØØ@Ø%Øˆ}Øáðó		
ðð  "ñ'€€jó ð, €g×Ñ˜Ó!€Ù
tÓ
€ð9ð ð,0ð ,0˜6ð ,0¨%ð ,0°tð ,0Àô ,0rV   