Your IP : 216.73.216.224


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

U

wc�h��@s�dZddlZddlZddlmZmZmZmZmZddl	m
Z
ddlmZddl
mZddlmZmZddlmZmZd	d
ddd
ddd�Ze�e�e��Zedd�dd�Zdd�ZdS)a�
This function is called from lib/upgrade_lts_contract.py and from
lib/reboot_cmds.py

This function should be used after running do-release-upgrade in a machine.
It will detect any contract deltas between the release before
do-release-upgrade and the current release. If we find any differences in
the uaclient contract between those releases, we will apply that difference
in the upgraded release.

For example, suppose we are on Trusty and we are upgrading to Xenial. We found
that the apt url for esm services on trusty:

https://esm.ubuntu.com/ubuntu

While on Xenial, the apt url is:

https://esm.ubuntu.com/infra/ubuntu

This script will detect differences like that and update the Xenial system
to reflect them.
�N)�defaults�
exceptions�messages�system�util)�ProgressWrapper)�_is_attached)�UAConfig)�entitlement_factory�entitlements_enable_order)�ApplicabilityStatus�ApplicationStatusZtrusty�xenial�bionic�focal�jammy�noble�plucky)rrrrrrZquesting)�cfg�returnc	Cst�d�t|�js"t�d�dSt�d�ttj�ttj�tdd��}t	�
|��t	j�W5QRXt
|�D]�}zt||dd�}Wn"tjk
r�t�d|�YnX|��\}}|��\}}|tjkrp|tjkrpt�d	|�|jt�d
�}|spt�d|�qpttj�dS)Nz%Check whether to upgrade-lts-contractz4Skipping upgrade-lts-contract. Machine is unattachedzStarting upgrade-lts-contract.z/var/lib/apt/lists/lock�w�)r�nameZvariantzentitlement not found: %sz!upgrade-lts-contract disabling %s)Zprogressz(upgrade-lts-contract failed disabling %s)�LOG�debugrZis_attached�printrZRELEASE_UPGRADE_STARTINGZRELEASE_UPGRADE_APT_LOCK_WAIT�open�fcntl�lockf�filenoZLOCK_EXrr
rZEntitlementNotFoundError�application_status�applicability_statusr
ZENABLEDrZINAPPLICABLEZ_perform_disablerZRELEASE_UPGRADE_SUCCESS)rZlockfilerZentitlementr �_r!Zret�r#�?/usr/lib/python3/dist-packages/uaclient/upgrade_lts_contract.py�%process_contract_delta_after_apt_lock<s:





�
��r%cCst�tj�dS)N)rZensure_folder_absentrZESM_APT_ROOTDIRr#r#r#r$�remove_private_esm_apt_cacheesr&)�__doc__rZloggingZuaclientrrrrrZuaclient.apirZ(uaclient.api.u.pro.status.is_attached.v1rZuaclient.configr	Zuaclient.entitlementsr
rZ(uaclient.entitlements.entitlement_statusrr
Z!current_codename_to_past_codenameZ	getLoggerZreplace_top_level_logger_name�__name__rr%r&r#r#r#r$�<module>s&�
)