/usr/lib/python3/dist-packages/uaclient/files/__pycache__
NameSizeModeActions
data_types.cpython-310.pyc26440644editdlrm
files.cpython-310.pyc38100644editdlrm
machine_token.cpython-310.pyc76440644editdlrm
notices.cpython-310.pyc69060644editdlrm
state_files.cpython-310.pyc63230644editdlrm
user_config_file.cpython-310.pyc43440644editdlrm
__init__.cpython-310.pyc4870644editdlrm
Edit: /usr/lib/python3/dist-packages/uaclient/files/__pycache__/notices.cpython-310.pyc (6906B)
o Ki!@sddlZddlZddlmZddlmZddlmZddlm Z m Z m Z m Z m Z ee eZe ZedgdZGdd d eeZGd d d Zdad d ZdeddfddZdeddfddZdeefddZdS)N) namedtuple)Enum)List)defaults event_loggermessagessystemutilNoticeFileDetails)order_idlabel is_permanentmessagec@s*eZdZedddejdZedddddZed d dejdZed d dej dZ ed ddej dZ edddej dZ edddej dZ edddejdZedddejjdZedddejdZedddejdZedddejdZedddddZedd dejdZed!d"dejdZed#d$dejdZd%S)&Noticecontract_expired5T)r r r rreboot_required10FzSystem reboot requiredenable_reboot_required11reboot_script_failed12fips_reboot_required20fips_system_reboot_required21fips_install_out_of_date22fips_disable_reboot_required23fips_proc_file_error24fips_manual_disable_url25wrong_fips_metapackage_on_cloudlp_lts_reboot_required30operation_in_progress60z"Operation in progress: {operation}auto_attach_retry_full_notice70auto_attach_total_failure71limited_to_release80N)__name__ __module__ __qualname__r rCONTRACT_EXPIREDREBOOT_REQUIREDENABLE_REBOOT_REQUIRED_TMPLENABLE_REBOOT_REQUIREDREBOOT_SCRIPT_FAILEDFIPS_REBOOT_REQUIRED_MSGFIPS_REBOOT_REQUIREDFIPS_SYSTEM_REBOOT_REQUIREDFIPS_INSTALL_OUT_OF_DATEFIPS_DISABLE_REBOOT_REQUIREDFIPS_PROC_FILE_ERRORtmpl_msgNOTICE_FIPS_MANUAL_DISABLE_URLFIPS_MANUAL_DISABLE_URL&NOTICE_WRONG_FIPS_METAPACKAGE_ON_CLOUDWRONG_FIPS_METAPACKAGE_ON_CLOUDLIVEPATCH_LTS_REBOOT_REQUIREDOPERATION_IN_PROGRESSAUTO_ATTACH_RETRY_NOTICEAUTO_ATTACH_RETRY_FULL_NOTICE&AUTO_ATTACH_RETRY_TOTAL_FAILURE_NOTICEAUTO_ATTACH_RETRY_TOTAL_FAILURELIMITED_TO_RELEASErIrI8/usr/lib/python3/dist-packages/uaclient/files/notices.pyrs rc@s|eZdZdedefddZdefddZdedeefd d Zded ede fd d Z d edefddZ deefddZ dS)NoticesManagernotice_details descriptioncCs^tstd|jjdS|jjrtjntj }d |jj |jj}t tj|||dS)zAdds a notice file. If the notice is found, it overwrites it. :param notice_details: Holds details concerning the notice file. :param description: The content to be written to the notice file. z.NoticesManager.add(%s) called as non-root userN{}-{})r we_are_currently_rootLOGwarningvaluer r rNOTICES_PERMANENT_DIRECTORYNOTICES_TEMPORARY_DIRECTORYformatr r write_fileospathjoin)selfrLrM directoryfilenamerIrIrJaddts"   zNoticesManager.addcCs\tstd|jjdS|jjrtjntj }d |jj |jj}t tj||dS)ziDeletes a notice file. :param notice_details: Holds details concerning the notice file. z1NoticesManager.remove(%s) called as non-root userNrN)r rOrPrQrRr r rrSrTrUr rensure_file_absentrWrXrY)rZrLr[r\rIrIrJremoves zNoticesManager.remover[returncsfddtDS)zGets the list of notice file names in the given directory. :param directory: The directory to search for notice files. :returns: List of notice file names. cs2g|]}tjtj|r|r|qSrI)rWrXisfilerY_is_valid_notice_file).0 file_namer[rZrIrJ s z9NoticesManager._get_notice_file_names..)rWlistdir)rZr[rIrerJ_get_notice_file_namess z%NoticesManager._get_notice_file_namesrdcs$|tjkfddtD}||vS)zChecks if the notice file is valid. :param file_name: The name of the notice file. :returns: True if the file is valid, False otherwise. cs&h|]}|jkrd|j|jqS)rN)r rUr r )rcnis_permanent_dirrIrJ s  z7NoticesManager._is_valid_notice_file..)rrSr)rZr[rdvalid_file_namesrIrjrJrbs  z$NoticesManager._is_valid_notice_filecCs<|d\}}tD]}|j|kr|j|kr|jjSq dS)zGets the default message for a notice file. :param file_name: The name of the notice file. :returns: The default message defined in the enum. -)splitrr r rRr)rZrdr r noticerIrIrJ_get_default_messages  z#NoticesManager._get_default_messagec Cstjtjf}g}|D]B}tj|sq ||}|D]1}z ttj ||}Wnt y8t d|Yqw|rA| |q||}| |qq ||S)zdGets all the notice files currently saved. :returns: List of notice file contents. zPermission error while reading )rrSrTrWrXexistsrhr load_filerYPermissionErrorrPrQappendrrsort)rZnotice_directoriesnoticesnotice_directorynotice_file_namesnotice_file_namenotice_file_contentsdefault_messagerIrIrJlists8      zNoticesManager.listN) r/r0r1rstrr]r_rrhboolrbrrrrIrIrIrJrKss   rKcCstdurtatSN) _notice_clsrKrIrIrIrJ get_noticesrrLr`cKs(t}|jjdi|}|||dS)NrI)rrrUr])rLkwargsrqrMrIrIrJr]sr]cCst}||dSr)rr_)rLrqrIrIrJr_sr_cCst}|Sr)rr)rqrIrIrJr sr)loggingrW collectionsrenumrtypingruaclientrrrrr getLoggerreplace_top_level_logger_namer/rPget_event_loggereventr rrKrrr]r_rrrIrIrIrJs&   c