%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyc

�
���^c@@s�dZddlmZmZmZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZddlmZyddlZeZWnek
r�eZnXddlmZddlZddlZddlZddlZddlZddlZddlZddlZddl Zddl!Zddl"Zddl#Zddl#m$Z%ddl&Zddl'm(Z(m)Z)m*Z*ddl
mZe	j+e,�Z-d	Z.d
Z/d�Z0d�Z1e.ed
�Z2d�Z3d�Z4d�Z5d�Z6d�Z7d�Z8d�Z9e:d�Z;d�Z<d�Z=ej>j?j@e=d�ZAd�ZBd�ZCed�ZDed�ZEd�ZFed�ZGej>j?j@eGd�ZHd �ZId!�ZJd"�ZKd#�ZLd$ej>jMjNfd%��YZOe:eee:e:eeeed&ed'�ZPe:e:eeeeed(�ZQe:e:eeeeed)�ZRe:e:d*�ZSe:e:d+�ZTe:e:e:ed,�ZUe:e:e:d-�ZVe.ed.�ZWej>j?j@eWd/�ZXd0�ZYd1�ZZed2�Z[d3�Z\ffd4�Z]ej>j?j@e]d5�Z^e:d6�Z_e:d7�Z`e:d8�Zae:d9�Zbd:�Zcd;�Zdd<�Zed=�Zfd>�Zgej>jhjijjd?�d@��ZkdA�ZledB�ZmedC�ZndD�ZodS(Eu�
Support for YUM/DNF

