| Current Path : /usr/lib/python3/dist-packages/uaclient/__pycache__/ |
| Current File : //usr/lib/python3/dist-packages/uaclient/__pycache__/snap.cpython-38.pyc |
U
8�-dB � @ s� d dl Z d dlZd dlmZmZ d dlmZmZmZm Z m
Z
dZdddgZdZ
d Zd
Ze�� Zed�dd
�Zdee ee eee dd�dd�Zdeeee dd�dd�Zeee d�dd�Zeee d�dd�ZG dd� d�Zee d�dd�ZdS ) � N)�List�Optional)�apt�event_logger�
exceptions�messages�systemz
/usr/bin/snapg �?g �?g @z
proxy.httpzproxy.httpsu …)�returnc C s dt �� kS )z(Returns whether or not snap is installedZsnapd)r Zget_installed_packages_names� r
r
�//usr/lib/python3/dist-packages/uaclient/snap.py�is_installed s r )�
http_proxy�https_proxy�retry_sleepsr c C s~ t �t�st�d�t�� dS | s&|r:t�tj jdd�� | rZt j
dddd�| �g|d� |rzt j
dddd �|�g|d� dS )
a
Configure snap to use http and https proxies.
:param http_proxy: http proxy to be used by snap. If None, it will
not be configured
:param https_proxy: https proxy to be used by snap. If None, it will
not be configured
: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.
z1Skipping configure snap proxy. {} does not exist.N�snap)�service�setr z
proxy.http={}�r zproxy.https={})r �which�SNAP_CMD�logging�debug�format�event�infor ZSETTING_SERVICE_PROXY�subp)r
r r r
r
r �configure_snap_proxy s&