File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/win_pkg.cpython-310.pyc
o
�N�g�Z � @ s� d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl Z
ddlmZ ddl
ZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZmZmZmZ ddlmZ e� e!�Z"dZ#dd� Z$d d
� Z%dd� Z&dBdd�Z'dd� Z(dd� Z)
dCdd�Z*dDdd�Z+dd� Z,dd� Z-dd� Z.dd � Z/ !dEd"d#�Z0dBd$d%�Z1d&d'� Z2d(d)� Z3dFd*d+�Z4d,d-� Z5dGd.d/�Z6dGd0d1�Z7dEd2d3�Z8dEd4d5�Z9dEd6d7�Z:dEd8d9�Z;d:d;� Z<d<d=� Z=dHd@dA�Z>dS )Ia�
A module to manage software on Windows
.. 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>`.
The following functions require the existence of a :ref:`windows repository
<windows-package-manager>` metadata DB, typically created by running
:py:func:`pkg.refresh_db <salt.modules.win_pkg.refresh_db>`:
- :py:func:`pkg.get_repo_data <salt.modules.win_pkg.get_repo_data>`
- :py:func:`pkg.install <salt.modules.win_pkg.install>`
- :py:func:`pkg.latest_version <salt.modules.win_pkg.latest_version>`
- :py:func:`pkg.list_available <salt.modules.win_pkg.list_available>`
- :py:func:`pkg.list_pkgs <salt.modules.win_pkg.list_pkgs>`
- :py:func:`pkg.list_upgrades <salt.modules.win_pkg.list_upgrades>`
- :py:func:`pkg.remove <salt.modules.win_pkg.remove>`
If a metadata DB does not already exist and one of these functions is run, then
one will be created from the repo SLS files that are present.
As the creation of this metadata can take some time, the
:conf_minion:`winrepo_cache_expire_min` minion config option can be used to
suppress refreshes when the metadata is less than a given number of seconds
old.
.. note::
Version numbers can be ``version number string``, ``latest`` and ``Not
Found``, where ``Not Found`` means this module was not able to determine
the version of the software installed, it can also be used as the version
number in sls definitions file in these cases. Versions numbers are sorted
in order of 0, ``Not Found``, ``order version numbers``, ..., ``latest``.
� N)�
cmp_to_key)�CommandExecutionError�MinionError�SaltInvocationError�SaltRenderError��LooseVersion�pkgc C s t jj�� rtS dS )z9
Set the virtual pkg module if the os is Windows
)Fz4Module win_pkg: module only works on Windows systems)�salt�utils�platformZ
is_windows�__virtualname__� r r �H/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/win_pkg.py�__virtual__L s r c
O sT | sdS i }| D ]}d||<