OwlCyberSecurity - MANAGER
Edit File: upgrade_lts_contract.cpython-38.pyc
U wc�h� � @ s� d Z ddlZddlZddlmZmZmZmZmZ ddl m Z ddlmZ ddl mZ ddlmZmZ ddlmZmZ d d ddd 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)r r r r r r Zquesting)�cfg�returnc C s t �d� t| �js"t �d� d S t �d� ttj� ttj� tdd��}t � |�� t j� W 5 Q R X t | �D ]�}zt| |dd�}W n" tjk r� t �d|� Y nX |�� \}}|�� \}}|tjkrp|tjkrpt �d |� |jt� d �}|spt �d|� qpttj� d S )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�debugr Zis_attached�printr ZRELEASE_UPGRADE_STARTINGZRELEASE_UPGRADE_APT_LOCK_WAIT�open�fcntl�lockf�filenoZLOCK_EXr r r ZEntitlementNotFoundError�application_status�applicability_statusr ZENABLEDr ZINAPPLICABLEZ_perform_disabler ZRELEASE_UPGRADE_SUCCESS)r Zlockfiler Zentitlementr �_r! Zret� r# �?/usr/lib/python3/dist-packages/uaclient/upgrade_lts_contract.py�%process_contract_delta_after_apt_lock<