.. 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>`.

.. note::
    DNF is fully supported as of version 2015.5.10 and 2015.8.4 (partial
    support for DNF was initially added in 2015.8.0), and DNF is used
    automatically in place of YUM in Fedora 22 and newer.
i(tabsolute_importtprint_functiontunicode_literalsN(tsix(tzip(tconfigparser(tLooseVersion(tCommandExecutionErrortMinionErrortSaltInvocationErroru[\w+]+(?:[.-][^-]+)*upkgcC@s�tjd�dkrtdfSy$tdj�}tdj�}Wntk
r]tdfSXd
}|dks|||kr�tStdfS(u2
    Confine this module to yum based systems
    uyum_provideru
yumpkg_apiu0Module yumpkg: yumpkg_api provider not availableuosu	os_familyu+Module yumpkg: no yum based system detecteduamazonuxcpu	xenserveruvirtuozzolinuxu	virtuozzouredhat(uamazonuxcpu	xenserveruvirtuozzolinuxu	virtuozzo(t__opts__tgettFalset
__grains__tlowert	Exceptiont__virtualname__(tos_graint	os_familytenabled((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyt__virtual__Is

cG@s~|sd}ng|D]}|j�^q}d}xCtjjj|d�D])}|j�|krM||d7}qMqMW|S(	Nuinstalled packagesuavailable packagesuavailable upgradesuupdated packagesuupgraded packagesuu
(uinstalled packagesuavailable packagesuavailable upgradesuupdated packagesuupgraded packages(Rtsalttutilst	itertoolstsplit(toutputtargstargs_lctxtrettline((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyt_strip_headers\s	cC@s�|r9t�dkr'dj|�}qidj|�}n0t�dkrZdj|�}ndj|�}tj||�}|r�|s�|jd�jdd�d}|jdd�d}|jdd�dS|jd�Snd	S(
u�
    Resolve a package name from a line containing the hold expression. If the
    regex is not matched, None is returned.

    yum ==> 2:vim-enhanced-7.4.629-5.el6.*
    dnf ==> vim-enhanced-2:7.4.827-1.fc22.*
    udnfu	({0}-\S+)u
(\d+:{0}-\S+)u
\d+:({0}-\S+)iu.iu-N(t_yumtformattretsearchtgrouptrsplittNone(Rtpatterntfulltlock_retmatchtwoarchtworel((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyt	_get_holdlscC@s`d}|tkrXdtdj�krKttd�dkrKdt|<qXdt|<nt|S(u[
    Determine package manager name (yum or dnf),
    depending on the system version.
    uyum_binufedorauosu	osreleaseiudnfuyum(t__context__R
Rtint(t
contextkey((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyR �s

cK@s�idd6td6tjjjt��d6}|j|�g}tjjjt	�r~t
ddt�r~|jddg�n|j
t��|j|�t
d	||�S(
u
    Call yum/dnf.
    utraceuoutput_loglevelupython_shelluenvu
config.getu
systemd.scopeusystemd-runu--scopeucmd.run_all(RRRtenvironmenttget_module_environmenttglobalstupdatetsystemdt	has_scopeR.t__salt__tTruetextendtappendR (Rtkwargstparamstcmd((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyt	_call_yum�s

(
cc@sji}tjd�}tjjjt|��}td}x)t||�D]\}}|dkr�y$|jdd�\|d<|d<Wn%t	k
r�||d<||d<nXtjj
jj|d|d|�|d<qJ|dkr�|j
d�}n|dkr|jd	�}n|||<|dkrJtjj
jj|�}i}|d
k	rb|VqbqJqJWd
S(u�
    Parse yum/dnf output (which could contain irregular line breaks if package
    names are long) retrieving the name, version, etc., and return a list of
    pkginfo namedtuples.
    unameuversionurepoiduosarchu.iuarchu-u@N(unameuversionurepoid(RtcycleRRRRR
RR%t
ValueErrortpkgtrpmtresolve_nametrstriptlstriptpkginfoR&(RtcurtkeystvaluestosarchtkeytvalueRF((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyt_yum_pkginfo�s0
$


cC@s�t�dkr`ttjd��dkrEtjr<d}q]d}q�tjrWd}q�d}n!tjd�dkr{d	nd
}|t�kr�tdj|���ndS(
uC
    Ensure that the appropriate versionlock plugin is present
    udnfuosmajorreleaseiupython3-dnf-plugin-versionlockupython2-dnf-plugin-versionlocku&python3-dnf-plugins-extras-versionlocku%python-dnf-plugins-extras-versionlocku5uyum-versionlockuyum-plugin-versionlocku%Cannot proceed, {0} is not installed.N(	R R/R
RRtPY3t	list_pkgsR	R!(t	vl_plugin((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyt_check_versionlock�s						cK@s:|jdd�}|jdd�}|jdd�}|jdd�}|jdd�}|jdd�}|jdd�}|dkr�g}ntjjj|�}|jd	t�}|r�|r�|}ng}	|rtjd
|�|	j	ddj
|�g�n�|rtt|t�s)|gn|}
tjd
dj
|
��|	j	g|
D]}dj
|�^qU�n|r�t|t�s�|gn|}
tjddj
|
��|	j	g|
D]}dj
|�^q��n|rtjd|�|	jdj
|��n|r;tjd|�|	jdj
|��nx*|D]"}|	j	dtj|�g�qBW|r6x�t|�D]�}
|
jd�r�q{n||
}t|tj�r�tjd|
|�|	jdj
|
|��q{|tkr{tjd|
�|	jdj
|
��q{q{W|	r6tjd|	�q6n|	S(uf
    Returns a list of options to be used in the yum/dnf command, based on the
    kwargs passed.
    ufromrepouurepoudisablerepou
enablerepoudisableexcludesubranchusetoptuget_extra_optionsuRestricting to repo '%s'u--disablerepo=*u--enablerepo={0}uDisabling repo(s): %su, u--disablerepo={0}uEnabling repo(s): %suDisabling excludes for '%s'u--disableexcludes={0}uAdding branch '%s'u--branch={0}u--setoptu__uFound extra option --%s=%su	--{0}={1}uFound extra option --%su--{0}uAdding extra options: %sN(tpopR&RRRtsplit_inputRtlogtinfoR9R!t
isinstancetlisttjoinR:Rt	text_typetsortedt
startswithtstring_typesR8(R;tfromrepotrepotdisablerepot
enablerepotdisableexcludestbranchtsetopttget_extra_optionsRttargetsRtitemRKRL((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyt_get_options�sd	
	&,
 
cC@siddgd6}tr�yItj�}t|j_x*tj|j�D]\}}|||<qGWWq
t	tj
jfk
r�}tdj
|���q
tj
jk
r�}tdj
|���q
XnAd}d}x*|D]"}tjj|�r�|}Pq�q�W|s td	j
|���ntj�}	y|	j|�Wn1ttfk
rp}td
j
||���nX|	jd�r�x�|	jd�D]c}
|
dkr�g|	jd|
�jd�D]}|j�^q�||
<q�|	jd|
�||
<q�Wntjd|�|S(uf
    Returns a dict representing the yum config options and values.

    We try to pull all of the yum config options into a standard dict object.
    This is currently only used to get the reposdir settings, but could be used
    for other things if needed.

    If the yum python library is available, use that, which will give us all of
    the options, including all of the defaults not specified in the yum config.
    Additionally, they will all be of the correct object type.

    If the yum library is not available, we try to read the yum.conf
    directly ourselves with a minimal set of "defaults".
    u/etc/yum/repos.du/etc/yum.repos.dureposdiruCould not query yum config: {0}u!Error accessing yum or rpmdb: {0}u/etc/yum/yum.confu
/etc/yum.confu/etc/dnf/dnf.confu)No suitable yum config file found in: {0}uUnable to read from {0}: {1}umainucommandsuexcludesu,u<Could not find [main] section in %s, using internal defaultsN(u/etc/yum/yum.confu
/etc/yum.confu/etc/dnf/dnf.conf(ureposdirucommandsuexcludes(tHAS_YUMtyumtYumBaseRtpreconftinit_pluginsRt	iteritemstconftAttributeErrortErrorstConfigErrorRR!tYumBaseErrorR&tostpathtexistsRtConfigParsertreadtIOErrortOSErrorthas_sectiontoptionsRRtstripRTtwarning(RntybtnameRLtexctyum_base_errortfntpathsRttcptoptR((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyt_get_yum_config3sN
8cC@s,t�}||j�kr(|j|�SdS(uB
    Look for a specific config variable and return its value
    N(R�RHRR&(RRn((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyt_get_yum_config_value~s	
cC@s�t|tj�r=g|jd�D]}|j�^q"}n|dkrRg}n|sgtd�}nt|t�s~|r�td��n|S(u�
    Takes a basedir argument as a string or a list. If the string or list is
    empty, then look up the default from the 'reposdir' option in the yum
    config.

    Returns a list of directories.
    u,ureposdiru(Could not determine any repo directoriesN(	RVRR\RR|R&R�RWR	(tbasedirR((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyt_normalize_basedir�s	+	cC@s�y:|jdd�d}|tjjjjdkr9|SWntk
rN|SX|tddfks�tjjjj|dtd�r�|t	|�d S|S(ub
    Strips the architecture from the specified package name, if necessary.
    Circumstances where this would be done include:

    * If the arch is 32 bit and the package name ends in a 32-bit arch.
    * If the arch matches the OS arch, or is ``noarch``.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.normalize_name zsh.x86_64
    u.ii����unoarchuosarchRJ(unoarch(
R%RRRARBtARCHESR@R
tcheck_32tlen(Rtarch((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pytnormalize_name�s
"c@sitjjj|jdt��}t|�dkr7dSt|�}|rVt|�nt	dt��dg}|j
|�|j
ddg�|j
|�t|dt�}|d	dkr|d
rtg|D]}|�k^q��st
jddj|�|d
�qng}n%tt|d
�dd�dt�}�fd�}i}	x�|D]��y?�jdd�d}
|
tjjjjkr�td}
nWntk
r�td}
nXx��fd�|D�D]_}|jdks|j|
kstjjjj|j�r�||�r5|j|	�<Pq5q�q�Wd|	�<q\Wt|�dkre|	|dS|	S(uN
    Return the latest version of the named package available for upgrade or
    installation. If more than one package name is specified, a dict of
    name/version pairs is returned.

    If the latest version of a given package is already installed, an empty
    string will be returned for that package.

    A specific repo can be requested using the ``fromrepo`` keyword argument,
    and the ``disableexcludes`` option is also supported.

    .. versionadded:: 2014.7.0
        Support for the ``disableexcludes`` option

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.latest_version <package name>
        salt '*' pkg.latest_version <package name> fromrepo=epel-testing
        salt '*' pkg.latest_version <package name> disableexcludes=main
        salt '*' pkg.latest_version <package1> <package2> <package3> ...
    urefreshiutversions_as_listu--quietulistu	availabletignore_retcodeuretcodeustderru`Problem encountered getting latest version for the following package(s): %s. Stderr follows: 
%su, ustdoutRKcS@s
t|j�S(N(t
_LooseVersiontversion(RF((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyt<lambda>�streversec
@sd|j�kr\xF�|jD]7}tjjjd|ddd|jdt�rtSqWtStSdS(Ntver1toperu>=tver2tcmp_func(	RRRtversionstcompareR�tversion_cmpRR8(RAtinstalled_version(tcur_pkgs(s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyt
_check_cur�s		u.ii����uosarchc3@s$|]}|j�kr|VqdS(N(R(t.0R(R(s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pys	<genexpr>!sunoarch(RRtdatatis_trueRRR8R�Rgt
refresh_dbROR9R>tallRTterrorRXRZRMR%RARBR�R
R@R�R�R�(tnamesR;trefreshR{R=toutRtupdatesR�RR�RA((R�Rs7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pytlatest_version�sV!
	


%			

	
uavailable_versioncK@st||�dkS(u�
    Check whether or not an upgrade is available for a given package

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.upgrade_available <package name>
    u(R�(RR;((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pytupgrade_available7s
cO@std||�S(uY
    Returns a string representing the package version or an empty string if not
    installed. If more than one package name is specified, a dict of
    name/version pairs is returned.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.version <package name>
        salt '*' pkg.version <package1> <package2> <package3> ...
    upkg_resource.version(R7(R�R;((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyR�Ds
cC@std||d|�S(u�
    .. versionadded:: 2015.5.4

    Do a cmp-style comparison on two packages. Return -1 if pkg1 < pkg2, 0 if
    pkg1 == pkg2, and 1 if pkg1 > pkg2. Return None if there was a problem
    making the comparison.

    ignore_epoch : False
        Set to ``True`` to ignore the epoch when comparing versions

        .. versionadded:: 2015.8.10,2016.3.2

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.version_cmp '0.2-001' '0.2.0.1-002'
    ulowpkg.version_cmptignore_epoch(R7(tpkg1tpkg2R�((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyR�TscK@s3tjjj|�}tgdD]$}tjjj|j|��^q�rPiS|jd�}|d k	r�tjjj|�}nd}|t	kri}dddtjj
jjj
dd	�d
g}td|dtd
d�}x�|j�D]�}tjj
jj|dtd�}	|	d k	r�|	j}
d}d}d|
krb|
jdd�\}}
nd|
kr�|
jdd�\}
}ni|d6|
d6|d6|	jd6|	jd6|	jd6}
td||	j|
�q�q�Wx+|D]#}t||dd��||<q�W|t	|<ntdt	|||�S(!u�
    List the packages currently installed as a dict. By default, the dict
    contains versions as a comma separated string::

        {'<package_name>': '<version>[,<version>...]'}

    versions_as_list:
        If set to true, the versions are provided as a list

        {'<package_name>': ['<version>', '<version>']}

    attr:
        If a list of package attributes is specified, returned value will
        contain them in addition to version, eg.::

        {'<package_name>': [{'version' : 'version', 'arch' : 'arch'}]}

        Valid attributes are: ``epoch``, ``version``, ``release``, ``arch``,
        ``install_date``, ``install_date_time_t``.

        If ``all`` is specified, all valid attributes will be returned.

            .. versionadded:: 2018.3.0

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.list_pkgs
        salt '*' pkg.list_pkgs attr=version,arch
        salt '*' pkg.list_pkgs attr='["version", "arch"]'
    uremovedu
purge_desireduattru
pkg.list_pkgsurpmu-qau
--queryformatu	%{REPOID}u(none)u
ucmd.runtpython_shelltoutput_loglevelutraceRJuosarchuu:iu-uepochuversionureleaseuarchuinstall_dateuinstall_date_time_tupkg_resource.add_pkgRKcS@s|dS(Nuversion((td((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyR��supkg_resource.format_pkg_list(uremovedu
purge_desiredN(RRR�R�tanyRR&RRSR.RARBtQUERYFORMATtreplaceR7Rt
splitlinest
parse_pkginfoR
R�RR�tinstall_datetinstall_date_time_tRRZ(R�R;RtattrR0RR=RRRFtpkgvertepochtreleasetall_attrtpkgname((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyROksT!1	%
	
	



!
c@s.|jdt�}|jdt�}|jdd�p9d}|jdd�pQd}|jdd�pid}td||�}|rt|t�ry,g|jd�D]}|j�^q�}Wqtk
rgtj	|�jd�D]}|j�^q�}qXn|r�t|t�r�y8g|jd�D]}|d	kr1|j�^q1}Wq�tk
r�gtj	|�jd�D]}|d	kr|j�^q}q�Xn|rLt|t�rLy8g|jd�D]}|d	kr�|j�^q�}WqLtk
rHgtj	|�jd�D]}|d	kr!|j�^q!}qLXn|r[|�ndgtj
t��D]K\}	}
|	|ks�|	|krntj	|
jd
d��dkrn|	^qn�i�d��t����fd
�}t
�dkr�d"n/ttdddgdt�j�dj��}|r�|td�kr�dg}
|rg|
jd�n|
jd�x{d#D]F}t|
|gdt�}|ddkr{||ddt�q{q{Wn*|rc|td�krcddg}
|r|
jd�n|
jd�x�d$D]F}t|
|gdt�}|ddkr||ddt�qqWn�x��D]�}ddd|dg}|r�|jd�n|j��t|dt�}|ddkr�d |dkr�qjn||d�qjW|ryxz�D]r}xi�|D]]}tg�||D]}t|�^q(d!t�}g|D]}|j^qP�||<qWq�W�Si}xD�D]<}x3�|D]'}|j|g�j�||�q�Wq�Wx]|D]U}tg||D]}t|�^q�d!t�}g|D]}|j^q	||<q�W|Sd"S(%u�
    .. versionadded:: 2014.1.0
    .. versionchanged:: 2014.7.0
        All available versions of each package are now returned. This required
        a slight modification to the structure of the return dict. The return
        data shown below reflects the updated return dict structure. Note that
        packages which are version-locked using :py:mod:`pkg.hold
        <salt.modules.yumpkg.hold>` will only show the currently-installed
        version, as locking a package will make other versions appear
        unavailable to yum/dnf.
    .. versionchanged:: 2017.7.0
        By default, the versions for each package are no longer organized by
        repository. To get results organized by repository, use
        ``byrepo=True``.

    Returns all available packages. Optionally, package names (and name globs)
    can be passed and the results will be filtered to packages matching those
    names. This is recommended as it speeds up the function considerably.

    .. warning::
        Running this function on RHEL/CentOS 6 and earlier will be more
        resource-intensive, as the version of yum that ships with older
        RHEL/CentOS has no yum subcommand for listing packages from a
        repository. Thus, a ``yum list installed`` and ``yum list available``
        are run, which generates a lot of output, which must then be analyzed
        to determine which package information to include in the return data.

    This function can be helpful in discovering the version or repo to specify
    in a :mod:`pkg.installed <salt.states.pkg.installed>` state.

    The return data will be a dictionary mapping package names to a list of
    version numbers, ordered from newest to oldest. If ``byrepo`` is set to
    ``True``, then the return dictionary will contain repository names at the
    top level, and each repository will map packages to lists of version
    numbers. For example:

    .. code-block:: python

        # With byrepo=False (default)
        {
            'bash': ['4.1.2-15.el6_5.2',
                     '4.1.2-15.el6_5.1',
                     '4.1.2-15.el6_4'],
            'kernel': ['2.6.32-431.29.2.el6',
                       '2.6.32-431.23.3.el6',
                       '2.6.32-431.20.5.el6',
                       '2.6.32-431.20.3.el6',
                       '2.6.32-431.17.1.el6',
                       '2.6.32-431.11.2.el6',
                       '2.6.32-431.5.1.el6',
                       '2.6.32-431.3.1.el6',
                       '2.6.32-431.1.2.0.1.el6',
                       '2.6.32-431.el6']
        }
        # With byrepo=True
        {
            'base': {
                'bash': ['4.1.2-15.el6_4'],
                'kernel': ['2.6.32-431.el6']
            },
            'updates': {
                'bash': ['4.1.2-15.el6_5.2', '4.1.2-15.el6_5.1'],
                'kernel': ['2.6.32-431.29.2.el6',
                           '2.6.32-431.23.3.el6',
                           '2.6.32-431.20.5.el6',
                           '2.6.32-431.20.3.el6',
                           '2.6.32-431.17.1.el6',
                           '2.6.32-431.11.2.el6',
                           '2.6.32-431.5.1.el6',
                           '2.6.32-431.3.1.el6',
                           '2.6.32-431.1.2.0.1.el6']
            }
        }

    fromrepo : None
        Only include results from the specified repo(s). Multiple repos can be
        specified, comma-separated.

    enablerepo (ignored if ``fromrepo`` is specified)
        Specify a disabled package repository (or repositories) to enable.
        (e.g., ``yum --enablerepo='somerepo'``)

        .. versionadded:: 2017.7.0

    disablerepo (ignored if ``fromrepo`` is specified)
        Specify an enabled package repository (or repositories) to disable.
        (e.g., ``yum --disablerepo='somerepo'``)

        .. versionadded:: 2017.7.0

    byrepo : False
        When ``True``, the return data for each package will be organized by
        repository.

        .. versionadded:: 2017.7.0

    cacheonly : False
        When ``True``, the repo information will be retrieved from the cached
        repo metadata. This is equivalent to passing the ``-C`` option to
        yum/dnf.

        .. versionadded:: 2017.7.0

    setopt
        A comma-separated or Python list of key=value options. This list will
        be expanded and ``--setopt`` prepended to each in the yum/dnf command
        that is run.

        .. versionadded:: 2019.2.0

    CLI Examples:

    .. code-block:: bash

        salt '*' pkg.list_repo_pkgs
        salt '*' pkg.list_repo_pkgs foo bar baz
        salt '*' pkg.list_repo_pkgs 'samba4*' fromrepo=base,updates
        salt '*' pkg.list_repo_pkgs 'python2-*' byrepo=True
    ubyrepou	cacheonlyufromrepouudisablerepou
