File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/freebsdpkg.cpython-310.pyc
Back
o ;jD � @ s� d Z ddlZddlZddlZddlZddlZddlZddlm Z m Z e�e�Z dZdd� Zd#dd�Zd d � Zdd� Zejj�ed �Zdd� Zdd� Zdd� Zd$dd�Zd%dd�Zd#dd�Zejj�ed�Zejj�ed�Zdd� Zdd � Z d!d"� Z!dS )&a\ Remote package support using ``pkg_add(1)`` .. 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.0, it supported ``pkg_add(1)``, but checked for the existence of a pkgng local database and, if found, would provide some of pkgng's functionality. The rewrite of this module has removed all pkgng support, and moved it to the :mod:`pkgng <salt.modules.pkgng>` execution module. For versions <= 0.17.0, the documentation here should not be considered accurate. If your Minion is running one of these versions, 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 pkg This module acts as the default package provider for FreeBSD 9 and older. If you need to use pkgng on a FreeBSD 9 system, you will need to override the ``pkg`` provider by setting the :conf_minion:`providers` parameter in your Minion config file, in order to use pkgng. .. code-block:: yaml providers: pkg: pkgng More information on pkgng support can be found in the documentation for the :mod:`pkgng <salt.modules.pkgng>` module. This module will respect the ``PACKAGEROOT`` and ``PACKAGESITE`` environment variables, if set, but these values can also be overridden in several ways: 1. :strong:`Salt configuration parameters.` The configuration parameters ``freebsdpkg.PACKAGEROOT`` and ``freebsdpkg.PACKAGESITE`` are recognized. These config parameters are looked up using :mod:`config.get <salt.modules.config.get>` and can thus be specified in the Master config file, Grains, Pillar, or in the Minion config file. Example: .. code-block:: yaml freebsdpkg.PACKAGEROOT: ftp://ftp.freebsd.org/ freebsdpkg.PACKAGESITE: ftp://ftp.freebsd.org/pub/FreeBSD/ports/ia64/packages-9-stable/Latest/ 2. :strong:`CLI arguments.` Both the ``packageroot`` (used interchangeably with ``fromrepo`` for API compatibility) and ``packagesite`` CLI arguments are recognized, and override their config counterparts from section 1 above. .. code-block:: bash salt -G 'os:FreeBSD' pkg.install zsh fromrepo=ftp://ftp2.freebsd.org/ salt -G 'os:FreeBSD' pkg.install zsh packageroot=ftp://ftp2.freebsd.org/ salt -G 'os:FreeBSD' pkg.install zsh packagesite=ftp://ftp2.freebsd.org/pub/FreeBSD/ports/ia64/packages-9-stable/Latest/ .. note:: These arguments can also be passed through in states: .. code-block:: yaml zsh: pkg.installed: - fromrepo: ftp://ftp2.freebsd.org/ � N)�CommandExecutionError�MinionError�pkgc C s^ t d dkr-tt d �dk r-i } dtv rtd } | r+d| v r+| d dkr+t�d� d S tS d S )z� Load as 'pkg' on FreeBSD versions less than 10. Don't load on FreeBSD 9 when the config option ``providers:pkg`` is set to 'pkgng'. �osZFreeBSDZ osrelease� � providersr Zpkgngz]Configuration option 'providers:pkg' is set to 'pkgng', won't load old provider 'freebsdpkg'.)FzlThe freebsdpkg execution module cannot be loaded: the configuration option 'providers:pkg' is set to 'pkgng')FzrThe freebsdpkg execution module cannot be loaded: either the os is not FreeBSD or the version of FreeBSD is >= 10.)Z __grains__�float�__opts__�log�debug�__virtualname__)r � r �K/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/freebsdpkg.py�__virtual__Z s �r c C s\ | dur| nt d dd�}|dur|nt d dd�}i }|dur$||d<