HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux ip-10-0-8-47 6.8.0-1021-aws #23~22.04.1-Ubuntu SMP Tue Dec 10 16:31:58 UTC 2024 aarch64
User: ubuntu (1000)
PHP: 8.1.2-1ubuntu2.22
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/cloudinit/config/__pycache__/cc_final_message.cpython-310.pyc
o

�Ad�
�@s�UdZddlmZddlmZddlmZmZmZddl	m
Z
ddlmZddl
mZmZddlmZdd	lmZd
ZeZddd
eegeed�ggd�Zeed<ee�ZdZdedede
dededdf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.
�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�log�args�returnNcCs,d}t|�dkrt|d�}nt�|dd�}|��}|st}t��}t��}t�	�}z)|||t|j
�d�}	|	�tdd�|	�
�D���tjdt�||	�dd	|d
�Wntybt�|d�Ynw|jj}
zd|||f}tj|
|dd
�Wnty�t�|d|
�Ynw|j
jr�|�d�dSdS)N�r�
final_message)�uptime�	timestampr�
datasourcecSsg|]
\}}|��|f�qS�)�upper)�.0�k�vr!r!�C/usr/lib/python3/dist-packages/cloudinit/config/cc_final_message.py�
<listcomp>]szhandle.<locals>.<listcomp>z%s
FT)�console�stderrrz'Failed to render final message templatez%s - %s - v. %s
)�ensure_dir_existsz%Failed to write boot finished file %szUsed fallback datasource)�len�strr�get_cfg_option_str�strip�FINAL_MESSAGE_DEFr�time_rfc2822r�version_stringr �update�dict�items�	multi_logr�
render_string�	Exception�logexc�paths�
boot_finished�
write_file�is_disconnected�warning)rrrrr�msg_inr�ts�cver�subs�boot_fin_fn�contentsr!r!r&�handleEsH�
����rD)�__doc__�loggingr�textwrapr�	cloudinitrrr�cloudinit.cloudr�cloudinit.configr�cloudinit.config.schemar	r
�cloudinit.distrosr�cloudinit.settingsr�MODULE_DESCRIPTIONrr�__annotations__r/r,�listrDr!r!r!r&�<module>sN����������