enablerepoR]u,u*uenabledu1cS@s+x$|D]}tj||�rtSqWtS(up
        Do glob matching on args and return True if a match was found.
        Otherwise, return False
        (tfnmatchR8R(RRtarg((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyt_check_argsds
c@s�xt|�D]q}|rA|j�ks
��|j�rAq
n�j|ji�}|j|jt��}|j|j�q
WdS(N(RMtrepoidRt
setdefaulttsettaddR�(RtstrictRAt	repo_dicttversion_list(R�RtreposR(s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyt
_parse_outputnsuyumucmd.runu	--versionR�iu3.2.13u--quietu-Culistu	installedu	availableR�uretcodeustdoutR�u3.4.3u--showduplicatesurepository-packagesuError:R�N(u	installedu	available(u	installedu	available(RRRRgRVRWRR|RoRRYRmt
list_reposRR R&R�R7R�R:R>R8R9RZtvstringR�(RR;tbyrepot	cacheonlyR]R_R`trepo_argRt	repo_namet	repo_infoR�tyum_versiont
cmd_prefixtpkg_srcR�R^R=treponameR�tsorted_versionst
byrepo_ret((R�RR�Rs7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pytlist_repo_pkgs�s�x,
8"
%"
%	-	
		





 
'	,
)
#	$cK@s�t|�}tjjj|�r4tdt|�ndg}|j|�|jdt�dkrhdndg�t	|dt
�}|dd	kr�d
|kr�iStgt|d�D]}|j
|jf^q��S(u�
    Check whether or not an upgrade is available for all packages

    The ``fromrepo``, ``enablerepo``, and ``disablerepo`` arguments are
    supported, as used in pkg states, and the ``disableexcludes`` option is
    also supported.

    .. versionadded:: 2014.7.0
        Support for the ``disableexcludes`` option

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.list_upgrades
    tcheck_updateu--quietulistudnfuupgradesuupdatesR�uretcodeiuError:ustdout(RgRRR�R�R�RR9R R>R8tdictRMRR�(R�R;R{R=R�R((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyt
list_upgrades�s	
(ulist_updatesc	C@s�tjjdt��}i}x�tjjj|�D]�\}}}x�tj|d�D]�}tjj||�}t	d|�}t
tjj|��}i|d6tjj|�d6|d6t
j
j|�j�d6|j|di�|d	<qVWq4W|S(
u�
    .. versionadded:: 2017.7.0

    List prefetched packages downloaded by Yum in the local disk.

    CLI example:

    .. code-block:: bash

        salt '*' pkg.list_downloaded
    u/var/cache/u*.rpmulowpkg.bin_pkg_infoupathusizeucreation_date_time_tucreation_date_timeunameuversion(RsRtRXR RRtos_walkR�tfilterR7R/tgetctimetgetsizetdatetimet
fromtimestampt	isoformatR�(	t	CACHE_DIRRtroottdirnamest	filenamestfilenametpackage_pathtpkg_infot
pkg_timestamp((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pytlist_downloaded�s%<cO@s�|jdt�}t�}x�td||�j�D]�\}}|rM|n|g}x�|D]{}t�}x=|j�D]/\}	}
|	dkr�|
|d<qy|
||	<qyW|s�|||<q]|j|g�j|�q]Wq5W|S(u�
    .. versionadded:: 2015.8.1

    Return the information of the named package(s), installed on the system.

    :param all_versions:
        Include information for all versions of the packages installed on the minion.

    CLI example:

    .. code-block:: bash

        salt '*' pkg.info_installed <package1>
        salt '*' pkg.info_installed <package1> <package2> <package3> ...
        salt '*' pkg.info_installed <package1> <package2> <package3> all_versions=True
    uall_versionsulowpkg.infou
source_rpmusource(RRR�R7titemsR�R:(R�R;tall_versionsRtpkg_nametpkgs_nfotpkg_nfot_nfott_nfoRKRL((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pytinfo_installed�s	&
	

!cK@stjjjt�itd6dd6td6}t}|jdt�}t	|�}ddddg}|j
|�t|d	t�|rddd
g}tj
d�dkr�tj
d
�dkr�|jd�n|j
|�|j
t|d	t�dt�}n|S(u�
    Check the yum repos for updated packages

    Returns:

    - ``True``: Updates are available
    - ``False``: An error occurred
    - ``None``: No updates are available

    repo
        Refresh just the specified repo

    disablerepo
        Do not refresh the specified repo

    enablerepo
        Refresh a disabled repo using this option

    branch
        Add the specified branch when refreshing

    disableexcludes
        Disable the excludes defined in your config files. Takes one of three
        options:
        - ``all`` - disable all excludes
        - ``main`` - disable excludes defined in [main] in yum.conf
        - ``repoid`` - disable excludes defined for that repo

    setopt
        A comma-separated or Python list of key=value options. This list will
        be expanded and ``--setopt`` prepended to each in the yum/dnf command
        that is run.

        .. versionadded:: 2019.2.0

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.refresh_db
    idiiucheck_updateu--quietu--assumeyesucleanuexpire-cacheR�ucheck-updateu	os_familyuRedHatuosmajorreleaseiu'--setopt=autocheck_running_kernel=falseuretcodeN(RRRAt
clear_rtagR
R8R&RRRRgR9R>R
RR:(R;tretcodesRt
check_update_R{t	clean_cmdt
update_cmd((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyR�s&+


%cK@s
t|�S(u�
    .. versionadded:: 2014.1.0

    Cleans local yum metadata. Functionally identical to :mod:`refresh_db()
    <salt.modules.yumpkg.refresh_db>`.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.clean_metadata
    (R�(R;((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pytclean_metadatads
tAvailablePackagescB@s#eZd�Zd�Zd�ZRS(cO@s)tt|�j�||_||_dS(N(tsuperR�t__init__t_argst_kwargs(tselfRR;((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyR�us	cC@s|j�tS(N(t	_load_allR8(R�RK((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyt_loadzs
cC@s%t|j|j�|_t|_dS(N(R�R�R�t_dictR8tloaded(R�((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyR�~s(t__name__t
__module__R�RR�(((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyR�ts		ubasec4@s�
t|��tjjj|�r.t|�ntjjj|�}y/td|||d|	d||�\}}
Wntk
r�}t|��nX|d6ks�t
|�dkr�iS|jd�}|jd�}�s�tdt
d|�nt�}�s
tdt�nt�}g}g}g}i}|
d	kr�g}g}x�tj|�D]w\}}yNd
|kr�|j|�n.|jd�s�|jd�r�|j|�nWqVttfk
r�qVqVXqVWtd
t
|||�}tj|�}n�|
dkr\g}t�}x�|D]7}||krHtdj|���q|j|�qWn�g}x�|D]x}dtkr�td|�}nd6}|d6kr�tjd|�|j|g�qi|j|d||dg�qiWg�x[|D]S} |
d	kr| \}}nX|
dkr.| }d6}n=y| \}}!}Wn'tk
rjd6}| d}!d6}nX|d6kr�|
d	kr�|r�||kr�|j||f�q�|j||f�qE|
dkr�|j||f�qE|j||!f�q�|
d	kr|jd�}||kr�|j|g�}"tjjj||"dtd|
�}#|#d6kr��jdj|||"r�dj|"�nd6��q�q�|#}nt �dkr�|
tkr�|j!dd�d}q�nd}$y|j"dd�\}%}&Wntk
rn,X|&tjjj#j$kr:d|&}$|%}nd
|kr�|j|g�}"tjj%j&|"|�}'|'d6k	r�|'}q��jdj|||"r�dj|"�nd��q�n|
tkr�d j|||$�}(qd j||j!dd�d|$�}(n|!}(|j|g�})|r�|)r�x|)D]M}*tjj'j(d!|d"d#d$|*dtd|
�r3|j||(f�Pq3q3Wq�|)s�|j||(f�q�x�|)D]M}*tjj'j(d!|d"d%d$|*dtd|
�r�|j||(f�Pq�q�W|d6k	r�t)j*d&|�r/|j||(f�qE|j||(f�q�q�W���fd'�}+yt+d(t
��Wn$t,k
r�g�tj-d)�nXg�t.j/����fd*��},g}-|,||-���|-r�|
dkrg|-D]}.d+j|.�^q�}-nd,g}/t �d-kr:|/j0d.d/g�n|+|/�|/j|
dkr\d0nd1�|/j0|-�t1|/d2t
d3t�}0|0d4dkr��j|0d5�q�nWd6QXg}-|,||-��k|-r1	d,g}/|+|/�|/jd7�|/j0|-�t1|/�}0|0d4dkr1	�j|0d5�q1	nWd6QXg}-|,||-��k|-r�	d,g}/|+|/�|/jd8�|/j0|-�t1|/�}0|0d4dkr�	�j|0d5�q�	nWd6QXt2j3d9d6��s�	tdt
d|�nt�}1tjjj4||1�}2xi|D]a\}}3||2ks0
||kr
|2j5ii|j|d�d:6|1j|d�d;6|6�q
q
W�r�
�jd<jdj����n�r�
td=j|r�
d>nd�d?i�d@6|2dA6��n|2S(Bu�
    .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
        On minions running systemd>=205, `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 any yum/dnf commands spawned by Salt when the
        ``salt-minion`` service is restarted. (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.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

    Install the passed package(s), add refresh=True to clean the yum database
    before package is installed.

    name
        The name of the package to be installed. Note that this parameter is
        ignored if either "pkgs" or "sources" is passed. Additionally, please
        note that this option can only be used to install packages from a
        software repository. To install a package file manually, use the
        "sources" option.

        32-bit packages can be installed on 64-bit systems by appending the
        architecture designation (``.i686``, ``.i586``, etc.) to the end of the
        package name.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.install <package name>

    refresh
        Whether or not to update the yum database before executing.

    reinstall
        Specifying reinstall=True will use ``yum reinstall`` rather than
        ``yum install`` for requested packages that are already installed.

        If a version is specified with the requested package, then
        ``yum reinstall`` will only be used if the installed version
        matches the requested version.

        Works with ``sources`` when the package header of the source can be
        matched to the name and version of an installed package.

        .. versionadded:: 2014.7.0

    skip_verify
        Skip the GPG verification check (e.g., ``--nogpgcheck``)

    downloadonly
        Only download the packages, do not install.

    version
        Install a specific version of the package, e.g. 1.2.3-4.el5. Ignored
        if "pkgs" or "sources" is passed.

        .. versionchanged:: 2018.3.0
            version can now contain comparison operators (e.g. ``>1.2.3``,
            ``<=2.0``, etc.)

    update_holds : False
        If ``True``, and this function would update the package version, any
        packages held using the yum/dnf "versionlock" plugin will be unheld so
        that they can be updated. Otherwise, if this function attempts to
        update a held package, the held package(s) will be skipped and an
        error will be raised.

        .. versionadded:: 2016.11.0

    setopt
        A comma-separated or Python list of key=value options. This list will
        be expanded and ``--setopt`` prepended to each in the yum/dnf command
        that is run.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.install foo setopt='obsoletes=0,plugins=0'

        .. versionadded:: 2019.2.0

    Repository Options:

    fromrepo
        Specify a package repository (or repositories) from which to install.
        (e.g., ``yum --disablerepo='*' --enablerepo='somerepo'``)

    enablerepo (ignored if ``fromrepo`` is specified)
        Specify a disabled package repository (or repositories) to enable.
        (e.g., ``yum --enablerepo='somerepo'``)

    disablerepo (ignored if ``fromrepo`` is specified)
        Specify an enabled package repository (or repositories) to disable.
        (e.g., ``yum --disablerepo='somerepo'``)

    disableexcludes
        Disable exclude from main, for a repo or for everything.
        (e.g., ``yum --disableexcludes='main'``)

        .. versionadded:: 2014.7.0

    ignore_epoch : False
        Only used when the version of a package is specified using a comparison
        operator (e.g. ``>4.1``). If set to ``True``, then the epoch will be
        ignored when comparing the currently-installed version to the desired
        version.

        .. versionadded:: 2018.3.0


    Multiple Package Installation Options:

    pkgs
        A list of packages to install from a software repository. Must be
        passed as a python list. A specific version number can be specified
        by using a single-element dict representing the package and its
        version.

        CLI Examples:

        .. code-block:: bash

            salt '*' pkg.install pkgs='["foo", "bar"]'
            salt '*' pkg.install pkgs='["foo", {"bar": "1.2.3-4.el5"}]'

    sources
        A list of RPM packages to install. Must be passed as a list of dicts,
        with the keys being package names, and the values being the source URI
        or local path to the package.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.install sources='[{"foo": "salt://foo.rpm"}, {"bar": "salt://bar.rpm"}]'

    normalize : True
        Normalize the package name by removing the architecture. This is useful
        for poorly created packages which might include the architecture as an
        actual part of the name such as kernel modules which match a specific
        kernel version.

        .. code-block:: bash

            salt -G role:nsd pkg.install gpfs.gplbin-2.6.32-279.31.1.el6.x86_64 normalize=False

        .. versionadded:: 2014.7.0

    diff_attr:
        If a list of package attributes is specified, returned value will
        contain them, eg.::

            {'<package>': {
                'old': {
                    'version': '<old-version>',
                    'arch': '<old-arch>'},

                'new': {
                    'version': '<new-version>',
                    'arch': '<new-arch>'}}}

        Valid attributes are: ``epoch``, ``version``, ``release``, ``arch``,
        ``install_date``, ``install_date_time_t``.

        If ``all`` is specified, all valid attributes will be returned.

        .. versionadded:: 2018.3.0

    Returns a dict containing the new package names and versions::

        {'<package>': {'old': '<old-version>',
                       'new': '<new-version>'}}

    If an attribute list in diff_attr is specified, the dict will also contain
    any specified attribute, eg.::

        {'<package>': {
            'old': {
                'version': '<old-version>',
                'arch': '<old-arch>'},

            'new': {
                'version': '<new-version>',
                'arch': '<new-arch>'}}}
    upkg_resource.parse_targetstsaltenvt	normalizeiuversionu	diff_attrR�R�u
repositoryu*u<u>R�uadvisoryuAdvisory id "{0}" not foundulowpkg.bin_pkg_infou�pkg.install: Unable to get rpm information for %s. Version comparisons will be unavailable, and return data may be inaccurate if reinstall=True.unameu=R�R�u<No version matching '{0}{1}' could be found (available: {2})u, uyumu:ii����uu.uBNo version matching '{0}' found for package '{1}' (available: {2})unoneu
{0}-{1}{2}R�R�u==R�u>=u^kernel(|-devel)$c@s=|j���r#|jd�n�r9|jd�ndS(uI
        DRY function to add args common to all yum/dnf commands
        u--nogpgchecku--downloadonlyN(R9R:(R=(tdownloadonlyR{tskip_verify(s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyt_add_common_args7s

R(uAFailed to get holds, versionlock plugin is probably not installedc	3@s@i}xP|D]H\}}|�krH�r8|||<qU�j|�q
|j|�q
W|sgdVn�tjddj|��z�yot|j��}xQtjtd|��D]7\}}|dr�|j||�q��j|�q�WdVWn5t	k
r)}�jdj
dj|�|��nXWdtd|�XdS(u�
        Temporarily unhold packages that need to be updated. Add any
        successfully-removed ones (and any packages not in the list of current
        holds) to the list of targets.
        NuUnholding packages: %su, tpkgsuresultu-Error encountered unholding packages {0}: {1}(R:RTtdebugRXRWRHRRmtunholdRR!thold(	R
Ret	to_unholdR�tpkgstrtunhold_namest
unheld_pkgtoutcomeR�(terrorstholdstunhold_preventedtupdate_holds(s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyt_temporarily_unholdKs0
"
	u--advisory={0}u-yudnfu--bestu--allowerasinguinstalluupdateR�tredirect_stderruretcodeustdoutNu	downgradeu	reinstallu
pkg.list_pkgsuoldunewu�The following package(s) could not be updated because they are being held: {0}. Set 'update_holds' to True to temporarily unhold these packages so that they can be updated.u'Error occurred installing{0} package(s)u
/reinstallingRUuerrorsuchanges(6RgRRR�R�R�R7RRR&R�RRORR�R8RRmR:R[t	TypeErrorR@R�tlist_patchesR!RTR�RERAt
match_versionR�RXR RR%RBR�Rtfnmatch_multipleR�R�R"R*t
list_holdsR	Rt
contextlibtcontextmanagerR9R>R.RRt
compare_dictsR4(4RR�RR
tsourcesRt	reinstallRRRR�R;t
pkg_paramstpkg_typeR�tversion_numt	diff_attrtoldtold_as_listt
to_installtto_downgradetto_reinstallt
_availablet
has_wildcardsthas_comparisonR�R�tpkg_params_itemstcur_patchestadvisory_idt
pkg_sourcetrpm_infot
pkg_item_listtpkgpatht
candidatesttargetR�tnameparttarchpartR*RtcvertverR	RRettR=R�tnewRt_((RRRR{RRRs7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pytinstall�s��
($
		


	


		

		(
	
	


!*%	

	


	


$"cK@s�tdt|�}tjjj|�r4t|�nt�}	g}
|sO|r�y0tdd|d|ddd||�d}Wnt
k
r�}t|��nX|r�|
j|�q�ndd	g}
|
j|�|r�|
j
d
�n|r|
j
|sdnd�nQt�d
krC|
j
d�|
j
|s9dnd�n|
j
|sUdnd�|
j|
�t|
�}tjdd�t�}tjjj|	|�}|ddkr�tddi|d6|d6��n|S(u
    Run a full system upgrade (a ``yum upgrade`` or ``dnf upgrade``), or
    upgrade specified packages. If the packages aren't installed, they will
    not be installed.

    .. versionchanged:: 2014.7.0
    .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
        On minions running systemd>=205, `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 any yum/dnf commands spawned by Salt when the
        ``salt-minion`` service is restarted. (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.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

    .. versionchanged:: 2019.2.0
        Added ``obsoletes`` and ``minimal`` arguments

    Returns a dictionary containing the changes:

    .. code-block:: python

        {'<package>':  {'old': '<old-version>',
                        'new': '<new-version>'}}


    CLI Example:

    .. code-block:: bash

        salt '*' pkg.upgrade
        salt '*' pkg.upgrade name=openssl

    Repository Options:

    fromrepo
        Specify a package repository (or repositories) from which to install.
        (e.g., ``yum --disablerepo='*' --enablerepo='somerepo'``)

    enablerepo (ignored if ``fromrepo`` is specified)
        Specify a disabled package repository (or repositories) to enable.
        (e.g., ``yum --enablerepo='somerepo'``)

    disablerepo (ignored if ``fromrepo`` is specified)
        Specify an enabled package repository (or repositories) to disable.
        (e.g., ``yum --disablerepo='somerepo'``)

    disableexcludes
        Disable exclude from main, for a repo or for everything.
        (e.g., ``yum --disableexcludes='main'``)

        .. versionadded:: 2014.7

    name
        The name of the package to be upgraded. Note that this parameter is
        ignored if "pkgs" is passed.

        32-bit packages can be upgraded on 64-bit systems by appending the
        architecture designation (``.i686``, ``.i586``, etc.) to the end of the
        package name.

        Warning: if you forget 'name=' and run pkg.upgrade openssl, ALL packages
        are upgraded. This will be addressed in next releases.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.upgrade name=openssl

        .. versionadded:: 2016.3.0

    pkgs
        A list of packages to upgrade from a software repository. Must be
        passed as a python list. A specific version number can be specified
        by using a single-element dict representing the package and its
        version. If the package was not already installed on the system,
        it will not be installed.

        CLI Examples:

        .. code-block:: bash

            salt '*' pkg.upgrade pkgs='["foo", "bar"]'
            salt '*' pkg.upgrade pkgs='["foo", {"bar": "1.2.3-4.el5"}]'

        .. versionadded:: 2016.3.0

    normalize : True
        Normalize the package name by removing the architecture. This is useful
        for poorly created packages which might include the architecture as an
        actual part of the name such as kernel modules which match a specific
        kernel version.

        .. code-block:: bash

            salt -G role:nsd pkg.upgrade gpfs.gplbin-2.6.32-279.31.1.el6.x86_64 normalize=False

        .. versionadded:: 2016.3.0

    minimal : False
        Use upgrade-minimal instead of upgrade (e.g., ``yum upgrade-minimal``)
        Goes to the 'newest' package match which fixes a problem that affects your system.

        .. code-block:: bash

            salt '*' pkg.upgrade minimal=True

        .. versionadded:: 2019.2.0

    obsoletes : True
        Controls wether yum/dnf should take obsoletes into account and remove them.
        If set to ``False`` yum will use ``update`` instead of ``upgrade``
        and dnf will be run with ``--obsoletes=False``

        .. code-block:: bash

            salt '*' pkg.upgrade obsoletes=False

        .. versionadded:: 2019.2.0

    setopt
        A comma-separated or Python list of key=value options. This list will
        be expanded and ``--setopt`` prepended to each in the yum/dnf command
        that is run.

        .. versionadded:: 2019.2.0

    .. note::
        To add extra arguments to the ``yum upgrade`` command, pass them as key
        word arguments. For arguments without assignments, pass ``True``

    .. code-block:: bash

        salt '*' pkg.upgrade security=True exclude='kernel*'
    Rdupkg_resource.parse_targetsRR
R!Riu--quietu-yu--nogpgcheckuupgradeuupgrade-minimaludnfu--obsoletes=Falseuupdateuupdate-minimalu
pkg.list_pkgsuretcodeu&Problem encountered upgrading packagesRUuchangesuresultN(RgR8RRR�R�R�ROR7R&RRR9R:R R>R.RRR (RR
R�RRtminimalt	obsoletesR;R{R'ReR#R�R=tresultR=R((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pytupgrade�sJ�
	



	c	K@st||||||||�S(uA
    .. versionadded:: 2019.2.0

    Calls :py:func:`pkg.upgrade <salt.modules.yumpkg.upgrade>` with
    ``obsoletes=False``. Mirrors the CLI behavior of ``yum update``.
    See :py:func:`pkg.upgrade <salt.modules.yumpkg.upgrade>` for
    further documentation.

    .. code-block:: bash

        salt '*' pkg.update
    (RC(RR
R�RRR@RAR;((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyR4�scK@s�ytd||�d}Wntk
r<}t|��nXt�}g}x�|D]�}||kr�||r�|j|�qS||krS||||jd�krSd}|}	y|jdd�\}
}Wntk
r�n,X|tj	j
jjkrd|}|
}	n|jdj
|	|||��qSqSW|sAiStdd	g|�}|d
dkr�|dr�|dg}
ng}
tjdd�t�}tj	jj||�}|
r�td
di|
d6|d6��n|S(uy
    .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
        On minions running systemd>=205, `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 any yum/dnf commands spawned by Salt when the
        ``salt-minion`` service is restarted. (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.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

    Remove packages

    name
        The name of the package to be removed


    Multiple Package Options:

    pkgs
        A list of packages to delete. Must be passed as a python list. The
        ``name`` parameter will be ignored if this option is passed.

    .. versionadded:: 0.16.0


    Returns a dict containing the changes.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.remove <package name>
        salt '*' pkg.remove <package1>,<package2>,<package3>
        salt '*' pkg.remove pkgs='["foo", "bar"]'
    upkg_resource.parse_targetsiu,uu.iu
{0}-{1}{2}u-yuremoveuretcodeustderru
pkg.list_pkgsu"Error occurred removing package(s)RUuerrorsuchangesN(R7RRROR:RR%R@RRRARBR�R!R>R.RRR&R�R (RR
R;R#R�R'ReR7R�R�R8R9R�RR=R((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pytremove�sD)	
)

	'	cK@std|d|�S(u�
    .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
        On minions running systemd>=205, `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 any yum/dnf commands spawned by Salt when the
        ``salt-minion`` service is restarted. (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.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

    Package purges are not supported by yum, this function is identical to
    :mod:`pkg.remove <salt.modules.yumpkg.remove>`.

    name
        The name of the package to be purged


    Multiple Package Options:

    pkgs
        A list of packages to delete. Must be passed as a python list. The
        ``name`` parameter will be ignored if this option is passed.

    .. versionadded:: 0.16.0


    Returns a dict containing the changes.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.purge <package name>
        salt '*' pkg.purge <package1>,<package2>,<package3>
        salt '*' pkg.purge pkgs='["foo", "bar"]'
    RR
(RD(RR
R;((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pytpurge�s*cK@s%t�|r+|r+|r+td��n|rF|rFtd��ng}|rb|j|�nC|r�x:|D]"}|jttj|���qoWn
|j|�tdt�}i}xd|D]\}	t	|	t
�r�ttj|	��}	ni|	d6id6td6dd6||	<|	|kr�d	tkrdtd	rd||	jd
d�dj|	�||	d<qtd|	g�}
|
d
dkr�||	jd
t�dj|	�||	d<d||	dd<d||	dd<qdj|	�||	d<q�||	jd
t�dj|	�||	d<q�W|S(u�
    .. versionadded:: 2014.7.0

    Version-lock packages

    .. note::
        Requires the appropriate ``versionlock`` plugin package to be installed:

        - On RHEL 5: ``yum-versionlock``
        - On RHEL 6 & 7: ``yum-plugin-versionlock``
        - On Fedora: ``python-dnf-plugins-extras-versionlock``


    name
        The name of the package to be held.

    Multiple Package Options:

    pkgs
        A list of packages to hold. Must be passed as a python list. The
        ``name`` parameter will be ignored if this option is passed.

    Returns a dict containing the changes.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.hold <package name>
        salt '*' pkg.hold pkgs='["foo", "bar"]'
    u0One of name, pkgs, or sources must be specified.u-Only one of pkgs or sources can be specified.R(unameuchangesuresultuucommentutestRBuPackage {0} is set to be held.uversionlockuretcodeiuPackage {0} is now being held.uholdunewuoldu"Package {0} was unable to be held.u&Package {0} is already set to be held.N(RQR	R9R:tnextRtiterkeysRRRVR�R
R4R&R!R>R8(RR
R!RR;Retsourcet
current_locksRR7R�((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyR
sR 
#


c
K@s�t�|r+|r+|r+td��n|rF|rFtd��ng}|r�xmtjjj|�D]}|j|�qhWn@|r�x7|D]}|jtt|���q�Wn
|j|�t	dt
�dk�}i}x�|D]�}	t|	t�rtt
j|	��}	ni|	d6id6td6dd	6||	<t
�d
krqg|D]}
|
|	krP|
^qP}nLg|D]?}
tj|
dj|	��rx|	t|
dt�krx|
^qx}|r�tdr�||	jd
d�dj|	�||	d	<q�tddg|�}|ddkrs||	jd
t�dj|	�||	d	<d||	dd<d||	dd<q�dj|	�||	d	<q�||	jd
t�dj|	�||	d	<q�W|S(u�
    .. versionadded:: 2014.7.0

    Remove version locks

    .. note::
        Requires the appropriate ``versionlock`` plugin package to be installed:

        - On RHEL 5: ``yum-versionlock``
        - On RHEL 6 & 7: ``yum-plugin-versionlock``
        - On Fedora: ``python-dnf-plugins-extras-versionlock``


    name
        The name of the package to be unheld

    Multiple Package Options:

    pkgs
        A list of packages to unhold. Must be passed as a python list. The
        ``name`` parameter will be ignored if this option is passed.

    Returns a dict containing the changes.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.unhold <package name>
        salt '*' pkg.unhold pkgs='["foo", "bar"]'
    u0One of name, pkgs, or sources must be specified.u-Only one of pkgs or sources can be specified.R(uyumunameuchangesuresultuucommentudnfu*{0}*utestRBu Package {0} is set to be unheld.uversionlockudeleteuretcodeiuPackage {0} is no longer held.unewuholduoldu$Package {0} was unable to be unheld.uPackage {0} is not being held.N(RQR	RRR�trepack_dictlistR:RFtiterRR RVR�RRGRR�R!R-R
R4R&R>R8(
RR
R!R;ReRARHRIRR7Rtsearch_locksR�((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyRts^ 
 


(
$
cC@s�t�tdt�ddgdt�}g}xTtjjj|d�D]:}t|d|d|�}|dk	rH|j
|�qHqHW|S(	u#
    .. versionchanged:: 2016.3.0,2015.8.4,2015.5.10
        Function renamed from ``pkg.get_locked_pkgs`` to ``pkg.list_holds``.

    List information on locked packages

    .. note::
        Requires the appropriate ``versionlock`` plugin package to be installed:

        - On RHEL 5: ``yum-versionlock``
        - On RHEL 6 & 7: ``yum-plugin-versionlock``
        - On Fedora: ``python-dnf-plugins-extras-versionlock``

    pattern : \w+(?:[.-][^-]+)*
        Regular expression used to match the package name

    full : True
        Show the full hold definition including version and epoch. Set to
        ``False`` to return just the name of the package(s) being held.


    CLI Example:

    .. code-block:: bash

        salt '*' pkg.list_holds
        salt '*' pkg.list_holds full=False
    ucmd.runuversionlockulistR�u
R'R(N(RQR7R RRRRRR-R&R:(R'R(R�RRR*((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyR�s	uget_locked_packagescO@std||�S(u�
    .. versionadded:: 2014.1.0

    Runs an rpm -Va on a system, and returns the results in a dict

    Pass options to modify rpm verify behavior using the ``verify_options``
    keyword argument

    Files with an attribute of config, doc, ghost, license or readme in the
    package header can be ignored using the ``ignore_types`` keyword argument

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.verify
        salt '*' pkg.verify httpd
        salt '*' pkg.verify 'httpd postfix'
        salt '*' pkg.verify 'httpd postfix' ignore_types=['config','doc']
        salt '*' pkg.verify 'httpd postfix' verify_options=['nodeps','nosize']
    u
lowpkg.verify(R7(R�R;((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pytverify		sc
C@s}igd6gd6gd6gd6id6}idd6dd6dd6dd	6dd
6}tdt�dd
gdddt�}d}x�tjjj|d�D]�}|j�}|dkr�Pn|j	|�}|dk	r�||kr�|}q�n|dkrq�n|j
�}|dkr,||j|�q�tj
d|�}|r�|j�\}}	i|d6|	d6|||<q�q�W|S(u�
    .. versionadded:: 2014.1.0

    Lists all groups known by yum on this system

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.group_list
    u	installedu	availableuinstalled environmentsuavailable environmentsuavailable languagesuinstalled groups:uavailable groups:uinstalled environment groups:uavailable environment groups:uavailable language groups:ucmd.run_stdoutu	grouplistuhiddenR�utraceR�u
udoneu
(.+) \[(.+)\]unameulanguageN(R7R RR&RRRRRRR|R:R"R*tgroups(
Rtsection_mapR�RKRtline_lctsection_lookupR*Rtlang((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyt
group_list"	sD


	#cC@s�d}i}x|D]}t�||<qWt�dd|g}td|dd	d
t�}i}xytjjj|d�D]_}yBg|jd�D]}	|	j�^q�\}
}|||
j	�<Wqzt
k
r�qzqzXqzWd
|kr�d
|d<nd|krd|d<n|jd
�p*|jd�|d<|jd�pL|jd�|d<|dr�|dr�tdj
|���n|jdd�|d<ddj|�d}x|D]}t}
x�tjjj|d�D]�}|j�jtj�}tj|d|j	��}|rH|
r$PqH|jd�|kr�t}
q�q�n|
r�|r�|dd
kr�t|dt�}x=|D]!}||jt||��q}Wq�||j|�q�q�Wq�Wx"|D]}t||�||<q�W|S(u
    .. versionadded:: 2014.1.0
    .. versionchanged:: 2016.3.0,2015.8.4,2015.5.10
        The return data has changed. A new key ``type`` has been added to
        distinguish environment groups from package groups. Also, keys for the
        group name and group ID have been added. The ``mandatory packages``,
        ``optional packages``, and ``default packages`` keys have been renamed
        to ``mandatory``, ``optional``, and ``default`` for accuracy, as
        environment groups include other groups, and not packages. Finally,
        this function now properly identifies conditional packages.

    Lists packages belonging to a certain group

    name
        Name of the group to query

    expand : False
        If the specified group is an environment group, then the group will be
        expanded and the return data will include package names instead of
        group names.

        .. versionadded:: 2016.3.0

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.group_info 'Perl Support'
    u	mandatoryuoptionaludefaultuconditionalu--quietu	groupinfoucmd.run_stdoutR�utraceR�u
u:uenvironment grouputypeugroupu
package groupuenvironment-idugroup-iduiduGroup '{0}' not foundudescriptionuu(u|u)u (?:groups|packages):\s*$itexpand(u	mandatoryuoptionaludefaultuconditional(R�R R7RRRRRR|RR@RRR!RXREtstringtpunctuationR"R*R$R8t
group_infoR4R�RZ(RRTtpkgtypesRtpkgtypeR=R�tg_infoRRRKRLtpkgtypes_capturegroupttarget_foundR*texpandedtp_type((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyRW[	s`
	.


""
	
"
cC@s�d}i}x&|D]}igd6gd6||<qWt�}t|dt�}xd|D]\}xS|j|g�D]?}||kr�||dj|�qp||dj|�qpWqWW|S(	u�
    .. versionadded:: 2014.1.0
    .. versionchanged:: 2016.3.0,2015.8.4,2015.5.10
        Environment groups are now supported. The key names have been renamed,
        similar to the changes made in :py:func:`pkg.group_info
        <salt.modules.yumpkg.group_info>`.

    Lists which of a group's packages are installed and which are not
    installed

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.group_diff 'Perl Support'
    u	mandatoryuoptionaludefaultuconditionalu	installedu
not installedRT(u	mandatoryuoptionaludefaultuconditional(RORWR8RR:(RRXRRYR
t
group_pkgstmember((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyt
group_diff�	s
	
cK@s�t|tj�r!|jd�n|}|s<td��nt|t�sZtd��nt|tj�r~|jd�}nt|ttf�s�td��nt|tj�r�|jd�}nt|ttf�s�td��ng}xk|D]c}t|�}|j|j	dg��|jg|j	dg�D]}||kr;|^q;�q�W|rt|j|�ng|D]}	|	t
�kr{|	^q{}
|
s�iStd|
|�S(	u|
    .. versionadded:: 2014.1.0

    Install the passed package group(s). This is basically a wrapper around
    :py:func:`pkg.install <salt.modules.yumpkg.install>`, which performs
    package group resolution for the user. This function is currently
    considered experimental, and should be expected to undergo changes.

    name
        Package group to install. To install more than one group, either use a
        comma-separated list or pass the value as a python list.

        CLI Examples:

        .. code-block:: bash

            salt '*' pkg.group_install 'Group 1'
            salt '*' pkg.group_install 'Group 1,Group 2'
            salt '*' pkg.group_install '["Group 1", "Group 2"]'

    skip
        Packages that would normally be installed by the package group
        ("default" packages), which should not be installed. Can be passed
        either as a comma-separated list or a python list.

        CLI Examples:

        .. code-block:: bash

            salt '*' pkg.group_install 'My Group' skip='foo,bar'
            salt '*' pkg.group_install 'My Group' skip='["foo", "bar"]'

    include
        Packages which are included in a group, which would not normally be
        installed by a ``yum groupinstall`` ("optional" packages). Note that
        this will not enforce group membership; if you include packages which
        are not members of the specified groups, they will still be installed.
        Can be passed either as a comma-separated list or a python list.

        CLI Examples:

        .. code-block:: bash

            salt '*' pkg.group_install 'My Group' include='foo,bar'
            salt '*' pkg.group_install 'My Group' include='["foo", "bar"]'

    .. note::
        Because this is essentially a wrapper around pkg.install, any argument
        which can be passed to pkg.install may also be included here, and it
        will be passed along wholesale.
    u,uno groups specifiedu'groups' must be a listu'skip' must be a listu'include' must be a listumandatory packagesudefault packagesR
(RVRR\RR	RWttupleRWR9RROR?(RtskiptincludeR;RNReR$tgroup_detailRARR
((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyt
group_install�	s47'
(ugroupinstallc	C@s�t|�}i}tjd|�x�|D]�}tjj|�sGq)nx}tj|�D]l}dj||�}|jd�s�qWnt	|�d}x,|D]$}||}||d<|||<q�WqWWq)W|S(u 
    Lists all repos in <basedir> (default: all dirs in `reposdir` yum option).

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.list_repos
        salt '*' pkg.list_repos basedir=/path/to/dir
        salt '*' pkg.list_repos basedir=/path/to/dir,/path/to/another/dir
    uSearching for repos in %su{0}/{1}u.repoiufile(
R�RTRRsRtRutlistdirR!tendswitht_parse_repo_file(	R�tbasedirsR�tbdirtrepofiletrepopatht	filereposR�R^((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyR�<
s 




cK@sbt|�}d}x+|D]#}||kr||d}qqW|r^t|�d}||SiS(u?
    Display a repo from <basedir> (default basedir: all dirs in ``reposdir``
    yum option).

    CLI Examples:

    .. code-block:: bash

        salt '*' pkg.get_repo myrepo
        salt '*' pkg.get_repo myrepo basedir=/path/to/dir
        salt '*' pkg.get_repo myrepo basedir=/path/to/dir,/path/to/another/dir
    uufilei(R�Ri(RR�R;R�RlR^Rn((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pytget_repo[
s

cK@st|�}t|�}||kr4dj||�Sd}x+|D]#}||krA||d}qAqAWt}xFtj|�D]5}||kr�q~n||d|kr~t}q~q~W|r�tj|�dj||�St	|�\}}	|}
x�tj|	�D]�}||krqnd}dtj|	|�krgt
jjj
j|	|d�}|	|d=n|
dj|�7}
x0|	|D]$}
|
dj|
|	||
�7}
q�W|
dj|�7}
qWt
jjj|d	��#}|jt
jjj|
��Wd
QXdj||�S(u�
    Delete a repo from <basedir> (default basedir: all dirs in `reposdir` yum
    option).

    If the .repo file in which the repo exists does not contain any other repo
    configuration, the file itself will be deleted.

    CLI Examples:

    .. code-block:: bash

        salt '*' pkg.del_repo myrepo
        salt '*' pkg.del_repo myrepo basedir=/path/to/dir
        salt '*' pkg.del_repo myrepo basedir=/path/to/dir,/path/to/another/dir
    u)Error: the {0} repo does not exist in {1}uufileu-File {0} containing repo {1} has been removeducommentsu
