HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //proc/self/root/lib/python3/dist-packages/uaclient/__pycache__/upgrade_lts_contract.cpython-38.pyc
U

��Jh+�@s�dZddlZddlZddlZddlmZmZmZmZm	Z	ddl
mZddlm
Z
ddlmZddd	d
ddd
�Ze�e	�e��Ze
dd�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)�contract�defaults�messages�system�util)�_is_attached)�UAConfig)�
machine_tokenZtrusty�xenial�bionic�focal�jammy�noble)r
rrr
rZoracular)�cfg�returnc	Cs>t�d�t|�js"t�d�dSt�d�tjddgddgd�\}}|rTttj�t�	�j
}t�|�}t
�|�}|dkr�ttjj|d	��t�d
|t
�t�d�|j|d�}|��}d}|r�t�d�t�d
�tjddgddgd�\}}|d7}q�t�d||�ttj�tj|||ddd�t�d|�ttj�dS)Nz%Check whether to upgrade-lts-contractz4Skipping upgrade-lts-contract. Machine is unattachedzStarting upgrade-lts-contract.Zlsofz/var/lib/apt/lists/lockr�)Zrcs)�releasez?Could not find past release for %s. Current known releases: %r.)�seriesz4Detected that apt lock is held. Sleeping 10 seconds.�
z9upgrade-lts-contract processing contract deltas: %s -> %sTF)r�past_entitlements�new_entitlementsZallow_enableZseries_overridesz/upgrade-lts-contract succeeded after %s retries)�LOG�debugrZis_attachedrZsubp�printrZ'RELEASE_UPGRADE_APT_LOCK_HELD_WILL_WAITZget_release_inforr	Zget_machine_token_file�!current_codename_to_past_codename�getZRELEASE_UPGRADE_NO_PAST_RELEASE�formatZwarning�sys�exitZentitlements�time�sleepZRELEASE_UPGRADE_STARTINGrZprocess_entitlements_deltaZRELEASE_UPGRADE_SUCCESS)	r�outZ_errZcurrent_releaseZmachine_token_fileZpast_releaserrZretry_count�r"�?/usr/lib/python3/dist-packages/uaclient/upgrade_lts_contract.py�%process_contract_delta_after_apt_lock4sb







���


�

�
�r$cCst�tj�dS)N)rZensure_folder_absentrZESM_APT_ROOTDIRr"r"r"r#�remove_private_esm_apt_cachensr%)�__doc__ZloggingrrZuaclientrrrrrZ(uaclient.api.u.pro.status.is_attached.v1rZuaclient.configrZuaclient.filesr	rZ	getLoggerZreplace_top_level_logger_name�__name__rr$r%r"r"r"r#�<module>s"�	: