File: //lib/python3/dist-packages/uaclient/files/__pycache__/notices.cpython-38.pyc
U
��Jh�! � @ s� d dl Z d dlZd dlmZ d dlmZ d dlmZ d dlm Z m
Z
mZmZm
Z
e �e
�e��Ze
�� Zedddd d
g�ZG dd� dee�ZG d
d� d�Zdadd� Zedd�dd�Zedd�dd�Zee d�dd�ZdS )� N)�
namedtuple)�Enum)�List)�defaults�event_logger�messages�system�util�NoticeFileDetails�order_id�label�is_permanent�messagec @ s* e Zd Zedddejd�Zeddddd�Zed d
dejd�Zedddej d�Z ed
ddej
d�Zedddejd�Zedddej
d�Z
edddejd�Zedddejjd�Zedddejd�Zedddejd�Zedddejd�Zeddddd�Zedd dejd�Zed!d"dejd�Zed#d$dejd�Zd%S )&�NoticeZcontract_expired�5T)r r r
r Zreboot_requiredZ10FzSystem reboot requiredZenable_reboot_requiredZ11Zreboot_script_failedZ12Zfips_reboot_requiredZ20Zfips_system_reboot_requiredZ21Zfips_install_out_of_dateZ22Zfips_disable_reboot_requiredZ23Zfips_proc_file_errorZ24Zfips_manual_disable_urlZ25Zwrong_fips_metapackage_on_cloudZlp_lts_reboot_requiredZ30Zoperation_in_progressZ60z"Operation in progress: {operation}Zauto_attach_retry_full_noticeZ70Zauto_attach_total_failureZ71Zlimited_to_releaseZ80N)�__name__�
__module__�__qualname__r
r ZCONTRACT_EXPIREDZREBOOT_REQUIREDZENABLE_REBOOT_REQUIRED_TMPLZENABLE_REBOOT_REQUIREDZREBOOT_SCRIPT_FAILEDZFIPS_REBOOT_REQUIRED_MSGZFIPS_REBOOT_REQUIREDZFIPS_SYSTEM_REBOOT_REQUIREDZFIPS_INSTALL_OUT_OF_DATEZFIPS_DISABLE_REBOOT_REQUIREDZFIPS_PROC_FILE_ERRORZtmpl_msgZNOTICE_FIPS_MANUAL_DISABLE_URLZFIPS_MANUAL_DISABLE_URLZ&NOTICE_WRONG_FIPS_METAPACKAGE_ON_CLOUDZWRONG_FIPS_METAPACKAGE_ON_CLOUDZLIVEPATCH_LTS_REBOOT_REQUIREDZOPERATION_IN_PROGRESSZAUTO_ATTACH_RETRY_NOTICEZAUTO_ATTACH_RETRY_FULL_NOTICEZ&AUTO_ATTACH_RETRY_TOTAL_FAILURE_NOTICEZAUTO_ATTACH_RETRY_TOTAL_FAILUREZLIMITED_TO_RELEASE� r r �8/usr/lib/python3/dist-packages/uaclient/files/notices.pyr s� ����������������r c @ sr e Zd Zeed�dd�Zed�dd�Zeee d�dd �Zeee d
�dd�Z
eed
�dd�Zee d�dd�ZdS )�NoticesManager)�notice_details�descriptionc C s^ t �� st�d|jj� dS |jjr*tjntj }d�
|jj|jj�}t�
tj�||�|� dS )z�Adds 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_root�LOG�warning�valuer r
r �NOTICES_PERMANENT_DIRECTORY�NOTICES_TEMPORARY_DIRECTORY�formatr r Z
write_file�os�path�join)�selfr r � directory�filenamer r r �addt s$ ��� ��zNoticesManager.add)r c C s\ t �� st�d|jj� dS |jjr*tjntj }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 userNr )r r r r r r r
r r r r r r Zensure_file_absentr! r"