[{0}]u
{0}={1}u
{0}
uwNu"Repo {0} has been removed from {1}(R�R�R!R8RRGRRsRDRiRRRARBtcombine_commentstfilestfopentwritetstringutilstto_str(R^R�R;RjR�RltarepotonlyrepotheaderRntcontenttstanzatcommentsRtfileout((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pytdel_repow
sH




""c@s�t�fd��D���t�fd�dD��rGtd��ng}xFt��D]8}�|dkrZ�|rZ�|=|j|�qZqZWd�kr�|jd�nd�kr�|jd�nd|kr�td��ni}t|�}t|�}d	}d	}i}	||kr�d}
x*|D]"}tj	j
|�r2|}
Pq2q2W|
svtd
j|���ndj|
|�}d�kr�td��nd�kr�d�kr�td
��ni|	|<n ||d}t|�\}}	d|kr1d�kr1d|	|kr1td��q1nd|krkd�krkd|	|krktd��qknx;|D]3}|t
j|	|j��krr|	||=qrqrWd�}|	|j��|}
x�t
j|	�D]�}tjjjj|	|jdg��}|
dj|�7}
xdt
j|	|�D]O}|
dj|t|	||t�se|	||n||	||��7}
q.W|
|d7}
q�Wtjjj|d��#}|jtjjj|
��WdQXi|	|6S(uN
    Modify one or more values for a repo. If the repo does not exist, it will
    be created, so long as the following values are specified:

    repo
        name by which the yum refers to the repo
    name
        a human-readable name for the repo
    baseurl
        the URL for yum to reference
    mirrorlist
        the URL for yum to reference

    Key/Value pairs may also be removed from a repo's configuration by setting
    a key to a blank value. Bear in mind that a name cannot be deleted, and a
    baseurl can only be deleted if a mirrorlist is specified (or vice versa).

    CLI Examples:

    .. code-block:: bash

        salt '*' pkg.mod_repo reponame enabled=1 gpgcheck=1
        salt '*' pkg.mod_repo reponame basedir=/path/to/dir enabled=1
        salt '*' pkg.mod_repo reponame baseurl= mirrorlist=http://host.com/
    c3@s;|]1}|jd�r|dkr|�|fVqdS(u__usaltenvN(usaltenv(R[(R�R(R;(s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pys	<genexpr>�
sc3@s|]}|�kVqdS(N((R�R(t	repo_opts(s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pys	<genexpr>�
su
mirrorlistubaseurlu7Only one of 'mirrorlist' and 'baseurl' can be specifiediunameuThe repo name cannot be deleteduuiThe repo does not exist and needs to be created, but none of the following basedir directories exist: {0}u{0}/{1}.repouIThe repo does not exist and needs to be created, but a name was not givenugThe repo does not exist and needs to be created, but either a baseurl or a mirrorlist needs to be givenufileu3Cannot delete baseurl without specifying mirrorlistu3Cannot delete mirrorlist without specifying baseurlcS@s|r
dSdS(Nu1u0((R((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyR�-sucommentsu[{0}]
u{0}={1}
u
uwN(u
mirrorlistubaseurl(R�R�R	RWR:R�R�R&RsRtRuR!RiRRGtcopyR4RRRARBRpRRRVtboolRqRrRsRtRu(R^R�R;ttodeleteRKR�RjRlRxRntnewdirR�t_bool_to_strRyRzR{RR|((R;R~s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pytmod_repo�
s�




		%"c

C@s�tj�}i}y|j|�Wn3tjk
rX}tjd||j�difSXx>|jD]3}t|j|�}|j	dd
�|||<qcWd}d
}tjj
j|d���}x�|D]�}tjjj|�}|j�}|jd�rv|d
kr||d7}q�y1||jdg�}	|	j|dj��Wq�tk
rrtjd	||�q�Xq�|jd
�r�|jd�r�|dd!}q�q�WWd
QX|tjjj|�fS(u-
    Turn a single repo file into a dict
    u"Failed to parse file %s, error: %suu__name__uru#u
ucommentsiuKFound comment in %s which does not appear to belong to any repo section: %su[u]i����N(RRvRwtMissingSectionHeaderErrorRTR�tmessaget	_sectionsR�RRR&RRRqRrRtt
to_unicodeR|R[R�R:REtKeyErrorRRhR�tdecode(
R�tparsedtconfigterrtsectiontsection_dicttheadersRlRR{((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyRiEs@


cG@std|�S(ur
    .. versionadded:: 2014.1.0

    List the files that belong to a package. Not specifying any packages will
    return a list of *every* file on the system's rpm database (not generally
    recommended).

    CLI Examples:

    .. code-block:: bash

        salt '*' pkg.file_list httpd
        salt '*' pkg.file_list httpd postfix
        salt '*' pkg.file_list
    ulowpkg.file_list(R7(tpackages((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyt	file_listvscG@std|�S(u�
    .. versionadded:: 2014.1.0

    List the files that belong to a package, grouped by package. Not
    specifying any packages will return a list of *every* file on the system's
    rpm database (not generally recommended).

    CLI Examples:

    .. code-block:: bash

        salt '*' pkg.file_list httpd
        salt '*' pkg.file_list httpd postfix
        salt '*' pkg.file_list
    ulowpkg.file_dict(R7(R�((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyt	file_dict�scG@s�|s
dSi}ddddg}xX|D]P}td||gddd	t�||<d
||j�kr)d||<q)q)Wt|�dkr�ttj|��S|S(u�
    .. versionadded:: 2014.7.0

    Return the name of the package that owns the file. Multiple file paths can
    be passed. Like :mod:`pkg.version <salt.modules.yumpkg.version>`, if a
    single path is passed, a string will be returned, and if multiple paths are
    passed, a dictionary of file/package name pairs will be returned.

    If the file is not owned by a package, or is not present on the minion,
    then an empty string will be returned for that path.

    CLI Examples:

    .. code-block:: bash

        salt '*' pkg.owner /usr/bin/apachectl
        salt '*' pkg.owner /usr/bin/apachectl /etc/httpd/conf/httpd.conf
    uurpmu-qfu
--queryformatu%{name}ucmd.run_stdoutR�utraceR�u	not ownedi(R7RRR�RFRt
itervalues(R�RR�Rt((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pytowner�s


cO@std||�S(u�
    List the modified files that belong to a package. Not specifying any packages
    will return a list of _all_ modified files on the system's RPM database.

    .. versionadded:: 2015.5.0

    Filtering by flags (True or False):

    size
        Include only files where size changed.

    mode
        Include only files which file's mode has been changed.

    checksum
        Include only files which MD5 checksum has been changed.

    device
        Include only files which major and minor numbers has been changed.

    symlink
        Include only files which are symbolic link contents.

    owner
        Include only files where owner has been changed.

    group
        Include only files where group has been changed.

    time
        Include only files where modification time of the file has been
        changed.

    capabilities
        Include only files where capabilities differ or not. Note: supported
        only on newer RPM versions.

    CLI Examples:

    .. code-block:: bash

        salt '*' pkg.modified
        salt '*' pkg.modified httpd
        salt '*' pkg.modified httpd postfix
        salt '*' pkg.modified httpd owner=True group=False
    ulowpkg.modified(R7(R�tflags((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pytmodified�s0u
yumdownloadercG@sa|std��nd}tjj|�s=tj|�ntj|�}g}xU|D]M}|jg|D]3}|jdj|��rltjj	||�^ql�qYWx^t
|�D]P}tjd|�ytj
|�Wq�tk
r}tjd||�q�Xq�Wdddj|�g}|j|�td	|d
ddt�i}	x�tj|�D]�}
|
jd
�s{q`nd}d}x6|D].}
|
jdj|
��r�|
}|
}Pq�q�W|dk	r`tjj	||�|	|<q`q`W|	stdjdj	|����ng|D]}||	kr|^q}|r]djdj	|��|	d<n|	S(u�
    .. versionadded:: 2015.5.0

    Download packages to the local disk. Requires ``yumdownloader`` from
    ``yum-utils`` package.

    .. note::

        ``yum-utils`` will already be installed on the minion if the package
        was installed from the Fedora / EPEL repositories.

    CLI example:

    .. code-block:: bash

        salt '*' pkg.download httpd
        salt '*' pkg.download httpd postfix
    uNo packages were specifiedu/var/cache/yum/packagesu{0}-uRemoving cached package %suUnable to remove %s: %su
yumdownloaderu-qu
--destdir={0}ucmd.runR�utraceR�u.rpmu5Unable to download any of the following packages: {0}u, u0The following package(s) failed to download: {0}u_errorN(R	RsRtRutmakedirsRgR9R[R!RXR�RTRtunlinkRyR�R7RRhR&R(R�R�tcached_pkgstto_purgeRARtpurge_targetR�R=Rt
dld_resultR�tpkg_filet	query_pkgtfailed((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pytdownload�sZ
	
8

 %c	G@si}i}x||D]t}td|�}|sTtjj|�rGdpJd||<q|j|�dkrvg||<n||j|�qW|r�td|j��}xS|j�D]B\}}x3|D]+}td||d|�p�d||<q�Wq�Wn|S(	u�
    Return a formatted diff between current files and original in a package.
    NOTE: this function includes all files (configuration and not), but does
    not work on binary content.

    :param path: Full path to the installed file
    :return: Difference string or raises and exception if examined file is binary.

    CLI example:

    .. code-block:: bash

        salt '*' pkg.diff /etc/apache2/httpd.conf /etc/sudoers
    ulowpkg.owneruNot manageduN/Aupkg.downloadulowpkg.diffupathu	UnchangedN(	R7RsRtRuRR&R:RHR�(	R�Rtpkg_to_pathstpthtpth_pkgt
local_pkgsRARqRt((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pytdiff<s 
%

)c	C@s�i}t�ddddg}td|dt�}x�tjjj|tj�D]l}t	j
d|�j�\}}}}|dkr�|r�qPni|dkr�tntd	6|d
6||<qPW|S(u*
    List all known patches in repos.
    u--quietu
updateinfoulistuallucmd.run_stdoutR�u%([i|\s]) ([^\s]+) +([^\s]+) +([^\s]+)uiu	installedusummary(
R R7RRRRRRstlinesepR"R*RNR8(	tinstalled_onlytpatchesR=RRtinstR1tsevRA((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyt_get_patchesas	"	cC@s|rt�nt�S(u:
    .. versionadded:: 2017.7.0

    List all known advisory patches from available repos.

    refresh
        force a refresh if set to True.
        If set to False (default) it depends on yum if a refresh is
        executed.

    CLI Examples:

    .. code-block:: bash

        salt '*' pkg.list_patches
    (R�R�(R�((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyRxs
cC@s
tdt�S(u�
    .. versionadded:: 2017.7.0

    List installed advisory patches on the system.

    CLI Examples:

    .. code-block:: bash

        salt '*' pkg.list_installed_patches
    R�(R�R8(((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pytlist_installed_patches�s(pt__doc__t
__future__RRRRR�R�RtloggingRsR"RUtsalt.extRtsalt.ext.six.movesRRiR8RhtImportErrorRRtsalt.utils.argsRtsalt.utils.datatsalt.utils.decorators.pathtsalt.utils.filestsalt.utils.functoolstsalt.utils.itertoolstsalt.utils.lazytsalt.utils.pathtsalt.utils.pkgtsalt.utils.pkg.rpmtsalt.utils.systemdtsalt.utils.versionsRR�tsalt.utils.environmenttsalt.exceptionsRRR	t	getLoggerRRTt__HOLD_PATTERNRRRR-R R>RMRQRgR�R�R&R�R�R�Rt	functoolstalias_functiontavailable_versionR�R�R�ROR�R�tlist_updatesR�R�R�R�tlazytLazyDictR�R?RCR4RDRER
RRtget_locked_packagesRMRSRWRaRftgroupinstallR�RoR}R�RiR�R�R�R�t
decoratorsRttwhichR�R�R�RR�(((s7/usr/lib/python2.7/site-packages/salt/modules/yumpkg.pyt<module>s�


					&		I	K	
		y	
	W	�!		$	G	��-�W-Vi)		9_	"\B�	1			$	3!I	%

Zerion Mini Shell 1.0