Your IP : 216.73.216.52


Current Path : /usr/lib/python3/dist-packages/uaclient/entitlements/__pycache__/
Upload File :
Current File : //usr/lib/python3/dist-packages/uaclient/entitlements/__pycache__/esm.cpython-38.pyc

U

8�-dF�@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)�CanDisableFailurecsdeZdZdZeeeedfd�dd��Zde	e	d��fdd	�
Z
d
d�dd�Zd
d�d
d�Z�Z
S)�ESMBaseEntitlementzhttps://ubuntu.com/security/esm.��returncCsddlm}m}||fS)Nr)�ROSEntitlement�ROSUpdatesEntitlement)Zuaclient.entitlements.rosrr)�selfrr�r�;/usr/lib/python3/dist-packages/uaclient/entitlements/esm.py�dependent_servicessz%ESMBaseEntitlement.dependent_servicesF)�silentrcs4ddlm}t�j|d�}|r0||j�|��|S�Nr)�update_motd_messages)r)�uaclient.jobs.update_messagingr�super�_perform_enable�cfg�disable_local_esm_repo)rrrZenable_performed��	__class__rrrs
z"ESMBaseEntitlement._perform_enableNcCs�t��d}|j�d�st�|jtd�d�}tj�t	|j
j|jd��}|j}tj�
|�r`dSt�|tj||d��tj�t|�}tj�t	t|�}tjtj�|�dd�t�||�dS)N�serieszesm-��name)r#r!T)�exist_ok)rZget_platform_infor#�
startswith�AssertionError�len�os�path�normpathr
�repo_list_file_tmpl�format�
repo_key_file�existsZ
write_filer�joinr	r�makedirs�dirnamerZexport_gpg_key)rr!Zesm_name�
repo_filename�keyring_fileZsource_keyring_fileZdestination_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#rZensure_file_absent)rr3r2rrrr<s��
z)ESMBaseEntitlement.disable_local_esm_repo)F)�__name__�
__module__�__qualname__Zhelp_doc_url�propertyrrrr�boolrr4r�
__classcell__rrrrrs	rcsHeZdZdZdZdZdZdZdee	e
deffd��fd	d
�
Z�Z
S)�ESMAppsEntitlementZ
UbuntuESMAppszesm-appszUbuntu Pro: ESM Appsz.Expanded Security Maintenance for Applicationszubuntu-advantage-esm-apps.gpgFNrcsDddlm}t�j|d�\}}|r<||j�t��r<|��||fSr)rrr�disablerrZis_current_series_ltsr4�rrrZdisable_performedZfailrrrr<Ns
zESMAppsEntitlement.disable)F)r5r6r7�originr#�title�descriptionr-rr9rr
r<r:rrrrr;Gs��r;csHeZdZdZdZdZdZdZdee	e
deffd��fd	d
�
Z�Z
S)�ESMInfraEntitlementz	esm-infraZ	UbuntuESMzUbuntu Pro: ESM Infraz0Expanded Security Maintenance for Infrastructurez%ubuntu-advantage-esm-infra-trusty.gpgFNrcsDddlm}t�j|d�\}}|r<||j�t��r<|��||fSr)rrrr<rrZis_current_series_active_esmr4r=rrrr<bs
zESMInfraEntitlement.disable)F)r5r6r7r#r>r?r@r-rr9rr
r<r:rrrrrA[s��rA)r(�typingrrrZuaclientrrZuaclient.aptrrr	Zuaclient.defaultsr
Zuaclient.entitlementsrZuaclient.entitlements.baserZ(uaclient.entitlements.entitlement_statusr
ZRepoEntitlementrr;rArrrr�<module>s;