File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/aptpkg.cpython-310.pyc
Back
o ;j`� � @ s d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddlmZ ddl mZ ddlmZ ddlmZ ddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Zddl!Zddl"Zddl#Zddl$Zddl%m&Z&m'Z'm(Z(m)Z) ddl*m+Z+ e�,e-�Z.zdd l/m0Z0m1Z1 d Z2W n e3y� dZ2Y nw zddl4Z4d Z5W n e3y� dZ5Y nw zddl6Z7d Z8W n e3y� dZ8Y nw dZ9d Z:dZ;dZ<e=g d��Z>ddddd�Z?dZ@dd� ZAdd� ZBdd� ZCe2�s G dd� d�Z0G dd� d�Z1d d!� ZDd"d#� ZEd�d$d%�ZFd&d'� ZGd(d)� ZHd*d+� ZId,d-� ZJejKjL�MeJd.�ZNd/d0� ZOd�d1d2�ZP d�d3d4�ZQd�d6d7�ZRd�d8d9�ZSd�d:d5�ZTd�d;d<�ZUd�d=d>�ZVd�d?d@�ZWd�dAdB�ZXdCdD� ZY d�dEdF�ZZd�dGdH�Z[d�dIdJ�Z\dKdL� Z]d�dMdN�Z^dOdP� Z_dQdR� Z`dSdT� ZadUdV� ZbdWdX� ZcdYdZ� Zdd[d\� Zed]d^� Zfd_d`� Zgdadb� Zhd�dcdd�Zid�dedf�Zj g d�dhdi�Zkdjdk� Zld�dldm�Zmd�dndo�Zndpdq� Zodrds� Zpd�dtdu�Zqdvdw� Zrd�dxdy�Zsd�dzd{�Ztd|d}� Zud~d� Zvd�d�� Zwd�d�� Zxd�d�d��Zyd�d�� ZzdS )�a{ Support for APT (Advanced Packaging Tool) .. important:: If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to *'pkg.install' is not available*), see :ref:`here <module-provider-override>`. For repository management, the ``python-apt`` package must be installed. � N)�OrderedDict)� HTTPError)�Request)�urlopen)�CommandExecutionError�CommandNotFoundError�MinionError�SaltInvocationError)� _parse_env)�SourceEntry�SourcesListTFz/var/lib/apt/lists�:z4deb http://ppa.launchpad.net/{0}/{1}/ubuntu {2} mainz@deb https://{0}private-ppa.launchpad.net/{1}/{2}/ubuntu {3} main)�uri�comps� architectures�disabled�file�dist�signedby�noneZnoninteractive�1)ZAPT_LISTBUGS_FRONTENDZAPT_LISTCHANGES_FRONTENDZDEBIAN_FRONTENDZUCF_FORCE_CONFFOLD�pkgc C s t �d�dkr tS dS )z9 Confirm this module is on a Debian-based system Z os_familyZDebian)Fz9The pkg module could not be loaded: unsupported OS family)� __grains__�get�__virtualname__� r r �G/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/aptpkg.py�__virtual__b s r c C s t � tkr tj�t� dS dS )zv For Debian and derivative systems, set up a few env variables to keep apt happy and non-interactive. N)r r �os�environ�update� DPKG_ENV_VARS)�optsr r r �__init__q s �r# c C sB d}d}d}| � � } | sd}|||dfS | �d�r!d}| dd� } | �d�}|dkr8| |d d� }| d|� } t�d| � � �}|rcd d � |�d��� D �|�d�� � g dd � |�d ��� D � }n| � � �� }|rw|d dvswt|�d k rd}||||fS |d �d�r�tdd� |dd� D ��s�d}||||fS ||||fS )z� This is a workaround since python3-apt does not support the signed-by argument. This function was removed from the class to ensure users using the python3-apt module or not can use the signed-by option. F� T�#� Nr z(.*)(cdrom:.*/)(.*)c S � g | ]}|� � �qS r ��strip��.0�pr r r � <listcomp>� � z_invalid.<locals>.<listcomp>� c S r'