HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux ip-10-0-8-47 6.8.0-1021-aws #23~22.04.1-Ubuntu SMP Tue Dec 10 16:31:58 UTC 2024 aarch64
User: ubuntu (1000)
PHP: 8.1.2-1ubuntu2.22
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/uaclient/entitlements/__pycache__/esm.cpython-310.pyc
o

S��cv�@s�ddlZddlmZmZmZddlmZmZddlm	Z	m
Z
mZddlm
Z
ddlmZddlmZddlmZGd	d
�d
ej�ZGdd�de�ZGd
d�de�ZdS)�N)�Tuple�Type�Union)�gpg�system)�APT_KEYS_DIR�ESM_REPO_FILE_CONTENT�KEYRINGS_DIR)�ESM_APT_ROOTDIR)�repo)�
UAEntitlement)�CanDisableFailurecs^eZdZdZedeeedffdd��Zdde	de	f�fdd	�
Z
ddd�Zdd
d�Z�Z
S)�ESMBaseEntitlementzhttps://ubuntu.com/security/esm�return.cCsddlm}m}||fS)Nr)�ROSEntitlement�ROSUpdatesEntitlement)�uaclient.entitlements.rosrr)�selfrr�r�;/usr/lib/python3/dist-packages/uaclient/entitlements/esm.py�dependent_servicessz%ESMBaseEntitlement.dependent_servicesF�silentcs4ddlm}t�j|d�}|r||j�|��|S�Nr)�update_apt_and_motd_messages)r)�uaclient.jobs.update_messagingr�super�_perform_enable�cfg�disable_local_esm_repo)rrr�enable_performed��	__class__rrrs
z"ESMBaseEntitlement._perform_enableNcCs�t��d}|j�d�sJ�|jtd�d�}tj�t|j	j
|jd��}|j}tj�|�r0dSt�
|tj
||d��tj�t|�}tj�tt|�}tjtj�|�dd�t�||�dS)N�serieszesm-��name)r$r"T)�exist_ok)r�get_platform_infor$�
startswith�len�os�path�normpathr
�repo_list_file_tmpl�format�
repo_key_file�exists�
write_filer�joinr	r�makedirs�dirnamer�export_gpg_key)rr"�esm_name�
repo_filename�keyring_file�source_keyring_file�destination_keyring_filerrr�setup_local_esm_repo!s&��
�z'ESMBaseEntitlement.setup_local_esm_repocCsJtj�tt|j�}tj�t|jj|jd��}t	�
|�t	�
|�dS)Nr#)r)r*r+r
rr.r,r-r$r�ensure_file_absent)rr7r6rrrr<s��
z)ESMBaseEntitlement.disable_local_esm_repo�F)rN)�__name__�
__module__�__qualname__�help_doc_url�propertyrrrr�boolrr:r�
__classcell__rrr rrs
	rc�JeZdZdZdZdZdZdZ	ddee	e
defff�fd	d
�
Z�Z
S)�ESMAppsEntitlement�
UbuntuESMAppszesm-appszUbuntu Pro: ESM Appsz.Expanded Security Maintenance for Applicationszubuntu-advantage-esm-apps.gpgFrNc�Dddlm}t�j|d�\}}|r||j�t��r|��||fSr)rrr�disablerr�is_current_series_ltsr:�rrr�disable_performed�failr rrrHN�
zESMAppsEntitlement.disabler<)r=r>r?�originr$�title�descriptionr.rrBrr
rHrCrrr rrEG���rEcrD)�ESMInfraEntitlementz	esm-infra�	UbuntuESMzUbuntu Pro: ESM Infraz0Expanded Security Maintenance for Infrastructurez%ubuntu-advantage-esm-infra-trusty.gpgFrNcrGr)rrrrHrr�is_current_series_active_esmr:rJr rrrHbrMzESMInfraEntitlement.disabler<)r=r>r?r$rNrOrPr.rrBrr
rHrCrrr rrR[rQrR)r)�typingrrr�uaclientrr�uaclient.aptrrr	�uaclient.defaultsr
�uaclient.entitlementsr�uaclient.entitlements.baser�(uaclient.entitlements.entitlement_statusr
�RepoEntitlementrrErRrrrr�<module>s;