%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/modules/zypperpkg.pyo

�
���^c
@@sdZddlmZmZmZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZddlmZddlmZddlmZddlZddlZddlZddlZddlZddlZddlZddlZddl Zdd	l!m"Z"ddl#Zdd
l$m%Z%m&Z&m'Z'ej(e)�Z*e+Z,dZ-dj.e-�Z/d
j.e-�Z0dZ1dZ2d�Z3de4fd��YZ5e5�Z6de4fd��YZ7d�Z8d�Z9e:d�Z;ej<j=j>e;d�Z?d�Z@d�ZAd�ZBej<j=j>eBd�ZCd�ZDd�ZEe+d�ZFe+d �ZGd!�ZHd"�ZIeJd#�ZKd$�ZLd%�ZMd&�ZNd'�ZOd(�ZPeJe+eJeJeJeJe+eJe+d)�	ZQe:e+e+eJe+e+d*�ZReJeJd+�ZSd,�ZTeJeJd-�ZUeJeJd.�ZVd/�ZWd0�ZXd1�ZYd2�ZZd3�Z[d4�Z\d5�Z]d6�Z^d7�Z_eJd8�Z`e+d9�Zad:�Zbe+d;�Zcd<�Zde+e+d=�Zed>�Zfd?�Zgd@�Zhe+dA�Zie+dB�ZjdC�ZkdD�ZldE�ZmdS(Fu�
Package support for openSUSE via the zypper package manager

:depends: - ``rpm`` Python module.  Install with ``zypper install rpm-python``

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

