Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/uaclient/files/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/uaclient/files/__pycache__/notices.cpython-310.pyc
o

���f�"�@s�ddlZddlZddlmZddlmZddlmZddlm	Z	m
Z
mZmZm
Z
e�e
�e��Ze
��Zedgd��ZGdd	�d	ee�ZGd
d�d�Zdadd
�Zdeddfdd�Zdeddfdd�Zdeefdd�ZdS)�N)�
namedtuple)�Enum)�List)�defaults�event_logger�messages�system�util�NoticeFileDetails)�order_id�label�is_permanent�messagec@s<eZdZedddejd�Zeddddd�Zed	d
dejd�Zedddej	d�Z	ed
ddej
d�Zedddejd�Zedddej
d�Z
edddejd�Zedddejjd�Zedddejd�Zedddejd�Zedddejd�Zedddejd�Zedddd d�Zed!d"dejd�Zed#d$dejd�Zed%d&dejd�Zd'S)(�Notice�contract_expired�5T)rrr
r�reboot_required�10FzSystem reboot required�enable_reboot_required�11�reboot_script_failed�12�fips_reboot_required�20�fips_system_reboot_required�21�fips_install_out_of_date�22�fips_disable_reboot_required�23�fips_proc_file_error�24�fips_manual_disable_url�25�wrong_fips_metapackage_on_cloud�lp_lts_reboot_required�30�contract_refresh_warning�40�operation_in_progress�60z"Operation in progress: {operation}�auto_attach_retry_full_notice�70�auto_attach_total_failure�71�limited_to_release�80N)�__name__�
__module__�__qualname__r
r�CONTRACT_EXPIRED�REBOOT_REQUIRED�ENABLE_REBOOT_REQUIRED_TMPL�ENABLE_REBOOT_REQUIRED�REBOOT_SCRIPT_FAILED�FIPS_REBOOT_REQUIRED_MSG�FIPS_REBOOT_REQUIRED�FIPS_SYSTEM_REBOOT_REQUIRED�FIPS_INSTALL_OUT_OF_DATE�FIPS_DISABLE_REBOOT_REQUIRED�FIPS_PROC_FILE_ERROR�tmpl_msg�NOTICE_FIPS_MANUAL_DISABLE_URL�FIPS_MANUAL_DISABLE_URL�&NOTICE_WRONG_FIPS_METAPACKAGE_ON_CLOUD�WRONG_FIPS_METAPACKAGE_ON_CLOUD�LIVEPATCH_LTS_REBOOT_REQUIRED�NOTICE_REFRESH_CONTRACT_WARNING�CONTRACT_REFRESH_WARNING�OPERATION_IN_PROGRESS�AUTO_ATTACH_RETRY_NOTICE�AUTO_ATTACH_RETRY_FULL_NOTICE�&AUTO_ATTACH_RETRY_TOTAL_FAILURE_NOTICE�AUTO_ATTACH_RETRY_TOTAL_FAILURE�LIMITED_TO_RELEASE�rMrM�8/usr/lib/python3/dist-packages/uaclient/files/notices.pyrs�����������������
�rc@s|eZdZdedefdd�Zdefdd�Zdedeefd	d
�Zdedede	fdd
�Z
dedefdd�Zdeefdd�ZdS)�NoticesManager�notice_details�descriptioncCs^t��st�d|jj�dS|jjrtjntj	}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�formatrr�
write_file�os�path�join)�selfrPrQ�	directory�filenamerMrMrN�addzs"�����zNoticesManager.addcCs\t��st�d|jj�dS|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 userNrR)r	rSrTrUrVrr
rrWrXrYrr�ensure_file_absentr[r\r])r^rPr_r`rMrMrN�remove�s����zNoticesManager.remover_�returncs��fdd�t���D�S)z�Gets 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|]}tj�tj��|��r���|�r|�qSrM)r[r\�isfiler]�_is_valid_notice_file)�.0�	file_name�r_r^rMrN�
<listcomp>�s�
��z9NoticesManager._get_notice_file_names.<locals>.<listcomp>)r[�listdir)r^r_rMrirN�_get_notice_file_names�s�z%NoticesManager._get_notice_file_namesrhcs$|tjk��fdd�tD�}||vS)z�Checks 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|]}|j�krd�|j|j��qS)rR)r
rYrr)rg�n��is_permanent_dirrMrN�	<setcomp>�s

�z7NoticesManager._is_valid_notice_file.<locals>.<setcomp>)rrWr)r^r_rh�valid_file_namesrMrnrNrf�s


�z$NoticesManager._is_valid_notice_filecCs<|�d�\}}tD]}|j|kr|j|kr|jjSq	dS)z�Gets the default message for a notice file.

        :param file_name: The name of the notice file.
        :returns: The default message defined in the enum.
        �-�)�splitrrrrVr)r^rhrr�noticerMrMrN�_get_default_message�s�z#NoticesManager._get_default_messagec
Cs�tjtjf}g}|D]B}tj�|�sq
|�|�}|D]1}zt�tj�	||��}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 )rrWrXr[r\�existsrlr�	load_filer]�PermissionErrorrTrU�appendrv�sort)r^�notice_directories�notices�notice_directory�notice_file_names�notice_file_name�notice_file_contents�default_messagerMrMrN�list�s8�
�����zNoticesManager.listN)
r1r2r3r�strrarcrrl�boolrfrvr�rMrMrMrNrOys�
�
rOcCstdurt�atS�N)�_notice_clsrOrMrMrMrN�
get_notice�sr�rPrdcKs(t�}|jjdi|��}|�||�dS)NrM)r�rrYra)rP�kwargsrurQrMrMrNrasracCst�}|�|�dSr�)r�rc)rPrurMrMrNrc
srccCst�}|��Sr�)r�r�)rurMrMrNr�sr�)�loggingr[�collectionsr�enumr�typingr�uaclientrrrrr	�	getLogger�replace_top_level_logger_namer1rT�get_event_logger�eventr
rrOr�r�rarcr�r�rMrMrMrN�<module>s&�i

Spamworldpro Mini