Your IP : 216.73.217.13


Current Path : /usr/lib/python3/dist-packages/cloudinit/config/__pycache__/
Upload File :
Current File : //usr/lib/python3/dist-packages/cloudinit/config/__pycache__/cc_final_message.cpython-38.pyc

U

�Ad�
�	@s�UdZddlmZddlmZddlmZmZmZddl	m
Z
ddlmZddl
mZmZddlmZdd	lmZd
ZeZddd
eegeed�ggd�Zeed<ee�ZdZeee
eedd�dd�ZdS)z@Final Message: Output final message when cloud-init has finished�)�Logger)�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.
Zcc_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�titleZdescriptionZdistros�	frequencyZexamplesZactivate_by_schema_keys�metazy## template: jinja
Cloud-init v. {{version}} finished at {{timestamp}}. Datasource {{datasource}}.  Up {{uptime}} secondsN)r�cfg�cloud�log�args�returncCs0d}t|�dkrt|d�}nt�|dd�}|��}|s<t}t��}t��}t�	�}zR|||t|j
�d�}	|	�tdd�|	�
�D���tjdt�||	�dd	|d
�Wn tk
r�t�|d�YnX|jj}
z"d|||f}tj|
|dd
�Wn$tk
�rt�|d|
�YnX|j
j�r,|�d�dS)N�rZ
final_message)�uptimeZ	timestampr�
datasourcecSsg|]\}}|��|f�qS�)�upper)�.0�k�vrr�C/usr/lib/python3/dist-packages/cloudinit/config/cc_final_message.py�
<listcomp>]szhandle.<locals>.<listcomp>z%s
FT)Zconsole�stderrrz'Failed to render final message templatez%s - %s - v. %s
)Zensure_dir_existsz%Failed to write boot finished file %szUsed fallback datasource)�len�strrZget_cfg_option_str�strip�FINAL_MESSAGE_DEFrZtime_rfc2822rZversion_stringr�update�dict�itemsZ	multi_logrZ
render_string�	ExceptionZlogexc�pathsZ
boot_finishedZ
write_fileZis_disconnectedZwarning)rrrrrZmsg_inrZtsZcverZsubsZboot_fin_fn�contentsrrr�handleEsB��

r,)�__doc__Zloggingr�textwraprZ	cloudinitrrrZcloudinit.cloudrZcloudinit.configrZcloudinit.config.schemar	r
Zcloudinit.distrosrZcloudinit.settingsrZMODULE_DESCRIPTIONrr�__annotations__r%r#�listr,rrrr�<module>s@�����