File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/pkg.cpython-310.pyc
Back
o ;jG/ � @ s� d Z ddlZddlZddlZddlZddlmZ ddlZ ddl Z ddlZ ddlZ ddl mZmZmZ ddlmZ ddlmZ ddlmZ eee� �Ze jj�� r�ddlmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$ eee� �Zee#e� �Z#eee� �Zeee� �Zee$e� �Z$ee"e� �Z"ee e� �Z eee� �Zee!e� �Z!e�%e&�Z'd d � Z(dd� Z)dLd d�Z*dd� Z+ dMdd�Z,dLdd�Z-dd� Z. dNdd�Z/dOdd�Z0 dPdd�Z1 dQdd �Z2dOd!d"�Z3d#d$� Z4d%d&� Z5d'd(� Z6dRd)d*�Z7 dSd+d,�Z8 dTd-d.�Z9dOd/d0�Z:dLd1d2�Z; dUd3d4�Z< 5 dVd6d7�Z=dWd8d9�Z>dWd:d;�Z?dXd<d=�Z@dOd>d?�ZAd@dA� ZBdBdC� ZCdDdE� ZDdFdG� ZEdYdHdI�ZFdYdJdK�ZGdS )Za� Installation of packages using OS package managers such as yum or apt-get ========================================================================= .. note:: On minions running systemd>=205, as of version 2015.8.12, 2016.3.3, and 2016.11.0, `systemd-run(1)`_ is now used to isolate commands which modify installed packages from the ``salt-minion`` daemon's control group. This is done to keep systemd from killing the package manager commands spawned by Salt, when Salt updates itself (see ``KillMode`` in the `systemd.kill(5)`_ manpage for more information). If desired, usage of `systemd-run(1)`_ can be suppressed by setting a :mod:`config option <salt.modules.config.get>` called ``systemd.use_scope``, with a value of ``False`` (no quotes). .. _`systemd-run(1)`: https://www.freedesktop.org/software/systemd/man/systemd-run.html .. _`systemd.kill(5)`: https://www.freedesktop.org/software/systemd/man/systemd.kill.html Salt can manage software packages via the pkg state module, packages can be set up to be installed, latest, removed and purged. Package management declarations are typically rather simple: .. code-block:: yaml vim: pkg.installed A more involved example involves pulling from a custom repository. .. code-block:: yaml base: pkgrepo.managed: - name: ppa:wolfnet/logstash - dist: precise - file: /etc/apt/sources.list.d/logstash.list - keyid: 28B04E4A - keyserver: keyserver.ubuntu.com logstash: pkg.installed: - fromrepo: ppa:wolfnet/logstash Multiple packages can also be installed with the use of the pkgs state module .. code-block:: yaml dotdeb.repo: pkgrepo.managed: - name: deb http://packages.dotdeb.org wheezy-php55 all - dist: wheezy-php55 - file: /etc/apt/sources.list.d/dotbeb.list - keyid: 89DF5277 - keyserver: keys.gnupg.net - refresh_db: true php.packages: pkg.installed: - fromrepo: wheezy-php55 - pkgs: - php5-fpm - php5-cli - php5-curl .. warning:: Make sure the package name has the correct case for package managers which are case-sensitive (such as :mod:`pkgng <salt.modules.pkgng>`). � N)�OrderedDict)�CommandExecutionError�MinionError�SaltInvocationError)�_repack_pkgs)�nested)�namespaced_function) �_get_latest_pkg_version�_get_package_info�_get_repo_details�_refresh_db_conditional�_repo_process_pkg_sls�_reverse_cmp_pkg_versions�genrepo� get_repo_data� refresh_dbc C s dt v rdS dS )zn Only make these states available if a pkg provider has been detected or assigned for this minion �pkg.installT)Fzpkg module could not be loaded��__salt__� r r �C/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/pkg.py�__virtual__t s r c C s* t jj�| �� �\}}|dv rd}||fS )z� Return a tuple containing the comparison operator and the version. If no comparison operator was passed, the comparison is assumed to be an "equals" comparison, and "==" will be the operator returned. )�=� �==)�salt�utils�pkgZsplit_comparison�strip)�pkgver�oper�verstrr r r �_get_comparison_spec~ s r"