i(tabsolute_importtprint_functiontunicode_literalsN(tsix(tconfigparser(turlparse(tminidom(t
ExpatError(tLooseVersion(tCommandExecutionErrortMinionErrortSaltInvocationErroru	/etc/zyppu	{0}/locksu{0}/repos.dicupkgcC@sEtjdd�dkr"tdfStjjjd�sAtdfStS(u:
    Set the virtual pkg module if the os is openSUSE
    u	os_familyuuSuseuAModule zypper: non SUSE OS not suppored by zypper package manageruzypperu/Module zypper: zypper package manager not found(t
__grains__tgettFalsetsalttutilstpathtwhicht__virtualname__(((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt__virtual__<s


t_ZyppercB@s=eZdZidd6dd6dd6dd6d	d
6Zidd6d
d6dd6dd6ZdZddgZdZdZdZ	d�Z
d�Zd�Zd�Z
ed��Zejd��Zed��Zejd��Zed ��Zed!��Zed"��Zd#�Zd$�Zd%�Zd&�Zd'�ZRS((u�
    Zypper parallel caller.
    Validates the result and either raises an exception or reports an error.
    Allows serial zypper calls (first came, first won).
    u.Successful run of zypper with no special info.iu'Patches are available for installation.idu0Security patches are available for installation.ieu)Installation successful, reboot required.ifuGInstallation succesful, restart of the package manager itself required.iguNo repositories are defined.iuThe ZYPP library is locked.iu�Some repository had to be disabled temporarily because it failed to refresh. You should check your repository configuration (e.g. zypper ref -f).iju~Installation basically succeeded, but some of the packages %post install scripts returned an error. These packages were successfully unpacked to disk and are registered in the rpm database, but due to the failed install script they may not work as expected. The failed scripts output might reveal what actually went wrong. Any scripts output is also logged to /var/log/zypp/history.iku-xu--xmloutu/var/run/zypp.piduzypper/releaseduzypper/blockedcC@st|_|j�dS(u
        Constructor
        N(Rt_Zypper__calledt_reset(tself((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt__init__hs	cC@s�ddg|_d|_t�|_d|_tjjjt	��|_
t|_t|_
t|_t|_t|_t|_dS(uD
        Resets values of the call setup.

        :return:
        uzypperu--non-interactiveiuN(t_Zypper__cmdt_Zypper__exit_codetdictt_Zypper__call_resultt_Zypper__error_msgRRtenvironmenttget_module_environmenttglobalst_Zypper__envRt_Zypper__xmlt_Zypper__no_lockt_Zypper__no_raiset_Zypper__refresht_Zypper__ignore_repo_failuret_Zypper__systemd_scope(R((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyRos							cO@s<d|kr|d|_nd|kr8|d|_n|S(uF
        :param args:
        :param kwargs:
        :return:
        uno_repo_failureu
systemd_scope(R'R((Rtargstkwargs((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt__call__�s
cC@s�|jr|j�t|_n|dkr7t|_nf|dkrOt|_nN|dkrgt|_n6|dkrt|_n|dkr�|jS|j	|S|jr�|j|_n|S(uK
        Call configurator.

        :param item:
        :return:
        uxmlunolockunoraiseurefreshableucall(
RRRtTrueR#R$R%R&t
_Zypper__callt__dict__(Rtitem((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt__getattr__�s"	
	cC@s|jS(N(R(R((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt	exit_code�scC@st|pd�|_dS(Nu0(tintR(RR1((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyR1�scC@s|jS(N(R(R((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt	error_msg�scC@s4|j�r0|r$tjj|�p'd|_ndS(NuCheck Zypper's logs.(t	_is_errortostlineseptjoinR(Rtmsg((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyR3�scC@s|jjdd�S(Nustdoutu(RR
(R((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytstdout�scC@s|jjdd�S(Nustderru(RR
(R((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytstderr�scC@s|jjdd�S(Nupidu(RR
(R((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytpid�scC@s�|jrb|jj|j�}|r4tj|�n|jj|j�}|rbtj|�qbn|j|jko�|j|jkS(u=
        Is this is an error code?

        :return:
        (R1tSUCCESS_EXIT_CODESR
tlogtinfotWARNING_EXIT_CODEStwarning(RR8((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyR4�s	cC@s|j|jkS(uA
        Is this is a lock error code?

        :return:
        (R1tLOCK_EXIT_CODE(R((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt_is_lock�scC@s5g|jD]}||jkr
|^q
r1tp4tS(uH
        Is Zypper's output is in XML format?

        :return:
        (tXML_DIRECTIVESRR,R(Rtitm((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt_is_xml_mode�scC@ss|jstd��n|jd|_|j�r8tS|j�rot�}|j�s�|jdry|jdj�p|d}|rc|j	|�qcn�yt
j|jd�}Wn&tk
r�}t
j|�d
}nX|r3|jd�}xp|D]5}|jd�dkr�|j	|jd	j�q�q�Wn0|jdj�rc|j	|jdj��n||_ntS(u�
        Check and set the result of a zypper command. In case of an error,
        either raise a CommandExecutionError or extract the error.

        result
            The result of a zypper command called with cmd.run_all
        uNo output result from Zypper?uretcodeustderruustdoutumessageutypeuerroriN(RR	R1RBRR4tlistREtstriptappendtdomtparseStringRR=terrortNonetgetElementsByTagNametgetAttributet
childNodest	nodeValueR3R,(Rt
_error_msgR8tdocterrt	msg_nodestnode((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt
_check_result�s2		&


!cO@s?t|_|jr%|jjd�n|jsA|jjd�n|jj|�d|d<t|d<|jj	�|d<|j
r�d|dd<nt}x�tr�g}|jr�|jd	d
g�n|j|j�tj
ddj|��td
||�|_|j�rPntjj|j�ry�tjjj|j��}tdt|j��dddddg�}dj|d�|d<djtjj|d�j��|d<t|d<WdQXWqt k
r�}idj|j!�d6td6}qXnidd6td6}|ds/tj
d�n
tj
d�td||j"�tj
d|�tj
d�t#j$d�|s�t}q�q�W|r�tdit%|j&�d6|j&p�d d6|j'�n|j&r|j(r|j)rt*d!j|j&���n|j+�r4t,j-tjj.j/|jd"��p>|jd"S(#uF
        Call Zypper.

        :param state:
        :return:
        u--xmloutu--no-refreshutraceuoutput_loglevelupython_shelluenvu1uZYPP_READONLY_HACKusystemd-runu--scopeuCalling Zypper: u ucmd.run_allups.proc_infotattrsupidunameucmdlineucreate_timeu Blocking process created at {0}.uinfousuccessNu:Unable to retrieve information about blocking process: {0}u4Zypper is locked, but no Zypper lock has been found.u.Unable to collect data about blocking process.u&Collected data about blocking process.uevent.fire_masteru<Fired a Zypper blocked event to the master with the data: %su-Waiting 5 seconds for Zypper gets released...iuZypper has been releaseduZypper command failure: {0}ustdout(0R,RR#RRHR&textendRR"tcopyR$R(R=tdebugR7t__salt__RRVR5RtexiststZYPPER_LOCKRRtfilestfopenR2treadlinetformattdatetimetutcfromtimestampt	isoformatt	ExceptiontmessagetTAG_BLOCKEDttimetsleeptlenR3tTAG_RELEASEDR%R'R	RERIRJtstringutilstto_str(RR)R*twas_blockedtcmdtrfhtdataRS((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt__callsh			

			#





%(t__name__t
__module__t__doc__R<R?RARCR]RkRgRRR+R0tpropertyR1tsetterR3R9R:R;R4RBRERVR-(((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyRHsB

			
					%tWildcardcB@sPeZdZdddddgZd�Zd�Zd�Zd	�Zd
�ZRS(u�
    .. versionadded:: 2017.7.0

    Converts string wildcard to a zypper query.
    Example:
       '1.2.3.4*' is '1.2.3.4.whatever.is.here' and is equal to:
       '1.2.3.4 >= and < 1.2.3.5'

    :param ptn: Pattern
    :return: Query range
    u<u<=u=u>=u>cC@s1d|_d|_||_d|_d|_dS(uN
        :type zypper: a reference to an instance of a _Zypper class.
        ueditionN(RLtnametversiontzyppert_attr_solvable_versiont_op(RR{((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyRms
				cC@s}|ry||_|j|�tg|j|j��D]}t|�^q5�}|rudj|jphd|d�pxdSdS(u�
        Convert a string wildcard to a zypper query.

        :param pkg_name:
        :param pkg_version:
        :return:
        u{0}{1}ui����N(	Ryt_set_versiontsortedt_get_scope_versionst_get_available_versionsRRaR}RL(Rtpkg_nametpkg_versiontvrstversions((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyR+ws	
.cC@s�|jjjjdd|j�jd�}|sKtdj|j���ntt	g|D]*}|j
|j�rX|j
|j�^qX��S(uI
        Get available versions of the package.
        :return:
        useu-xvusolvableu No packages found matching '{0}'(R{tnolocktxmltcallRyRMR	RaRtsetRNR|(Rt	solvablestslv((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyR��s
*	cC@s@g}x3|D]+}tj||j�r
|j|�q
q
W|S(u[
        Get available difference between next possible matches.

        :return:
        (tfnmatchRzRH(Rtpkg_versionstget_in_versionst	p_version((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyR��s

cC@s}|s
dStjdd|�}|j|d�p4d|_|jrp|j|jkrptdj|j���n||_dS(uL
        Stash operator from the version, if any.

        :return:
        Nu[<>=+]*uu&Zypper do not supports operator "{0}".(	tretsubtreplaceRLR}tZ_OPR	RaRz(RRzt
exact_version((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyR~�s(	RsRtRuR�RR+R�R�R~(((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyRx^s	
			cC@s&tjjjt�o%tddt�S(Nu
config.getu
systemd.scope(RRtsystemdt	has_scopet__context__R[R,(((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt_systemd_scope�scC@s+x$ddgD]}tj|d�q
WdS(u
    Clean cached results
    u
pkg.list_pkgsupkg.list_providesN(R�tpopRL(t
cache_name((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt_clean_cache�scK@s�|rt�nt�}dg}d|krr|d}t|tj�s\tj|�}n|jd|g�nxZtjj	j
|�jd�D]:}|jd�dkr�|jd�||jd�<q�q�W|S(	u
    List all available package upgrades on this system

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

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.list_upgrades
    ulist-updatesufromrepou--repouupdateukindupackageueditionuname(
t
refresh_dbRt
isinstanceRtstring_typest	text_typeRXt
__zypper__R�R�R�RMRN(trefreshR*tretRot	repo_nametupdate_node((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt
list_upgrades�s
		
%#ulist_updatescO@s�|jdt�}t�}x�td||�j�D]�\}}|rM|n|g}x�|D]~}t�}x@tj|�D]/\}	}
|	dkr�|
|d<q||
||	<q|W|s�|||<q]|j|g�j|�q]Wq5W|S(u�
    Return the information of the named package(s), installed on the system.

    :param names:
        Names of the packages to get information about.

    :param attr:
        Comma-separated package attributes. If no 'attr' is specified, all available attributes returned.

        Valid attributes are:
            version, vendor, release, build_date, build_date_time_t, install_date, install_date_time_t,
            build_host, group, source_rpm, arch, epoch, size, license, signature, packager, url,
            summary, description.

    :param errors:
        Handle RPM field errors. If 'ignore' is chosen, then various mistakes are simply ignored and omitted
        from the texts or strings. If 'report' is chonen, then a field with a mistake is not returned, instead
        a 'N/A (broken)' (not available, broken) text is placed.

        Valid attributes are:
            ignore, report

    :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
        salt '*' pkg.info_installed <package1> attr=version,vendor all_versions=True
        salt '*' pkg.info_installed <package1> <package2> <package3> ... attr=version,vendor
        salt '*' pkg.info_installed <package1> <package2> <package3> ... attr=version,vendor errors=ignore
        salt '*' pkg.info_installed <package1> <package2> <package3> ... attr=version,vendor errors=report
    uall_versionsulowpkg.infou
source_rpmusource(	R
RRR[titemsRt	iteritemst
setdefaultRH(tnamesR*tall_versionsR�R�tpkgs_nfotpkg_nfot_nfott_nfotkeytvalue((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytinfo_installed�s&	&
	

!c	O@s�i}|s|Sttt|���}|jdt�rDt�ng}|}d}xF|r�|jtjdt	j
jddd|| ���||}qZWxH|D]@}i}x�g|jd�D]}d|kr�|^q�D]}}	|	jd	�r�q�ng|	jdd
�D]}|j
�^q}
t|
�dkr�|
d
r�|
d
||
dj�<q�q�W|jd
�r�|jd
�}|||<n|jd�r�|jd�|d<n|jd�r�|jd�j�jd�|d<q�q�W|S(u�
    Return the information of the named package available for the system.

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

    CLI example:

    .. code-block:: bash

        salt '*' pkg.info_available <package1>
        salt '*' pkg.info_available <package1> <package2> <package3> ...
    urefreshi�uInformation for package*uinfou-tupackageu
u:u-----iiiunameustatusu	installeduyes(RRFR�R
R,R�RXR�tsplitR�R�R�t
startswithRGRjtlowerR�(R�R*R�tpkg_infotbatcht
batch_sizetpkg_datatnfoRqtlinetkwRy((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytinfo_availables:
	#
5+
)cO@s�t�}|s|Sttt|���}t||�}x�|D]z}|j|i�}|jdd�j�}|jd�dks�|jd�dkr�|jd�||<qAd||<qAWt|�dkr�t|�r�||dS|S(	ut
    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
    dict will be returned for that package.

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

    CLI example:

    .. code-block:: bash

        salt '*' pkg.latest_version <package name>
        salt '*' pkg.latest_version <package1> <package2> <package3> ...
    ustatusuu
not installedi����uout-of-dateuversionii(	RRRFR�R�R
R�tfindRj(R�R*R�tpackage_infoRyR�tstatus((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytlatest_versionPs	
*uavailable_versioncK@st||�S(uB
    Check whether or not an upgrade is available for a given package

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

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.upgrade_available <package name>
    (R�(RyR*((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytupgrade_availablescO@std||�piS(uW
    Returns a string representing the package version or an empty dict 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(R[(R�R*((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyRz�s
cC@std||d|�S(u�
    .. versionadded:: 2015.5.4

    Do a cmp-style comparison on two packages. Return -1 if ver1 < ver2, 0 if
    ver1 == ver2, and 1 if ver1 > ver2. 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(R[(tver1tver2R�((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytversion_cmp�scK@sHtjjj|�}tgd D]$}tjjj|j|��^q�rPiS|jd�}|d!k	r�tjjj|�}nd}|t	kr0i}dddtjj
jjj
dd	�d
g}td|dtd
d�}x�|j�D]�}tjj
jj|dtd�}	|	r�|	j}
d}d}d|
kr\|
jdd�\}}
nd|
kr�|
jdd�\}
}ni|d6|
d6|d6|	jd6|	jd6|	jd6}
td||	j|
�q�q�Wi}x@|D]8}|jd�rq�nt||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

    removed:
        not supported

    purge_desired:
        not supported

    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_loglevelutracetosarchuosarchuu:iu-uepochuversionureleaseuarchuinstall_dateuinstall_date_time_tupkg_resource.add_pkgu
gpg-pubkeyR�cS@s|dS(Nuversion((td((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt<lambda>supkg_resource.format_pkg_list(uremovedu
purge_desiredN(RRRqtis_truetanyR
RLR)tsplit_inputR�tpkgtrpmtQUERYFORMATR�R[Rt
splitlinest
parse_pkginfoRRzR�tarchtinstall_datetinstall_date_time_tRyR�R(tversions_as_listR*txtattrt
contextkeyR�RotoutputR�tpkginfotpkgvertepochtreleasetall_attrt_rettpkgname((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt	list_pkgs�sZ'1	%
	
	



!
c@s�|jdt�}|jdd�p'd}i}g�D]-}t|tj�rU|ntj|�^q7���fd�}x�tjjdd��j	d�D]�}t
|jj��}yP|dd	kr�w�n|d
}	|r�|	|kr�w�n|d}
|d}Wnt
k
rq�q�X||
�r�|j|	i�}|j|
t��}
|
j|�q�q�W|r�xz|D]r}	xi||	D]]}
tg||	|
D]}t|�^q�d
t�}g|D]}|j^q�||	|
<q�WqtW|Si}xD|D]<}	x3||	D]'}
|j|
g�j||	|
�qWq�Wx]|D]U}
tg||
D]}t|�^qVd
t�}g|D]}|j^q~||
<qBW|SdS(u�
    .. versionadded:: 2017.7.5,2018.3.1

    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.

    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.3-83.3.1',
                     '4.3-82.6'],
            'vim': ['7.4.326-12.1']
        }
        {
            'OSS': {
                'bash': ['4.3-82.6'],
                'vim': ['7.4.326-12.1']
            },
            'OSS Update': {
                'bash': ['4.3-83.3.1']
            }
        }

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

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

    CLI Examples:

    .. code-block:: bash

        salt '*' pkg.list_repo_pkgs
        salt '*' pkg.list_repo_pkgs foo bar baz
        salt '*' pkg.list_repo_pkgs 'python2-*' byrepo=True
        salt '*' pkg.list_repo_pkgs 'python2-*' fromrepo='OSS Updates'
    ubyrepoufromrepouc@s5�s
tSx$�D]}tj||�rtSqWtS(u�
        When package names are passed to a zypper search, they will be matched
        anywhere in the package name. This makes sure that only exact or
        fnmatch matches are identified.
        (R,R�R(R�ttarget(R)ttargets(s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt	_is_matchVs
useu-susolvableukindupackageu
repositoryunameueditiontreverseN(R�RR�RR�R�R�R�R�RMRt
attributesR�tKeyErrorR�R�taddRRR,tvstringRX(R)R*tbyrepotfromrepoR�targR�RUR�treponameR�t
pkgversiont	repo_dicttversion_listR�tsorted_versionst
byrepo_ret((R)R�s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytlist_repo_pkgssP47(



'	,
)
#	$cC@sPtj�}|jgtjt�D]#}|jd�r"td|^q"�|S(uF
    Get all the info about repositories from the configurations.
    u.repou/(RtConfigParsertreadR5tlistdirtREPOStendswith(t	repos_cfgtfname((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt_get_configured_repos�s@cC@s�y�t|pt�j|��}||d<x_tj|�D]N\}}|dkrpt||�dk||<q;|dkr;d||<q;q;W|SWnttj	fk
r�iSXdS(u!
    Get one repo meta-data.
    ualiasu0u1iuNONEN(u0u1(
RR�R�RR�R2RLt
ValueErrorRtNoSectionError(taliasR�tmetaR�tval((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt_get_repo_info�s
cK@s
t|�S(uj
    Display a repo.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.get_repo alias
    (R(trepoR*((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytget_repo�s
cC@s@t�}i}x*|j�D]}t|d|�||<qW|S(uf
    Lists all repos.

    CLI Example:

    .. code-block:: bash

       salt '*' pkg.list_repos
    R�(R�tsectionsR(R�t	all_reposR�((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt
list_repos�s

	cC@s�t�}x�|j�D]t}||krtjjddd|�}|jd�}|jd�r�|r�it|6|djdjd6SqqWt	dj
|���dS(	uj
    Delete a repo.

    CLI Examples:

    .. code-block:: bash

        salt '*' pkg.del_repo alias
    urru--loose-authu
--loose-queryumessageuprogressiuRepository '{0}' not found.N(R�RR�R�R�RMR,RORPR	Ra(RR�R�RRR8((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytdel_repo�s
	cK@s�t�}t}||j�kr�|jd|jd|jd���}|sftdj|���nt|�js�tdj|���nx�|j�D]�}t|d|�}t|�}|j	s	tj
d|jd|jd	d
d|jd|j
d
|j�}nt|d�}||kr�tdj||���q�q�Wtjjd||�t�}||j�kr�tdj|���nt}nt|�}	|r�d|kr�|d|	dkr�|	j|�|	jdt�t|�t||	�Sg}
g}t}d|kr<|
j|dr2dp5d�nd|krh|
j|dr^dpad�nd|kr�|
j|dr�dp�d�nd|kr�|
j|dr�dp�d�nd|kr�|
jdj|jdt���nd|kr|
jd j|jd���n|jd!�tkrJ|jd"�t}n|
r~|d#g|
|g}
tjjj|
�nd&}
|r�|dg|g}tjj|�n|r�|
r�d$}
nt|�}|
r�|
|d%<n|S('u�
    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 or alias
        alias by which Zypper refers to the repo

    url, mirrorlist or baseurl
        the URL for Zypper to reference

    enabled
        Enable or disable (True or False) repository,
        but do not remove if disabled.

    refresh
        Enable or disable (True or False) auto-refresh of the repository.

    cache
        Enable or disable (True or False) RPM files caching.

    gpgcheck
        Enable or disable (True or False) GPG check for this repository.

    gpgautoimport : False
        If set to True, automatically trust and import public GPG key for
        the repository.

    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
    URL can only be deleted if a ``mirrorlist`` is specified (or vice versa).

    CLI Examples:

    .. code-block:: bash

        salt '*' pkg.mod_repo alias alias=new_alias
        salt '*' pkg.mod_repo alias url= mirrorlist=http://host.com/
    uurlu
mirrorlistubaseurluPRepository '{0}' not found, and neither 'baseurl' nor 'mirrorlist' was specifieduFRepository '{0}' not found and URL for baseurl/mirrorlist is malformedR�tschemetnetlocRu/tparamstquerytfragmentu)Repository '{0}' already exists as '{1}'.uaruQFailed add new repository '{0}' for unspecified reason. Please check zypper logs.ucacheuenabledu--enableu	--disableurefreshu	--refreshu--no-refreshu--keep-packagesu--no-keep-packagesugpgchecku
--gpgchecku
--no-gpgcheckupriorityu--priority={0}u	humannameu--name='{0}'u
gpgautoimportu--gpg-auto-import-keysumru:Specified arguments did not result in modification of repoucommentN(R�RRR
R	Rat	_urlparseR	RRtParseResultR
RRR
R�R�R�R,tupdateR�Rtmod_repoRHtDEFAULT_PRIORITYtrefreshableRLR(RR*R�taddedturlR�t	repo_metatnew_urltbase_urlt	repo_infotcmd_opttglobal_cmd_opttcall_refreshtcommenttrefresh_opts((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyR�s�(	'						


   %"
		
cC@stjjjt�i}tjjdd�}x�|j�D]�}|sMq;n|j	�j
d�r�d|kr�y6|jd�dj	�}d|kr�t||<nWqt
k
r�q;qXq;|j	�j
d�r;d|kr;|jd�dj	�}d|krt||<qq;q;W|S(	u�
    Force a repository refresh by calling ``zypper refresh --force``, return a dict::

        {'<database name>': Bool}

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.refresh_db
    urefreshu--forceu
Repositoryu'iu
is up to dateuBuildingudone(RRR�t
clear_rtagt__opts__R�RR�R�RGR�R�Rt
IndexErrorR,(R�toutR�R�((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyR�{s$
!

!c	"
K@sc|rt�ny#td||||	�\}
}Wntk
rT}t|��nX|
d%ksst|
�dkrwiStt�||�}
|
r�|d%kr�|d%kr�i|
|6}
q�tj	d�n|dkr�g}xt
j|
�D]�\}}
|
d%kr$tjd|�|j
|�q�tjjj|
�\}}|sNd}ndj|||�}tjd|�|j
|�q�Wnf|dkr�g}t�}xH|
D]7}||kr�td	j|���q�|j
|�q�Wn|
}|	jd
�}|std|�nt�}g}|rKdd
d|g}tjd|�nd}ddg}|j
|	jd�rxdp{d�|s�|jdd�n|r�|jdd�n|r�|j
d�n|r�|j|�ng}|dkrg|D]}dj|�^q�}nt�}x�|r�||d }|d}x]td|d|�j|�j�D]7}tjd|�}|rc|j
|jd��qcqcWq Wx?|r�|dg|d }|d}td|�j|�q�Wt �|std|�nt�} tjj!j"|| �}!|r_tdj|r<d nd!�d"i|d#6|!d$6��n|!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 zypper 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 force a 'zypper refresh'
    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.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.install <package name>

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

    fromrepo
        Specify a package repository to install from.

    downloadonly
        Only download the packages, do not install.

    skip_verify
        Skip the GPG verification check (e.g., ``--no-gpg-checks``)

    version
        Can be either a version number, or the combination of a comparison
        operator (<, >, <=, >=, =) and a version number (ex. '>1.2.3-4').
        This parameter is ignored if ``pkgs`` or ``sources`` is passed.

    resolve_capabilities
        If this option is set to True zypper will take capabilities into
        account. In this case names which are just provided by a package
        will get installed. Default is False.

    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. As with the ``version`` parameter above, comparison operators
        can be used to target a specific version of a package.

        CLI Examples:

        .. code-block:: bash

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

    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"}]'

    ignore_repo_failure
        Zypper returns error code 106 if one of the repositories are not available for various reasons.
        In case to set strict check, this parameter needs to be set to True. Default: False.

    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 is specified in ``diff_attr``, 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_targetsiu@"version" parameter will be ignored for multiple package targetsu
repositoryutargeting package: %su=u	{0}{1}{2}uadvisoryuAdvisory id "{0}" not foundu	diff_attrR�u--forceu--force-resolutionu--fromuTargeting repo '%s'uuinstallu--auto-agree-with-licensesuresolve_capabilitiesu--capabilityu--nameu--no-refreshu--no-gpg-checksu--download-onlyu	patch:{0}i�tno_repo_failuret
systemd_scopeu2^The selected package '([^']+)'.+has lower versioniu"Problem encountered {0} package(s)udownloadingu
installingR>uerrorsuchangesN(#R�R[R
R	RLRjRxR�R=R@RR�RZRHRRR�tsplit_comparisonRatlist_patchesR
R�tlist_downloadedR>tinsertRXR�R�R�R�tmatchtgroupR�Rqt
compare_dicts("RyR�R�tpkgstsourcestdownloadonlytskip_verifyRztignore_repo_failureR*t
pkg_paramstpkg_typetexctversion_numR�tparamtprefixtverstrR�tcur_patchestadvisory_idt	diff_attrtoldt
downgradestfromrepoopttcmd_installterrorsttR$RoR�R)tnewR�((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytinstall�s��
#		
"%		
+!	
c
K@s�|rdgndgdg}|r8|jdd�n|rHt�n|r^|jd�n|r$|r�x!|D]}|jd|g�qqWtjd|�n|r�td	dd
kr�|jd�tjd�q�tjd
�n|r$tjd�tdt	��j
j|dg�q$nt�}	tdt	��j
j|�t
�t�}
tjjj|	|
�}tjtjkr�itjd6tjd6tjd6tjd6}tddi|d6|d6��n|r�tjtjtjj�}n|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 zypper 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

    Run a full system upgrade, a zypper upgrade

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

    dryrun
        If set to True, it creates a debug solver log file and then perform
        a dry-run upgrade (no changes are made). Default: False

    dist_upgrade
        Perform a system dist-upgrade. Default: False

    fromrepo
        Specify a list of package repositories to upgrade from. Default: None

    novendorchange
        If set to True, no allow vendor changes. Default: False

    skip_verify
        Skip the GPG verification check (e.g., ``--no-gpg-checks``)

    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 dist-upgrade=True fromrepo='["MyRepoName"]' novendorchange=True
        salt '*' pkg.upgrade dist-upgrade=True dryrun=True
    udist-upgradeuupdateu--auto-agree-with-licensesiu--no-gpg-checksu	--dry-runu--fromuTargeting repos: %suosrelease_infoiu--no-allow-vendor-changeuDisabling vendor changesu@Disabling vendor changes is not supported on this Zypper versionu;Executing debugsolver and performing a dry-run dist-upgradeR$u--debug-solveruretcodeustdoutustderrupidu&Problem encountered upgrading packagesR>uchangesuresult(R(R�RHRXR=R>RR@R�R�tnoraiseR�R�R�RRRqR+R1R<R9R:R;R	R5R6RG(
R�tdryruntdist_upgradeR�tnovendorchangeR/R*t
cmd_updateRR;RAR�tresult((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytupgrade�sJ<



)		



 c
C@seytd||�d}Wntk
r<}t|��nXt�}g}xz|D]r}||kr�||||jd�kr�|j|d||�qS||krS||rS|j|�qSqSW|s�iSt�}g}x1|rtd|�jd|d �|d}q�Wt	�t
jjj
|t��}	|ratdd	i|d
6|	d6��n|	S(u
    Remove and purge do identical things but with different Zypper commands,
    this function performs the common logic.
    upkg_resource.parse_targetsiu,u-R$uremovei�u'Problem encountered removing package(s)R>uerrorsuchanges(R[R
R	R�R�RHR�R�R�R�RRRqR+(
RyR,R1R3R;R�R�R$R?R�((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt
_uninstall�s2	
)		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����unoarchuosarchR�(unoarch(
trsplitRRR�R�tARCHESR�Rtcheck_32Rj(RyR�((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytnormalize_name&s
"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 zypper 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 with ``zypper -n remove``

    name
        The name of the package to be deleted.


    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"]'
    RyR,(RJ(RyR,R*((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytremove@s)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 zypper 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

    Recursively remove a package and all dependencies which were installed
    with it, this will call a ``zypper -n remove -u``

    name
        The name of the package to be deleted.


    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"]'
    RyR,(RJ(RyR,R*((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytpurgels*c	
C@s3i}tjjt�r/tjjjt���}tjjj	|j
��jd�}x�g|D]}|jd�^q^D]�}i}xwg|D]}|r�|^q�D]V}d|kr�|jt
tg|jdd�D]}|j�^q��g��q�q�W|jd�rw|||jd�<qwqwWWdQXn|S(uQ
    List current package locks.

    Return a dict containing the locked package with attributes::

        {'<package>': {'case_sensitive': '<case_sensitive>',
                       'match_type': '<match_type>'
                       'type': '<type>'}}

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.list_locks
    u

u
u:iu
solvable_nameN(R5RR\tLOCKSRRR^R_Rlt
to_unicodeR�R�RRttupleRGR
R�(	tlockstfhrR�R/Rtlockteltelementti((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt
list_locks�s$)&H#cC@s�d}id|6}tjjd�s)|Sxctjjd�jd�D]F}|jdjj	�}|j
|�rE|jd�d||<PqEqEW|S(u�
    Remove unused locks that do not currently (with regard to repositories
    used) lock any package.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.clean_locks
    uremovediu/etc/zypp/locksuclumessageu i(R5RR\R�R�R�RMRORPR�R�R�(tLCKR"RUttext((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytclean_locks�s
"cK@s�t�}y$ttd|�dj��}Wntk
rN}t|��nXg}g}x:|D]2}|j|�r�|j|�qb|j|�qbW|r�tj	d|�nit
|�d6|d6S(u�
    Remove specified package lock.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.remove_lock <package name>
        salt '*' pkg.remove_lock <package1>,<package2>,<package3>
        salt '*' pkg.remove_lock pkgs='["foo", "bar"]'
    upkg_resource.parse_targetsiurluremovedu	not_found(RZRFR[tkeysR
R	R
RHR�R�Rj(tpackagesR*RTR3tremovedtmissingR�((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytremove_lock�s
	$
cK@s�t�}g}y$ttd|�dj��}Wntk
rT}t|��nXx-|D]%}|j|�s\|j|�q\q\W|r�tj	d|�nit
|�d6|d6S(u
    Add a package lock. Specify packages to lock by exact name.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.add_lock <package name>
        salt '*' pkg.add_lock <package1>,<package2>,<package3>
        salt '*' pkg.add_lock pkgs='["foo", "bar"]'
    upkg_resource.parse_targetsiualuaddedupackages(RZRFR[R^R
R	R
RHR�R�Rj(R_R*RTRR3R�((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytadd_lock�s	$
cO@std||�S(u�
    Runs an rpm -Va on a system, and returns the results in a dict

    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']
    u
lowpkg.verify(R[(R�R*((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytverifyscG@std|�S(uR
    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(R[(R_((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt	file_list"scG@std|�S(uf
    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(R[(R_((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt	file_dict3scO@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(R[(R_tflags((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytmodifiedDs.cG@std|�S(u)
    Return the name of the package that owns the file. Multiple file paths can
    be passed. 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
    ulowpkg.owner(R[(tpaths((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytowneruscC@s�i}x�tjjjddd�jd�D][}|jd�dk}|rR|sY|r+i|d6|jd�d6||jd�<q+q+W|S(	u+
    List all known patterns in repos.
    useu-tupatternusolvableustatusu	installedusummaryuname(R�R�R�R�RMRN(tinstalled_onlytpatternsRXt	installed((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt
_get_patterns�s+'cC@s|rt�nt�S(u
    List all known patterns from available repos.

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

    CLI Examples:

    .. code-block:: bash

        salt '*' pkg.list_patterns
    (R�Rn(R�((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt
list_patterns�s
cC@s
tdt�S(u�
    List installed patterns on the system.

    CLI Examples:

    .. code-block:: bash

        salt '*' pkg.list_installed_patterns
    Rk(RnR,(((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytlist_installed_patterns�s
cK@s�idd6dd6dd6dd6d	d
6dd6d
d6dd6dd6dd6dd6dd6}|rjt�ndg}|jd�dkr�|jd�nJ|jd�dkr�|jd�n%|jd�dkr�|jd �nx3|D]+}||kr�|j|j|��q�q�W|j|�tjjjj|�jd!�}|sdt	d"j
|���ni}x[|D]S}t�||jd#�<x4|j
j�D]#\}	}
|
||jd#�|	<q�WqqW|S($u�
    List known packags, available to the system.

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

    match (str)
        One of `exact`, `words`, `substrings`. Search for an `exact` match
        or for the whole `words` only. Default to `substrings` to patch
        partial words.

    provides (bool)
        Search for packages which provide the search strings.

    recommends (bool)
        Search for packages which recommend the search strings.

    requires (bool)
        Search for packages which require the search strings.

    suggests (bool)
        Search for packages which suggest the search strings.

    conflicts (bool)
        Search packages conflicting with search strings.

    obsoletes (bool)
        Search for packages which obsolete the search strings.

    file_list (bool)
        Search for a match in the file list of packages.

    search_descriptions (bool)
        Search also in package summaries and descriptions.

    case_sensitive (bool)
        Perform case-sensitive search.

    installed_only (bool)
        Show only installed packages.

    not_installed_only (bool)
        Show only packages which are not installed.

    details (bool)
        Show version and repository

    CLI Examples:

    .. code-block:: bash

        salt '*' pkg.search <criteria>
    u
--providesuprovidesu--recommendsu
recommendsu
--requiresurequiresu
--suggestsusuggestsu--conflictsu	conflictsu--obsoletesu	obsoletesu--file-listu	file_listu--search-descriptionsusearch_descriptionsu--case-sensitiveucase_sensitiveu--installed-onlyuinstalled_onlyu-uunot_installed_onlyu	--detailsudetailsusearchumatchuexactu
--match-exactuwordsu
--match-wordsu
substringsu--match-substringsusolvableu No packages found matching '{0}'uname(R�R
RHR�R�RCR�R�RMR	RaRRNR�R�(tcriteriaR�R*tALLOWED_SEARCH_OPTIONSRotoptR�R"tsolvabletktv((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytsearch�sH8

	

!
cC@s]|s
dSg}x=|djD].}|jtjjkr|j|j�qqWdj|�S(u=
    Extract text from the first occurred DOM aggregate.
    uiu
(ROtnodeTypeRItDocumentt	TEXT_NODERHRPR7(t	node_listR"RU((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt_get_first_aggregate_text sc
C@sN|rt�nt�}d}t�}|s>|jd�n|jd�|sa|jd�ntjjj|�jd�}|s�|Sx�|djd�D]�}t�}xU|j	j
�D]D\}}	|dkr�t|	dk�||<q�|	r�|	||<q�q�W|jd�}
|
rV|
djd
�|d<t
|
djd�pId�|d<ndjgt|jd��jtj�D]}|j�^q~�|d<d|kr9|dr9tjj||d�}tjj|�r9tjjj|d��;}
tjjj|
j��j�}|r-||d<nWdQXq9n|j|�q�W|S(u
    List all available or installed SUSE products.

    all
        List all products available or only installed. Default is False.

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

    Includes handling for OEM products, which read the OEM productline file
    and overwrite the release value.

    CLI Examples:

    .. code-block:: bash

        salt '*' pkg.list_products
        salt '*' pkg.list_products all=True
    u/var/lib/suseRegister/OEMu--disable-reposuproductsu-iuproduct-listiuproductuisbaseu	installedutrueu1u	endoflifeutextueolutime_tueol_tu udescriptionuproductlineurureleaseN(uisbaseu	installed(utrueu1(R�RFRHR�R�R�R�RMRR�R�tboolRNR2R7R|R�R5R6RGRtisfileRRR^R_RlRRR`(tallR�R�tOEM_PATHRotproduct_listtprdtp_nfotk_p_nfotv_p_nfoteolR�toem_filetrfiletoem_release((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt
list_products.sJ
		
	&)!cO@sn|std��n|jdt�}|r7t�ni}x�tjjd|�jd�D]�}|jd�d}|jd�djd�}i|jd	�d
6|jd�d6|d6}t	|jd	��}t
d
|d�r\|||<q\q\W|rLg|D]}	|	|kr|	^q}
|
rHdjdj|
��|d<n|St
djdj|����dS(u9
    Download packages to the local disk.

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

    CLI example:

    .. code-block:: bash

        salt '*' pkg.download httpd
        salt '*' pkg.download httpd postfix
    uNo packages specifiedurefreshudownloadudownload-resultu
repositoryiu	localfileupathunameurepository-nameualiasurepository-aliasulowpkg.checksumu0The following package(s) failed to download: {0}u, u_erroru Unable to download packages: {0}N(RR
RR�R�R�R�RMRNR|R[RaR7R	(R_R*R�tpkg_rett
dld_resultRRR�R�R�tfailed((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytdownloadqs0
%
%c	C@s�d}i}x�tjjj|�D]�\}}}x�tj|d�D]�}tjj||�}td|�}t	tjj
|��}i|d6tjj|�d6|d6tjj
|�j�d6|j|di�|d	<qDWq"W|S(
u�
    .. versionadded:: 2017.7.0

    List prefetched packages downloaded by Zypper in the local disk.

    CLI example:

    .. code-block:: bash

        salt '*' pkg.list_downloaded
    u/var/cache/zypp/packages/u*.rpmulowpkg.bin_pkg_infoupathusizeucreation_date_time_tucreation_date_timeunameuversion(RRRtos_walkR�tfilterR5R7R[R2tgetctimetgetsizeRbRcRdR�(	t	CACHE_DIRR�troottdirnamest	filenamestfilenametpackage_pathR�t
pkg_timestamp((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyR'�s%<c	G@si}i}x||D]t}td|�}|sTtjj|�rGdpJd||<q|j|�dkrvg||<n||j|�qW|rtd|j��}xVtj	|�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(
R[R5RR\R
RLRHR^RR�(	RiR�tpkg_to_pathstpthtpth_pkgt
local_pkgsR�R^R((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytdiff�s$
%

	cC@s�i}x�tjjjddd�jd�D][}|jd�dk}|rR|sY|r+i|d6|jd�d6||jd�<q+q+W|S(	u*
    List all known patches in repos.
    useu-tupatchusolvableustatusu	installedusummaryuname(R�R�R�R�RMRN(RktpatchesRXRm((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt_get_patches�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 zypper if a refresh is
        executed.

    CLI Examples:

    .. code-block:: bash

        salt '*' pkg.list_patches
    (R�R�(R�((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyR&�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
    Rk(R�R,(((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytlist_installed_patches
	scK@s�tjd�}|s�ddddg}t�}x~td|ddd	t�j�D]Z}|jd
�\}}||kr�qSn||kr�t�||<n||j|�qSW|td<n|S(u�
    .. versionadded:: 2018.3.0

    List package provides of installed packages as a dict.
    {'<provided_name>': ['<package_name>', '<package_name>', ...]}

    CLI Examples:

    .. code-block:: bash

        salt '*' pkg.list_provides
    upkg.list_providesurpmu-qau
--queryformatu%{PROVIDES}_|-%{NAME}
ucmd.runR�utraceR�u_|-(	R�R
RR[RR�R�RFRH(R*R�RoR�tprovidetrealname((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt
list_provides	s
	)
c	K@sc|rt�nt�}xC|D];}t|t�rTtt|��}||}n|}d}|jdt�r1yt	|dd�Wq1t
k
r-ynt	|dtdd�}t|�dkr�tt|j
���}n%t|�dkrtjd|�nWq.t
k
r)}tjd|�q.Xq1Xn|rN|ji||6�q |j|�q W|S(	u�
    .. versionadded:: 2018.3.0

    Convert name provides in ``pkgs`` into real package names if
    ``resolve_capabilities`` parameter is set to True. In case of
    ``resolve_capabilities`` is set to False the package list
    is returned unchanged.

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

    resolve_capabilities
        If this option is set to True the input will be checked if
        a package with this name exists. If not, this function will
        search for a package which provides this name. If one is found
        the output is exchanged with the real package name.
        In case this option is set to False (Default) the input will
        be returned unchanged.

    CLI Examples:

    .. code-block:: bash

        salt '*' pkg.resolve_capabilities resolve_capabilities=True w3m_ssl
    uresolve_capabilitiesR)uexacttprovidesiu*Found ambiguous match for capability '%s'.uSearch failed with: %sN(R�RFR�RtnexttiterRLR
RRwR	R,RjR^R=R@RZRH(	R,R�R*R�R�RyRzRHR3((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pytresolve_capabilities;	s2
	


(nRut
__future__RRRR�tloggingR�R5RhRbtsalt.extRtsalt.ext.six.movesRtsalt.ext.six.moves.urllib.parseRRtxml.domRRItxml.parsers.expatRtsalt.utils.dataRtsalt.utils.eventtsalt.utils.filestsalt.utils.functoolstsalt.utils.pathtsalt.utils.pkgtsalt.utils.pkg.rpmtsalt.utils.stringutilstsalt.utils.systemdtsalt.utils.versionsRtsalt.utils.environmenttsalt.exceptionsR	R
Rt	getLoggerRsR=RtHAS_ZYPPt	ZYPP_HOMERaRQR�RRRtobjectRR�RxR�R�R,R�Rt	functoolstalias_functiontlist_updatesR�R�R�tavailable_versionR�RzR�R�R�R�RLRRRRRR�RBRIRJRNRORPRZR]RbRcRdReRfRhRjRnRoRpRwR|R�R�R'R�R�R&R�R�R�(((s:/usr/lib/python2.7/site-packages/salt/modules/zypperpkg.pyt<module>
s�	�	P		!	9	8	,		a	u		
			�	"�o)	,-			!					1		
e	C	1		'		

Zerion Mini Shell 1.0