U 'Dg @sUdZddlZddlmZmZmZddlmZddlm Z ddl m Z ddl m Z ddlmZdd lmZeZd e gegd Ze ed <eeZd Zee eeddddZdS)z@Final Message: Output final message when cloud-init has finishedN) templaterutilversion)Cloud)Config) MetaSchema) ALL_DISTROS)log_util) PER_ALWAYSZcc_final_message)idZdistros frequencyZactivate_by_schema_keysmetazy## template: jinja Cloud-init v. {{version}} finished at {{timestamp}}. Datasource {{datasource}}. Up {{uptime}} seconds)namecfgcloudargsreturnc Cs~d}t|dkrt|d}nt|dd}|}|s<szhandle..z%s FT)Zconsolestderrlogz,Failed to render templated final message: %sz'Failed to render final message templatez%s - %s - v. %s )Zensure_dir_existsz%Failed to write boot finished file %sNoneZdatasource_listzUsed fallback datasource)lenstrrZget_cfg_option_strstripFINAL_MESSAGE_DEFrZ time_rfc2822rZversion_stringrupdatedictitemsr Z multi_logrZ render_stringLOGZJinjaSyntaxParsingExceptionZlogexc ExceptionpathsZ boot_finishedZ write_fileZdsnameZsys_cfggetZwarning) rrrrZmsg_inrZtsZcverZsubseZ boot_fin_fncontentsrrrhandle&sP  r-)__doc__ZloggingZ cloudinitrrrZcloudinit.cloudrZcloudinit.configrZcloudinit.config.schemarZcloudinit.distrosrZ cloudinit.logr Zcloudinit.settingsr r r __annotations__Z getLogger__name__r'r#r!listr-rrrrs$