File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/pkgng.cpython-310.pyc
o
�N�g�� � @ s� d Z ddlZddlZddlZddlZddlZddlZddlZddl Zddl
ZddlZddlZddl
mZmZ e�e�ZdZdd� ZdVdd�ZdVd d
�Zdd� ZdWdd�ZdXdd�Zdd� Zejj�ed�ZdYdd�Zejj�ed�Z dd� Z!ejj�e!d�Z"dd� Z# dZdd �Z$d!d"� Z%d[d#d$�Z&dVd%d&�Z'dVd'd(�Z(dVd)d*�Z) d\d+d,�Z* d]d-d.�Z+ejj�e+d/�Z,ejj�e+d0�Z-d1d2� Z.d^d3d4�Z/dYd5d6�Z0 d_d7d8�Z1d^d9d:�Z2 d`d;d<�Z3 = dad>d?�Z4dbd@dA�Z5dcdBdC�Z6dcdDdE�Z7dFdG� Z8dHdI� Z9dJdK� Z:dLdM� Z;dddNdO�Z<dedPdQ�Z=dRdS� Z>dfdTdU�Z?dS )gas
Support for ``pkgng``, the new package manager for FreeBSD
.. 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>`.
.. warning::
This module has been completely rewritten. Up to and including version
0.17.x, it was available as the ``pkgng`` module, (``pkgng.install``,
``pkgng.delete``, etc.), but moving forward this module will no longer be
available as ``pkgng``, as it will behave like a normal Salt ``pkg``
provider. The documentation below should not be considered to apply to this
module in versions <= 0.17.x. If your minion is running a 0.17.x release or
older, then the documentation for this module can be viewed using the
:mod:`sys.doc <salt.modules.sys.doc>` function:
.. code-block:: bash
salt bsdminion sys.doc pkgng
This module provides an interface to ``pkg(8)``. It acts as the default
package provider for FreeBSD 10 and newer. For FreeBSD hosts which have
been upgraded to use pkgng, you will need to override the ``pkg`` provider
by setting the :conf_minion:`providers` parameter in your Minion config
file, in order to use this module to manage packages, like so:
.. code-block:: yaml
providers:
pkg: pkgng
� N)�CommandExecutionError�MinionError�pkgc C s� t d dkrtS t d dkrtt d �dkrtS t d dkrItt d �dkrIi } d tv r0td } t�d
| � | rId| v rI| d dkrIt�d
� tS dS )z�
Load as 'pkg' on FreeBSD 10 and greater.
Load as 'pkg' on DragonFly BSD.
Load as 'pkg' on FreeBSD 9 when config option
``providers:pkg`` is set to 'pkgng'.
ZkernelZ DragonFly�osZFreeBSDZ osrelease�
Zosmajorrelease� � providersz__opts__.providers: %sr Zpkgngz_Configuration option 'providers:pkg' is set to 'pkgng', using 'pkgng' in favor of 'freebsdpkg'.)FzwThe pkgng execution module cannot be loaded: only available on FreeBSD 10 or FreeBSD 9 with providers.pkg set to pkgng.)Z
__grains__�__virtualname__�float�int�__opts__�log�debug)r � r �F/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/pkgng.py�__virtual__; s �r c C sH dg}| r|� d| g� |S |r|� d|g� |S |r"|� d|g� |S )zr
Returns the prefix for a pkg command, using -j if a jail is specified, or
-c if chroot is specified.
r z-jz-c�-r)�extend)�jail�chroot�root�retr r r �_pkgX s ��r c C s"