HEX
Server: nginx/1.24.0
System: Linux webserver 6.8.0-90-generic #91-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 18 14:14:30 UTC 2025 x86_64
User: wpuser (1002)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/uaclient/__pycache__/upgrade_lts_contract.cpython-312.pyc
�

wc�h�����dZddlZddlZddlmZmZmZmZmZddl	m
Z
ddlmZddl
mZddlmZmZddlmZmZd	d
ddd
ddd�Zej,ej.e��Zdeddfd�Zd�Zy)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�ApplicationStatus�trusty�xenial�bionic�focal�jammy�noble�plucky)rrrrrr�questing�cfg�returnc��tjd�t|�jstjd�ytjd�t	t
j�t	t
j�tdd�5}tj|j�tj�ddd�t|�D]�}	t||d��}j#�\}}|j%�\}}|t&j(k(s�L|t*j,k(s�`tjd	|�|j/t1��
�}|r��tjd|���t	t
j2�y#1swY��xYw#tj $rtjd|�Y��wxYw)Nz%Check whether to upgrade-lts-contractz4Skipping upgrade-lts-contract. Machine is unattachedzStarting upgrade-lts-contract.z/var/lib/apt/lists/lock�w�)r�name�variantzentitlement not found: %sz!upgrade-lts-contract disabling %s)�progressz(upgrade-lts-contract failed disabling %s)�LOG�debugr	�is_attached�printr�RELEASE_UPGRADE_STARTING�RELEASE_UPGRADE_APT_LOCK_WAIT�open�fcntl�lockf�fileno�LOCK_EXrrr�EntitlementNotFoundError�application_status�applicability_statusr�ENABLEDr
�INAPPLICABLE�_perform_disabler�RELEASE_UPGRADE_SUCCESS)r�lockfiler�entitlementr+�_r,�rets        �?/usr/lib/python3/dist-packages/uaclient/upgrade_lts_contract.py�%process_contract_delta_after_apt_lockr6<sy���I�I�5�6����(�(��	�	�H�I���I�I�.�/�	�(�
+�
+�,�	�(�
0�
0�1�	
�'��	-�6��
���H�O�O�%�u�}�}�5�6�*�#�.�L��	9�-�����K�!,� >� >� @���A�"-�"B�"B�"D���a�
�"3�";�";�;�$�(;�(H�(H�H�
�I�I�9�4�@��.�.��8I�.�J�C���	�	�D�d�K�-L�0
�(�
*�
*�+�76�6���2�2�	9��I�I�1�4�8�	9�s�3F�F+�F(�+)G�Gc�J�tjtj�y)N)r�ensure_folder_absentr�ESM_APT_ROOTDIR��r5�remove_private_esm_apt_cacher<es��
���� 8� 8�9r;)�__doc__r&�logging�uaclientrrrrr�uaclient.apir�(uaclient.api.u.pro.status.is_attached.v1r	�uaclient.configr
�uaclient.entitlementsrr�(uaclient.entitlements.entitlement_statusr
r�!current_codename_to_past_codename�	getLogger�replace_top_level_logger_name�__name__rr6r<r:r;r5�<module>rIs����.
��A�A�(�A�$�����
�
�
���%�!��g���:��:�:�8�D�E��&,�x�&,�D�&,�R:r;