File: //usr/lib/python3/dist-packages/uaclient/entitlements/__pycache__/livepatch.cpython-310.pyc
o
S��c-5 � @ s$ d dl Z d dlZd dlmZmZmZmZmZ d dlm Z m
Z
mZmZm
Z
mZmZ d dlmZmZ d dlmZ d dlmZ ddgZd Zd
Zddd
�ZdZe
�� Z ddedeee ddfdd�Z d dee dee deee ddfdd�Z!dedee fdd�Z"G dd� de�Z#dd� Z$dS )!� N)�Any�Dict�List�Optional�Tuple)�apt�event_logger�
exceptions�messages�snap�system�util)�IncompatibleService�
UAEntitlement)�ApplicationStatus)�StaticAffordanceg �?g �?z
http-proxyzhttps-proxyz)Invalid Auth-Token provided to livepatch.z2Your running kernel is not supported by Livepatch.)zUnknown Auth-Tokenzunsupported kernelz/snap/bin/canonical-livepatch�
protocol_type�retry_sleeps�returnc C s, t �t�sdS t jtdd�| �g|d� dS )a�
Unset livepatch configuration settings for http and https proxies.
:param protocol_type: String either http or https
:param retry_sleeps: Optional list of sleep lengths to apply between
retries. Specifying a list of [0.5, 1] tells subp to retry twice
on failure; sleeping half a second before the first retry and 1 second
before the second retry.
N�configz {}-proxy=�r )r �which�
LIVEPATCH_CMD�subp�format)r r � r �A/usr/lib/python3/dist-packages/uaclient/entitlements/livepatch.py�unconfigure_livepatch_proxy s
�r �
http_proxy�https_proxyc C sb | s|rt �tjjtjd�� | rtjt dd�| �g|d� |r/tjt dd�|�g|d� dS dS )a�
Configure livepatch to use http and https proxies.
:param http_proxy: http proxy to be used by livepatch. If None, it will
not be configured
:param https_proxy: https proxy to be used by livepatch. If None, it will
not be configured
:@param retry_sleeps: Optional list of sleep lengths to apply between
snap calls
)�servicer z
http-proxy={}r zhttps-proxy={}N)
�event�infor
�SETTING_SERVICE_PROXYr �LivepatchEntitlement�titler r r �r r r r r r �configure_livepatch_proxy4 s"