܍~c UdZddlmZddlmZddlmZmZmZddl m Z ddl m Z ddl mZmZddlmZdd lmZd ZeZd d d eegeedggdZeed<eeZdZdede de dededdf dZdS)z@Final Message: Output final message when cloud-init has finished)Logger)dedent) templaterutilversion)Cloud)Config) MetaSchema get_meta_doc) ALL_DISTROS) PER_ALWAYSaThis 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 )idnametitle descriptiondistros frequencyexamplesactivate_by_schema_keysmetazy## template: jinja Cloud-init v. {{version}} finished at {{timestamp}}. Datasource {{datasource}}. Up {{uptime}} secondsrcfgcloudlogargsreturnNc~d}t|dkrt|d}ntj|dd}|}|st }tj}tj}tj } |||t|j d} | td| Dtjdtj|| zdd| n%#t"$rtj|d YnwxYw|jj} |d |d |d } tj| | dn&#t"$rtj|d| YnwxYw|j jr|ddSdS)Nr final_message)uptime timestampr datasourcec@g|]\}}||fS)upper).0kvs C/usr/lib/python3/dist-packages/cloudinit/config/cc_final_message.py zhandle..]s(BBBTQ17799a.BBBz%s FT)consolestderrrz'Failed to render final message templatez - z - v.  )ensure_dir_existsz%Failed to write boot finished file %szUsed fallback datasource)lenstrrget_cfg_option_strstripFINAL_MESSAGE_DEFr time_rfc2822rversion_stringr"updatedictitems multi_logr render_string Exceptionlogexcpaths boot_finished write_fileis_disconnectedwarning) rrrrrmsg_inr tscversubs boot_fin_fncontentss r)handlerIEsF 4yyA~~T!W(orBB \\^^F #" []]F   B  ! # #DDe.//    DBBTZZ\\BBBCCDDD  i-fd;; <      DDD CBCCCCCD++KO*0&&"""ddd;  XGGGGG OOO C@+NNNNNO '0 ./////00s%BDEE"E44 FF)__doc__loggingrtextwrapr cloudinitrrrcloudinit.cloudrcloudinit.configr cloudinit.config.schemar r cloudinit.distrosr cloudinit.settingsr MODULE_DESCRIPTIONrr__annotations__r4r1listrIr$r+r)rVszGFF..........!!!!!!######<<<<<<<<))))))))))))    @%}    "'j, ,t  9*0 *0*0#(*0/5*0=A*0 *0*0*0*0*0*0r+