File manager - Edit - /usr/lib/python3/dist-packages/uaclient/__pycache__/apt.cpython-310.pyc
Back
o ,2�d�h � @ s" d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl Z d dl mZ d dlm Z mZmZmZmZmZ d dlZd dlZd dlmZmZmZmZmZ d dlmZ dZdZdZd Z d Z!dZ"dZ#d Z$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,g d�Z-e�.� Z/ej0G dd� dej1��Z2edde3fde3fde3fg�Z4dd� Z5de3d eej6 fd!d"�Z7 dyd#ee3 d$ee3 d%ee e3e3f d e3fd&d'�Z8edd(� dyd$ee3 d%ee e3e3f d e3fd)d*��Z9G d+d,� d,�Z:d-d.� Z;d/d0� Z< 1dzd2e3d3e=d ee3 fd4d5�Z> dyd6e3d$ee3 d%ee e3e3f d e3fd7d8�Z? d{d%ee e3e3f d e3fd9d:�Z@ d|d;ee3 d<eee3 d$ee3 d%ee e3e3f d e3f d=d>�ZAd?e3d@e3dAe3dBee3 dCe3d dfdDdE�ZBdFdG� ZCdHdI� ZD d{d?e3d@e3dCee3 d dfdJdK�ZEdLdM� ZFdNdO� ZGdPdQ� ZHdRdS� ZIddT�dUdV�ZJd2e3d e=fdWdX�ZKd ee4 fdYdZ�ZLdzd[e=d ee3 fd\d]�ZMdde2jNfd^ee3 d_ee3 d`ee2 d dfdadb�ZOdce3dde3dee3d e=fdfdg�ZPd eeQ fdhdi�ZRd eej fdjdk�ZSd}dldm�ZTdnee3 doe3fdpdq�ZUdrds� ZVdtdu� ZWdvee3 d e e3ee3ee3 f f fdwdx�ZXdS )~� N)� lru_cache)�Dict�Iterable�List� NamedTuple�Optional�Union)�event_logger� exceptions�gpg�messages�system)�ESM_APT_ROOTDIRg N@z # ubuntu-advantage-toolszDir::Etc::netrc/zDir::Etc::netrcparts/zDir::State::lists/z$Acquire::http::Proxy "{proxy_url}"; z%Acquire::https::Proxy "{proxy_url}"; z4Acquire::http::Proxy::esm.ubuntu.com "{proxy_url}"; z5Acquire::https::Proxy::esm.ubuntu.com "{proxy_url}"; z/etc/apt/trusted.gpg.d/z/usr/share/keyringsz/usr/lib/apt/methods/httpsz /usr/sbin/update-ca-certificatesz//etc/apt/apt.conf.d/90ubuntu-advantage-aptproxyz*/var/lib/apt/periodic/update-success-stampaL # Written by ubuntu-advantage-tools deb https://esm.ubuntu.com/{name}/ubuntu {series}-{name}-security main # deb-src https://esm.ubuntu.com/{name}/ubuntu {series}-{name}-security main deb https://esm.ubuntu.com/{name}/ubuntu {series}-{name}-updates main # deb-src https://esm.ubuntu.com/{name}/ubuntu {series}-{name}-updates main )g �?g @g $@c @ s e Zd Ze� Ze� ZdS )� AptProxyScopeN)�__name__� __module__�__qualname__�object�GLOBAL�UACLIENT� r r �./usr/lib/python3/dist-packages/uaclient/apt.pyr = s r �InstalledAptPackages�name�version�archc C s | � d�\}}tj�d�sdS z0t�� �!}tjddd�||||�tj� |d�gt td� W d � W dS 1 s8w Y W dS tj yy } z-|jdkrpt|j��� }t�d |�rbt�d �| ���t�d|�rpt�d�| ���t�d ��d}~w tjy� t�d�t |���w )a Validate apt credentials for a PPA. @param repo_url: private-ppa url path @param username: PPA login username. @param password: PPA login password or resource token. @raises: UserFacingError for invalid credentials, timeout or unexpected errors. �://z/usr/lib/apt/apt-helperNz download-filez{}://{}:{}@{}/ubuntu/pool/zapt-helper-output)�timeout�retry_sleeps�d z401\s+unauthorized|httperror401z'Invalid APT credentials provided for {}zconnection timed outz-Timeout trying to access APT repository at {}z7Unexpected APT error. See /var/log/ubuntu-advantage.logzVCannot validate credentials for APT repo. Timeout after {} seconds trying to reach {}.)�split�os�path�exists�tempfile�TemporaryDirectoryr �subp�format�join�APT_HELPER_TIMEOUT�APT_RETRIESr �ProcessExecutionError� exit_code�str�stderr�lower�re�search�UserFacingError� subprocess�TimeoutExpired)�repo_url�username�password�protocol� repo_path�tmpd�er. r r r �assert_valid_apt_credentialsH sT ���&� ��������r<