%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/win_pkg.pyo

�
���^c@@s�dZddlmZmZmZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZddlmZddlmZddlmZmZmZddlZddlZddlZddlZddlZddlZddlZddl Zddl!Zddl"Zddl#Zddlm$Z$dd	l m%Z%ej&e'�Z(d
Z)d�Z*d�Z+d
�Z,e-d�Z.d�Z/d�Z0e1e-e-d�Z2e-e-d�Z3d�Z4d�Z5d�Z6d�Z7d�Z8d�Z9d�Z:e;e1e;d�Z<d�Z=e;e;d�Z>e;e;d�Z?dd�Z@dd �ZAdd!�ZBd"�ZCd#�ZDd$d%d$d&�ZEdS('u�
A module to manage software on Windows

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

The following functions require the existence of a :ref:`windows repository
<windows-package-manager>` metadata DB, typically created by running
:py:func:`pkg.refresh_db <salt.modules.win_pkg.refresh_db>`:

- :py:func:`pkg.get_repo_data <salt.modules.win_pkg.get_repo_data>`
- :py:func:`pkg.install <salt.modules.win_pkg.install>`
- :py:func:`pkg.latest_version <salt.modules.win_pkg.latest_version>`
- :py:func:`pkg.list_available <salt.modules.win_pkg.list_available>`
- :py:func:`pkg.list_pkgs <salt.modules.win_pkg.list_pkgs>`
- :py:func:`pkg.list_upgrades <salt.modules.win_pkg.list_upgrades>`
- :py:func:`pkg.remove <salt.modules.win_pkg.remove>`

If a metadata DB does not already exist and one of these functions is run, then
one will be created from the repo SLS files that are present.

As the creation of this metadata can take some time, the
:conf_minion:`winrepo_cache_expire_min` minion config option can be used to
suppress refreshes when the metadata is less than a given number of seconds
old.

.. note::
    Version numbers can be ``version number string``, ``latest`` and ``Not
    Found``, where ``Not Found`` means this module was not able to determine
    the version of the software installed, it can also be used as the version
    number in sls definitions file in these cases. Versions numbers are sorted
    in order of 0, ``Not Found``, ``order version numbers``, ..., ``latest``.

i(tabsolute_importtprint_functiontunicode_literalsN(t
cmp_to_key(tsix(turlparse(tCommandExecutionErrortSaltInvocationErrortSaltRenderError(tMinionError(tLooseVersionupkgcC@s tjjj�rtStdfS(u9
    Set the virtual pkg module if the os is Windows
    u4Module win_pkg: module only works on Windows systems(tsalttutilstplatformt
is_windowst__virtualname__tFalse(((s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pyt__virtual__Psc
	O@s�|s
dSi}x|D]}d||<qW|jdd�}tjjj|jdt��}tdtd|d|�}tjd|�x@|D]8}d	}||krtjd
|�y&t	||dt
t��j�}Wn!t
k
rtjd|�qXtjd
||�nt|d|�}tjd||�t|�}	|	r�tjd||	�tdtj|	�dddtj|��r�tjd|||	�|	||<q�tjd||�q�q�Wt|�dkr�||dS|S(u
    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.

    Args:
        names (str): A single or multiple names to lookup

    Kwargs:
        saltenv (str): Salt environment. Default ``base``
        refresh (bool): Refresh package metadata. Default ``True``

    Returns:
        dict: A dictionary of packages with the latest version available

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.latest_version <package name>
        salt '*' pkg.latest_version <package1> <package2> <package3> ...
    uusaltenvubaseurefreshtversions_as_listtsaltenvtrefreshuList of installed packages: %su0u*Determining latest installed version of %stkeyuN%s was empty in pkg.list_pkgs return data, this is probably a bug in list_pkgsu$Latest installed version of %s is %su!Raw winrepo pkg_info for %s is %su,Latest available version of package %s is %stver1toperu>tver2u(Upgrade of %s from %s to %s is availableu+No newer version than %s of %s is availableii(tgetRRtdatatis_truetTruet	list_pkgstlogttracetsortedRt_reverse_cmp_pkg_versionstpopt
IndexErrortwarningtdebugt_get_package_infot_get_latest_pkg_versiontcompare_versionsRt	text_typetlen(
tnamestkwargstrettnameRRtinstalled_pkgstlatest_installedtpkg_infotlatest_available((s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pytlatest_versionYsX
!


	



cK@sO|jdd�}tjjj|jdt��}t|d|d|�dkS(u�
    Check whether or not an upgrade is available for a given package

    Args:
        name (str): The name of a single package

    Kwargs:
        refresh (bool): Refresh package metadata. Default ``True``
        saltenv (str): The salt environment. Default ``base``

    Returns:
        bool: True if new version available, otherwise False

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.upgrade_available <package name>
    usaltenvubaseurefreshRRu(RRRRRRR3(R.R,RR((s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pytupgrade_available�s!cK@s�|jdd�}tjjj|�}t|d|�tdtd|�}t|�jd�}i}xH|D]@}||krnt	|dtd|�}|r�|||<q�qnqnW|S(un
    List all available package upgrades on this system

    Args:
        refresh (bool): Refresh package metadata. Default ``True``

    Kwargs:
        saltenv (str): Salt environment. Default ``base``

    Returns:
        dict: A dictionary of packages with available upgrades

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.list_upgrades
    usaltenvubasetforceRRurepo(
RRRRRt_refresh_db_conditionalRRt
get_repo_dataR3(RR,RR/tavailable_pkgstpkgstpkgt
latest_ver((s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pyt
list_upgrades�s
c	O@sA|s
dS|jdd�}tjjj|jdt��}t|d|�tjjj|jdt��}t|�dkr�|r�t|dd	|�}|s�dSt	t
|j��d
tt
��}noi}xf|D]^}t|d	|�}|s�q�nt	|rt
|j��ngd
tt
��}|||<q�W|S(u�
    Return a list of available versions of the specified package.

    Args:
        names (str): One or more package names

    Kwargs:

        saltenv (str): The salt environment to use. Default ``base``.

        refresh (bool): Refresh package metadata. Default ``False``.

        return_dict_always (bool):
            Default ``False`` dict when a single package name is queried.

    Returns:
        dict: The package name with its available versions

    .. code-block:: cfg

        {'<package name>': ['<version>', '<version>', ]}

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.list_available <package name> return_dict_always=True
        salt '*' pkg.list_available <package name01> <package name02>
    uusaltenvubaseurefreshR5ureturn_dict_alwaysiiRR(RRRRRRR6R*R&R tlisttkeysRR!(	R+R,RRtreturn_dict_alwaystpkginfotversionsR.tverlist((s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pytlist_availables.!!
cO@s�|jdd�}td|d|jdt��}t|�dkrY|j|dd�Si}x$|D]}|j|d�||<qfW|S(	u2
    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.

    Args:
        name (str): One or more package names

    Kwargs:
        saltenv (str): The salt environment to use. Default ``base``.
        refresh (bool): Refresh package metadata. Default ``False``.

    Returns:
        str: version string when a single package is specified.
        dict: The package name(s) with the installed versions.

    .. code-block:: cfg

        {['<version>', '<version>', ]} OR
        {'<package name>': ['<version>', '<version>', ]}

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.version <package name>
        salt '*' pkg.version <package name01> <package name02>

    usaltenvubaseRRurefreshiiu(RRRR*(R+R,RR/R-R.((s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pytversion=s&!
cK@s�tjjj|�}tgdD]$}tjjj|j|��^q�rPiS|jdd�}tjjj|jdt��}t|d|�i}t|�}x�t	j
td|d|��D]�\}	}
|	|kro||	}x�|
D]{}|d	krTt|d
|�}
|
sq�nx4|
j
�D]#}|
|d|	kr*|}q*q*Wntd|||�q�Wq�|	}x"|
D]}td|||�q|Wq�Wtd
|�|s�td|�n|S(u�
    List the packages currently installed.

    .. note::
        To view installed software as displayed in the Add/Remove Programs, set
        ``include_components`` and ``include_updates`` to False.

    Args:

        versions_as_list (bool):
            Returns the versions as a list

        include_components (bool):
            Include sub components of installed software. Default is ``True``

        include_updates (bool):
            Include software updates and Windows updates. Default is ``True``

    Kwargs:

        saltenv (str):
            The salt environment to use. Default ``base``

        refresh (bool):
            Refresh package metadata. Default ``False``

    Returns:
        dict: A dictionary of installed software with versions installed

    .. code-block:: cfg

        {'<package_name>': '<version>'}

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.list_pkgs
        salt '*' pkg.list_pkgs versions_as_list=True
    uremovedu
purge_desiredusaltenvubaseurefreshR5tinclude_componentstinclude_updatesu	Not FoundRu	full_nameupkg_resource.add_pkgupkg_resource.sort_pkglistupkg_resource.stringify(uremovedu
purge_desired(RRRRtanyRRR6t
_get_name_mapRt	iteritemst_get_reg_softwareR&R>t__salt__(RRERFR,txRRR-tname_maptpkg_nametval_listRtvalR1tpkg_ver((s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pyRos<,1!	


c
@s�i��fd�}d�}d�}�fd�}d�}��fd�}idd6d	d
6td6}x�tdd
|dd|d
�D]t}	|	|d<||�r�q�n||�r�q�n||�r�q�n||�r�q�n||�r�q�n||�q�Wt|d<x�tdd
|dd|d
d|d�D]t}	|	|d<||�r^q<n||�rpq<n||�r�q<n||�r�q<n||�r�q<n||�q<Widd6dd
6td6}d}
x�tdd
|dd|d
�D]m}	tdd
|dddj|
|	��s,q�n|	|d<||�rHq�n||�rZq�n||�q�Wd}d}d}
d}xttdd
|�D]_}i|d6|j|�d
6td6}x�tdd
|dd|d
�D]t}	|	|d<||�rq�n||�rq�n||�r&q�n||�r8q�n||�rJq�n||�q�Wx�tdd
|d|
j|��D]t}	idd6|j||	�d
6dd6td6}tdd
|dd|d
�r{||�r�q{n||�q{q{Wq�Wx�tdd
|dt�D]y}i|d6|j|�d
6td6}x�tdd
|dd|d
d|d�D]t}	|	|d<||�r�qgn||�r�qgn||�r�qgn||�r�qgn||�r�qgn||�qgWx�tdd
|d|
j|�dt�D]~}idd6|j||�d
6dd6td6}tdd
|dd|d
d|d�r||�ryqn||�qqWqW�S(u<
    This searches the uninstall keys in the registry to find a match in the sub
    keys, it will return a dict with the display name as the key and the
    version as the value

    Args:

        include_components (bool):
            Include sub components of installed software. Default is ``True``

        include_updates (bool):
            Include software updates and Windows updates. Default is ``True``

    Returns:
        dict: A dictionary of installed software with versions installed

    .. code-block:: cfg

        {'<package_name>': '<version>'}
    c	@s��r
tStdd|ddj||�ddd|�r}tdd|ddj||�ddd|�d	d
kr}tSntS(u2
        'SystemComponent' must be either absent or present with a value of 0,
        because this value is usually set on programs that have been installed
        via a Windows Installer Package (MSI).

        Returns:
            bool: True if the package needs to be skipped, otherwise False
        ureg.value_existsthiveRu{0}\{1}tvnameuSystemComponenttuse_32bit_registryureg.read_valueuvdatai(Rt	__utils__tformatR(RRRtsub_keyt	use_32bit(RE(s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pytskip_component�s	
	
c	S@s�d}tdd|ddj||�ddd|�r�td	d|ddj||�ddd|�d
dkr�tjjj|�}tddd
d|j|�d|�s�tSq�ntS(u�
        'WindowsInstaller' must be either absent or present with a value of 0.
        If the value is set to 1, then the application is included in the list
        if and only if the corresponding compressed guid is also present in
        HKLM:\Software\Classes\Installer\Products

        Returns:
            bool: True if the package needs to be skipped, otherwise False
        u'Software\Classes\Installer\Products\{0}ureg.value_existsRRRu{0}\{1}RSuWindowsInstallerRTureg.read_valueuvdataiureg.key_existsuHKLM(RURVRRt
win_functionst
guid_to_squidRR(RRRRWRXtproducts_keytsquid((s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pytskip_win_installer�s$

	

	
c	S@s9tdd|ddj||�ddd|�s5tStS(u
        'UninstallString' must be present, because it stores the command line
        that gets executed by Add/Remove programs, when the user tries to
        uninstall a program.

        Returns:
            bool: True if the package needs to be skipped, otherwise False
        ureg.value_existsRRRu{0}\{1}RSuUninstallStringRT(RURVRR(RRRRWRX((s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pytskip_uninstall_strings	
	c	@s��r
tSdddg}tdd|ddj||�dd	d
|�r�tdd|ddj||�dd	d
|�d|kr�tSntS(
u<
        'ReleaseType' must either be absent or if present must not have a
        value set to 'Security Update', 'Update Rollup', or 'Hotfix', because
        that indicates it's an update to an existing program.

        Returns:
            bool: True if the package needs to be skipped, otherwise False
        uHotfixuSecurity Updateu
Update Rollupureg.value_existsRRRu{0}\{1}RSuReleaseTypeRTureg.read_valueuvdata(RRURVR(RRRRWRXt
skip_types(RF(s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pytskip_release_type"s"		
	
c	S@s9tdd|ddj||�ddd|�r5tStS(u�
        'ParentKeyName' must NOT be present, because that indicates it's an
        update to the parent program.

        Returns:
            bool: True if the package needs to be skipped, otherwise False
        ureg.value_existsRRRu{0}\{1}RSu
ParentKeyNameRT(RURVRR(RRRRWRX((s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pytskip_parent_key=s
	c@sStdd|ddj||�ddd|�}|dse|d	dkse|dd
dtgkridS|d}�s�tjd|�r�dSntdd|ddj||�ddd|�}d}|dr6|d	dkr6t|dt�rtj	|d�}q6|dr6|dd
kr6|d}q6n�j
|g�j|�dS(u
        'DisplayName' must be present with a valid value, as this is reflected
        as the software name returned by pkg.list_pkgs. Also, its value must
        not start with 'KB' followed by 6 numbers - as that indicates a
        Windows update.
        ureg.read_valueRRRu{0}\{1}RSuDisplayNameRTusuccessuvtypeuREG_SZu
REG_EXPAND_SZuvdatau(value not set)Nu^KB[0-9]{6}uDisplayVersionu	Not Foundu	REG_DWORD(uREG_SZu
REG_EXPAND_SZ(uREG_SZu
REG_EXPAND_SZu	REG_DWORD(RURVtNoneRtretmatcht
isinstancetintRR)t
setdefaulttappend(RRRRWRXtd_name_regdatatd_nametd_vers_regdatatd_vers(RFtreg_software(s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pytadd_softwareNs4
	

	
uHKLMuhiveu3Software\Microsoft\Windows\CurrentVersion\Uninstallukeyu	use_32bitu
reg.list_keysRRRusub_keyRTu#Software\Classes\Installer\ProductsuNSoftware\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Productsureg.key_existsu{0}\{1}uHKUu7{0}\Software\Microsoft\Windows\CurrentVersion\Uninstallu){0}\Software\Microsoft\Installer\ProductsuMSoftware\Microsoft\Windows\CurrentVersion\Installer\UserData\{0}\Products\{1}uInstallProperties(RRURRV(RERFRYR^R_RaRbRoR,RWtuserdata_keythive_hkut
uninstall_keytproduct_keyt
user_data_keyt	user_guidt	sub_key_2((RERFRns8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pyRJ�s�			)







(


















c	K@sotjjj|jdt��}tjjj|jdt��}td}td}t|�}|r�|dkr�|j|kr�t	j
d|j|�t}n|s�|jdks�|j|kr�tnt}|s�t	jd|t
jd	|j��tS|jdkr t	jd
|�ntd|dtd
|�}yt|jdd��SWntk
rjtSXdS(u�
    Internal use only in this module, has a different set of defaults and
    returns True or False. And supports checking the age of the existing
    generated metadata db, as well as ensure metadata db exists to begin with

    Args:
        saltenv (str): Salt environment

    Kwargs:

        force (bool):
            Force a refresh if the minimum age has been reached. Default is
            False.

        failhard (bool):
            If ``True``, an error will be raised if any repo SLS files failed to
            process.

    Returns:
        bool: True Fetched or Cache uptodate, False to indicate an issue

    :codeauthor: Damon Atkins <https://github.com/damon-atkins>
    uforceufailharduwinrepo_cache_expire_maxuwinrepo_cache_expire_miniucRefresh skipped, age of winrepo metadata in seconds (%s) is less than winrepo_cache_expire_min (%s)i����u;Using existing pkg metadata db for saltenv '%s' (age is %s)tsecondsu:No winrepo.p cache file for saltenv '%s', creating one nowRtverbosetfailhardufailedN(RRRRR"Rt__opts__t_get_repo_detailstwinrepo_ageRtinfoRR%tdatetimet	timedeltat
refresh_dbtboolRtAttributeError(	RR,R5Rytexpired_maxtexpired_mintrepo_detailsRtresults((s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pyR6�s8!!

!
	

c	K@s�tjjjt�|jdd�}tjjj|jdt��}tjjj|jdt	��}t
jdd�t|�}t
jd|tjd|j��t
jd|j�g}x�tjjj|jd	t�D]�\}}}x�|D]�}	|	jd
�r�tjj||	�}
ytj|
�Wq|tk
rx}|jtjkryt
jd|
|�|j|
�qyq|Xq�q�Wq�W|r�tdd
i|d6��nt
jdj |j!��t"dd|j!d|dddd�t#d|d|d|�S(u

    Generates the local software metadata database (`winrepo.p`) on the minion.
    The database is stored in a serialized format located by default at the
    following location:

    ``C:\salt\var\cache\salt\minion\files\base\win\repo-ng\winrepo.p``

    This module performs the following steps to generate the software metadata
    database:

    - Fetch the package definition files (.sls) from `winrepo_source_dir`
      (default `salt://win/repo-ng`) and cache them in
      `<cachedir>\files\<saltenv>\<winrepo_source_dir>`
      (default: ``C:\salt\var\cache\salt\minion\files\base\win\repo-ng``)
    - Call :py:func:`pkg.genrepo <salt.modules.win_pkg.genrepo>` to parse the
      package definition files and generate the repository metadata database
      file (`winrepo.p`)
    - Return the report received from
      :py:func:`pkg.genrepo <salt.modules.win_pkg.genrepo>`

    The default winrepo directory on the master is `/srv/salt/win/repo-ng`. All
    files that end with `.sls` in this and all subdirectories will be used to
    generate the repository metadata database (`winrepo.p`).

    .. note::
        - Hidden directories (directories beginning with '`.`', such as
          '`.git`') will be ignored.

    .. note::
        There is no need to call `pkg.refresh_db` every time you work with the
        pkg module. Automatic refresh will occur based on the following minion
        configuration settings:

        - `winrepo_cache_expire_min`
        - `winrepo_cache_expire_max`

        However, if the package definition files have changed, as would be the
        case if you are developing a new package definition, this function
        should be called to ensure the minion has the latest information about
        packages available to it.

    .. warning::
        Directories and files fetched from <winrepo_source_dir>
        (`/srv/salt/win/repo-ng`) will be processed in alphabetical order. If
        two or more software definition files contain the same name, the last
        one processed replaces all data from the files processed before it.

    For more information see
    :ref:`Windows Software Repository <windows-package-manager>`

    Arguments:

    saltenv (str): Salt environment. Default: ``base``

    verbose (bool):
        Return a verbose data structure which includes 'success_list', a
        list of all sls files and the package names contained within.
        Default is 'False'

    failhard (bool):
        If ``True``, an error will be raised if any repo SLS files fails to
        process. If ``False``, no error will be raised, and a dictionary
        containing the full results will be returned.

    Returns:
        dict: A dictionary containing the results of the database refresh.

    .. note::
        A result with a `total: 0` generally means that the files are in the
        wrong location on the master. Try running the following command on the
        minion: `salt-call -l debug pkg.refresh saltenv=base`

    .. warning::
        When calling this command from a state using `module.run` be sure to
        pass `failhard: False`. Otherwise the state will report failure if it
        encounters a bad software definition file.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.refresh_db
        salt '*' pkg.refresh_db saltenv=base
    usaltenvubaseuverboseufailharduwinrepo.datauLRefreshing pkg metadata db for saltenv '%s' (age of existing metadata is %s)Rwu#Removing all *.sls files under '%s'tfollowlinksu.slsuFailed to remove %s: %su/Failed to clear one or more winrepo cache filesR}ufaileduFetching *.sls files from {0}ucp.cache_dirtpathRtinclude_patu*.slstexclude_patuE@\/\..*?\/RxRyN($RRR:t
clear_rtagRzR"RRRRt__context__RcR{RR%R~RR|R}t
local_destR�tos_walktendswithtostjointremovetOSErrorterrnotENOENTterrorRiRRVtwinrepo_source_dirRKtgenrepo(R,RRxRyR�tfailedtroott_tfilesR.t
full_filenametexc((s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pyR�Cs@V!!.

	c
C@s�dj|�}|tkr1t|\}}}n>td}tdd|g}t|�}|j|j�|j|jjd�j	d��t
jj|�}t
jj|d�}t
jdtdd	t
j�s�t
jj|td�}ntjd
td�t
jjdd�}tjjjd
|ddj|dg��s\tdj|���n|||ft|<yt
j|�Wn@tk
r�}|jtjkr�tdj||���q�nXd}	y,t
j|�}
|
j}tj�|}	Wn�tk
r7}|jtjkr{tdj||���q{nDt k
rWtj!d|
�n$t"k
rztj!d||�nXt#j$dd�}|||||	�S(uG
    Return repo details for the specified saltenv as a namedtuple
    uwinrepo._get_repo_details.{0}uwinrepo_source_dirucachedirufilesu/u	winrepo.pu[\/:*?"<>|]uwinrepo_cachefiletflagsu�minion configuration option 'winrepo_cachefile' has been ignored as its value (%s) is invalid. Please ensure this option is set to a valid filename.u
SystemRootu
C:\WindowsR�t
allow_pathu\uTEMPu?Attempting to delete files from a possibly unsafe location: {0}uFailed to create {0}: {1}i����uFailed to get age of {0}: {1}u$st_mtime missing from stat result %su#mtime of %s (%s) is an invalid typeuRepoDetailsu
local_destuwinrepo_fileuwinrepo_age(uwinrepo_source_diru
local_destuwinrepo_fileuwinrepo_age(%RVR�Rzt	_urlparseRitnetloctextendR�tstriptsplitR�tsepR�Rdtsearcht
IGNORECASERR�tenvironRRRt	safe_pathRtmakedirsR�R�tEEXISTtstattst_mtimettimeR�R�R$t	TypeErrortcollectionst
namedtuple(
Rt
contextkeyR�R�twinrepo_filetdirst	url_partstsystem_rootR�R|tstat_resulttmtimeR�((s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pyR{�sd
"	
		

	cK@s�|jdd�}tjjj|jdt��}tjjj|jdt��}i}i}d}i|d<i|d<t|�}x�tjjj	|j
dt�D]�\}}	}
tjd	|�r�t
jd
j|��q�ntjj||j
�}|dkrd}nx[|
D]S}|jd
�r|d7}ttjj||�tjj||�||�qqWq�Wtjjt�}
tjjj|jd��}|j|
j|��WdQXt|�}t|d�}|ri|d6|d6|d6|d6|dd6}nP|dkrDi|d6|d6|d6|dd6}ni|d6|d6|d6}|dkr�|r�tdd|��n|SdS(u�
    Generate package metadata db based on files within the winrepo_source_dir

    Kwargs:

        saltenv (str): Salt environment. Default: ``base``

        verbose (bool):
            Return verbose data structure which includes 'success_list', a list
            of all sls files and the package names contained within.
            Default ``False``.

        failhard (bool):
            If ``True``, an error will be raised if any repo SLS files failed
            to process. If ``False``, no error will be raised, and a dictionary
            containing the full results will be returned.

    .. note::
        - Hidden directories (directories beginning with '`.`', such as
          '`.git`') will be ignored.

    Returns:
        dict: A dictionary of the results of the command

    CLI Example:

    .. code-block:: bash

        salt-run pkg.genrepo
        salt -G 'os:windows' pkg.genrepo verbose=true failhard=false
        salt -G 'os:windows' pkg.genrepo saltenv=base
    usaltenvubaseuverboseufailhardiurepouerrorsR�u	[\\/]\..*u Skipping files in directory: {0}u.uu.slsiuwbNutotalusuccessufailedusuccess_listufailed_listu'Error occurred while generating repo dbR}(R"RRRRRRR{R�R�R�RdR�RR%RVR�trelpathR�t_repo_process_pkg_slsR�tpayloadtSerialRzR�tfopenR�twritetdumpsR*R(R,RRxRyR-tsuccessful_verbosettotal_files_processedR�R�R�R�t
short_pathR.tserialt
repo_cachetsuccessful_countterror_countR�((s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pyR�sf!!!

.	


c@sstjjtt�}��fd�}y>tjj||tdtjdd�tjdd��}Wn9tk
r�}|d|�St	k
r�}|d|�SX|rBt
|t�rBi}g}	xtj
|�D]\}
}|
�dkrtjd	|
��|	jd
j|
��Pnx�tj
|�D]�\}}
t
|tj�s~tjd|
�|�|	jdj|
|��q+nt
|
t�s�tjd
|
�|�|	jdj|
|��q+n|
||
d<q+Wq�W|	r�|	�jdi��<qo�jdi�j|��jdi�j|�t|j��|�<n-|rU|dd�Stjd��g|�<dS(Nc@sEtjdj|�|��dj||�g�jdi��<tS(Nu{0} '{1}': {2} u	{0}, {1} uerrors(RR�RVRhR(t
prefix_msgt	error_msg(R-tshort_path_name(s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pyt_failed_compile}s%urendererurenderer_blacklistuurenderer_whitelistuFailed to compileuFailed to readurepou2package '%s' within '%s' already defined, skippingupackage '{0}' already definedu<package '%s' within '%s', version number %s' is not a stringu1package '{0}', version number {1} is not a stringuXpackage '%s' within '%s', repo data for version number %s is not defined as a dictionaryuNpackage '{0}', repo data for version number {1} is not defined as a dictionaryu	full_nameuerrorsuname_mapuCompiled contentsunot a dictionary/hashu$No data within '%s' after processing(RtloadertrenderRzRKttemplatetcompile_templateRRt	ExceptionRftdictRRIRR�RiRVtstring_typesRhtupdateR=R>R%(tfilenameR�R-R�t	renderersR�tconfigR�trevmapterrorstpkgnametversion_listtversion_strtrepodata((R-R�s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pyR�zsd	






c
C@s2t�}d}dj|�}tj|�}t|�j}||kr�td	||�}|sytd
j|���ntd|d|�}|dkr.t	|��q.n�|j
d
d�}t|�dkr�dj|dj|��}t	|��ng|D]}	|	j
�j�^q\|d<|d<|S(uV
    Extract the hash sum, whether it is in a remote hash file, or just a string.
    usaltuhttpuhttpsuftpuswiftus3ufileuPSource hash '{0}' format is invalid. It must be in the format <hash type>=<hash>u
cp.cache_fileuSource hash file {0} not foundufile.extract_hashuu=iiu,{0}, or it must be a supported protocol: {1}u, u	hash_typeuhsum(usaltuhttpuhttpsuftpuswiftus3ufileN(R�RVRR)R�tschemeRKRRcRR�R*R�R�tlower(
tsource_hasht	file_pathRR-tschemestinvalid_hash_msgtsource_hash_schemetcached_hash_filetitemstitem((s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pyt_get_source_sum�s,			3cC@sw|tkrtdfSt|tj�r]tjj|�rDt|fStj	d|�t}n|tkrstdfSdS(uJ
    Return if msiexec.exe will be used and the command to invoke it.
    uuDmsiexec path '%s' not found. Using system registered msiexec insteadumsiexecN(
RRfRR�R�R�tisfileRRR$(tuse_msiexec((s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pyt_get_msiexec�s

	c%"K@sb
i}|jdd�}tjjj|�}|r?|r?dStd|||�d}t|�dkr�|jd�dsk	r�t	j
d�q�nx#|D]}i||d	6||<q�W|s�t	jd
�iS|rt|�dkrii|jd	�d	6|jd�d6|6}ntd|d|d
t
�}g}	x�tj|�D]�\}
}t|
d|�}|s�t	jd|
�dj|
�||
<qJn|jd	�}
t|
tj�r�|
dsk	r�tj|
�}
n|
s|
|kr
t	jd|
||
d�qJnt|�}
n|
dkr@d|kr@t|�}
n|
|j|
g�krqt	jd|
|
�qJnB|
dkr�|
|kr�t	jd|
|
�i|
d6||
<qJn||
jdd�}||
jdt�}||
jdd�}|s%t	jd|
|
�i|
d6||
<qJn|jdt�r;|r�|jd�r�tjj|�\}}tdd|d|d td!dsd"d#�n|r:|jd�r:td$||�}|s�td%||�}ntd&||�td&|�kr:td%||�}|s7t	jd'|�i|d(6||
<qJq7q:ntd$||�}|s�td%||�}|s�t	jd)||�i|d*6||
<qJq�n|jd�rAtd&||�td&|�kr8ytd%||�}Wn tk
r}d+j||�SX|s5t	jd'|�i|d*6||
<qJq5q8qAn|}|jd,d-�}tjj|�}||
jd.t�}|r t|||�}t	jd/|d0|d1�tjj j!||d0�}t	jd2|d0|�|d1|krt"d3j|d1|���nt	jd4�n||
jd5d�}|rl|jd�rld6j||jdd��}nt#||
jd7t��\}}tj$d8d9jtj$d:���}|r�d;j||�}||
jd<t
�rd=j|�}qnd>j|�}|rd6j||�}n||
jd?t�r�td@dAdBdCdDdEt
dFdGdH|dIdJj|�dK|dLdMdNdOdPdQdRtdSt�t%j&dT|
dUt%j't%j(�dsk	r�idVdW6||
<tdXdAdB�st	jdY|
�t	jdZ�id[dW6||
<q�t)j)�d\}xCt)j)�|krct)j*d]�td^dB�d_k} | r!Pq!q!W| s�t	jdY|
�t	jdZ�id[dW6||
<q�q
td`dAdB�s
t	jdY|
�t	jdZ�id[dW6||
<q
qJtdadbj||�|dcdddetdft
�}!|!dgsA	idhdW6||
<|	j+|
�qJ|!dgdikr�	|jdjt
�}"|"rw	tdk�nidldW6||
<|	j+|
�qJ|!dgdmkr�	idndW6||
<|	j+|
�qJt	jdY|
�t	jdo|!dg�t	jdp|!dq�id[dW6||
<qJWtd|dt�}#tdr|�tjjj,||#�}$|j-|$�|S(uu�
    Install the passed package(s) on the system using winrepo

    Args:

        name (str):
            The name of a single package, or a comma-separated list of packages
            to install. (no spaces after the commas)

        refresh (bool):
            Boolean value representing whether or not to refresh the winrepo db.
            Default ``False``.

        pkgs (list):
            A list of packages to install from a software repository. All
            packages listed under ``pkgs`` will be installed via a single
            command.

            You can specify a version by passing the item as a dict:

            CLI Example:

            .. code-block:: bash

                # will install the latest version of foo and bar
                salt '*' pkg.install pkgs='["foo", "bar"]'

                # will install the latest version of foo and version 1.2.3 of bar
                salt '*' pkg.install pkgs='["foo", {"bar": "1.2.3"}]'

    Kwargs:

        version (str):
            The specific version to install. If omitted, the latest version will
            be installed. Recommend for use when installing a single package.

            If passed with a list of packages in the ``pkgs`` parameter, the
            version will be ignored.

            CLI Example:

             .. code-block:: bash

                # Version is ignored
                salt '*' pkg.install pkgs="['foo', 'bar']" version=1.2.3

            If passed with a comma separated list in the ``name`` parameter, the
            version will apply to all packages in the list.

            CLI Example:

             .. code-block:: bash

                # Version 1.2.3 will apply to packages foo and bar
                salt '*' pkg.install foo,bar version=1.2.3

        extra_install_flags (str):
            Additional install flags that will be appended to the
            ``install_flags`` defined in the software definition file. Only
            applies when single package is passed.

        saltenv (str):
            Salt environment. Default 'base'

        report_reboot_exit_codes (bool):
            If the installer exits with a recognized exit code indicating that
            a reboot is required, the module function

               *win_system.set_reboot_required_witnessed*

            will be called, preserving the knowledge of this event for the
            remainder of the current boot session. For the time being, 3010 is
            the only recognized exit code. The value of this param defaults to
            True.

            .. versionadded:: 2016.11.0

    Returns:
        dict: Return a dict containing the new package names and versions. If
        the package is already installed, an empty dict is returned.

        If the package is installed by ``pkg.install``:

        .. code-block:: cfg

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

    The following example will refresh the winrepo and install a single
    package, 7zip.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.install 7zip refresh=True

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.install 7zip
        salt '*' pkg.install 7zip,filezilla
        salt '*' pkg.install pkgs='["7zip","filezilla"]'

    WinRepo Definition File Examples:

    The following example demonstrates the use of ``cache_file``. This would be
    used if you have multiple installers in the same directory that use the
    same ``install.ini`` file and you don't want to download the additional
    installers.

    .. code-block:: bash

        ntp:
          4.2.8:
            installer: 'salt://win/repo/ntp/ntp-4.2.8-win32-setup.exe'
            full_name: Meinberg NTP Windows Client
            locale: en_US
            reboot: False
            cache_file: 'salt://win/repo/ntp/install.ini'
            install_flags: '/USEFILE=C:\salt\var\cache\salt\minion\files\base\win\repo\ntp\install.ini'
            uninstaller: 'NTP/uninst.exe'

    The following example demonstrates the use of ``cache_dir``. It assumes a
    file named ``install.ini`` resides in the same directory as the installer.

    .. code-block:: bash

        ntp:
          4.2.8:
            installer: 'salt://win/repo/ntp/ntp-4.2.8-win32-setup.exe'
            full_name: Meinberg NTP Windows Client
            locale: en_US
            reboot: False
            cache_dir: True
            install_flags: '/USEFILE=C:\salt\var\cache\salt\minion\files\base\win\repo\ntp\install.ini'
            uninstaller: 'NTP/uninst.exe'
    usaltenvubaseu0Must pass a single package or a list of packagesupkg_resource.parse_targetsiiuextra_install_flagsuK'extra_install_flags' argument will be ignored for multiple package targetsuversionuNo package definition foundRRRuUnable to locate package %suUnable to locate package {0}u3pkg.install: '%s' version '%s' is already installedulatestu#Version %s not found for package %su	not foundu	installeruu	cache_diru
cache_fileu4No installer configured for version %s of package %suno installerusalt:uhttp:uhttps:uftp:ucp.cache_dirR�t
include_emptyR�R�uE@init.sls$ucp.is_cachedu
cp.cache_fileucp.hash_fileuUnable to cache %sufailed to cache cache_fileu(Unable to cache file %s from saltenv: %suunable to cacheu{0}: {1}u/u\usource_hashupkg.install: Source %s hash: %su	hash_typeuhsumu pkg.install: Package %s hash: %su3Source hash '{0}' does not match package hash '{1}'u.pkg.install: Source hash matches package hash.u
install_flagsu{0} {1}umsiexecuComSpecu{0}\system32\cmd.exeuWINDIRu"{0}" /I "{1}"uallusersu{0} ALLUSERS=1u"{0}"u
use_schedulerutask.create_taskR.uupdate-salt-softwaret	user_nameuSystemR5taction_typeuExecutetcmdt	argumentsu/s /c "{0}"tstart_inttrigger_typeuOncet
start_dateu
1975-01-01t
start_timeu01:00tac_onlytstop_if_on_batteriesusalt[\s_.-]*minionR�utask starteduinstall statusutask.runuFailed to install %suScheduled Task failed to runufailedig�?utask.statusuRunningu
task.run_waitucmd.run_allu"{0}" /s /c "{1}"toutput_loglevelutracetpython_shelltredirect_stderruretcodeusuccessi�ureport_reboot_exit_codesu$system.set_reboot_required_witnessedusuccess, reboot requirediiusuccess, reboot initiatedu
retcode %suinstaller output: %sustdoutupkg_resource.stringifyN(usalt:uhttp:uhttps:uftp:(.R"RRRRRKR*RRcRR$R�RRRRIR&RVRfR�R)R%R'Rt
startswithR�R�R�R	treplacetdirnameR�t	hashutilstget_hashRR�tgetenvRdR�R�tUNICODER�tsleepRit
compare_dictsR�(%R.RR9R,R-Rt
pkg_paramsR:toldtchangedRNtoptionsR@tversion_numt	installert	cache_dirt
cache_fileR�R�tcached_filet
cached_pkgR�t
cache_pathR�t
source_sumtcached_pkg_sumt
install_flagsR�tmsiexect	cmd_shellR�tt_endttask_runningtresulttreport_reboot_exit_codestnewt
difference((s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pytinstall�sz�

		
	
	


		
	"$	



	

cK@sWtjd�tjjj|jdt��}|jdd�}tjd||�iS(u�
    Upgrade all software. Currently not implemented

    Kwargs:
        saltenv (str): The salt environment to use. Default ``base``.
        refresh (bool): Refresh package metadata. Default ``True``.

    .. note::
        This feature is not yet implemented for Windows.

    Returns:
        dict: Empty dict, until implemented

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.upgrade
    u*pkg.upgrade not implemented on Windows yeturefreshusaltenvubaseu@pkg.upgrade not implemented on Windows yet refresh:%s saltenv:%s(RR$RRRRRR(R,RR((s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pytupgrade�s

!c!@sk|jdd�}tjjj|jdt��}i}|rK|rKdStd|||�d}td|d|d	t�}g}x�t	j
|�D]�\}	}
t|	d|�}|s�d
j|	�}t
j|�|||	<q�n|	|kr(t
jd|	|
r
|
nd�id
d6||	<q�ng}
|
dak	rLt	j|
�}
n|
dakr�x�||	D]N}||kr�d|kr�t
jd|	|
�|
jd�qc|
j|�qcWn�|
|kr|
||	kr�|
j|
�qFt
jd|	|
�idj|
�d6||	<q�n/d|krFt
jd|	|
�|
jd�n|
st
jd|	|
�idj|
�d6||	<q�nx�|
D]�}||jdd�}||jdt�}||jdd�}|r�|r�||jdd�}n|s!t
jd|	�i|d6||	<q�n|jdb�rx|rz|jd�rztjj|�\}}td||tdad�ntd ||�}|s�td!||�}|s�t
jd"|�i|d#6||	<q�q�n|jd�r�td$||�td$|�kruytd!||�}Wn tk
rA}d%j||�SX|srt
jd"|�i|d#6||	<q�qrquq�ntjj|�}|jd&d'�}tjj|�\}}|jd(�r�d)j||jd(d��}nt||jd*t��\}}tjd+d,jtjd-���}|rEd.j||�}nd/j|�}|rod)j||�}n|j|	�||jd0t�r5td1d2d3d4d5d6td7d8d9|d:d;j|�d<|d=d>d?d@dAdBdCtdDt�tdEd2d3�s_t
jdF|	�t
jdG�idHdI6||	<q_q�tdJdKj||�dLdMdNtdOt�}|dPs�idQdI6||	<|j|	�q�|dPdRkr�|jdSt�}|r�tdT�nidUdI6||	<|j|	�q�|dPdVkridWdI6||	<|j|	�q�t
jdF|	�t
jdX|dP�t
jdY|dZ�idHdI6||	<q�Wq�Wtd|dt�}td[|�tjjj||��t�fd\�|D��}tj�d]} xs|rCtj�| krCtj d^�td|dt�}tjjj||��t�fd_�|D��}q�W|sZt
j!d`�n|j"��|S(cu�
    Remove the passed package(s) from the system using winrepo

    .. versionadded:: 0.16.0

    Args:
        name (str):
            The name(s) of the package(s) to be uninstalled. Can be a
            single package or a comma delimited list of packages, no spaces.

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

    Kwargs:

        version (str):
            The version of the package to be uninstalled. If this option is
            used to to uninstall multiple packages, then this version will be
            applied to all targeted packages. Recommended using only when
            uninstalling a single package. If this parameter is omitted, the
            latest version will be uninstalled.

        saltenv (str): Salt environment. Default ``base``
        refresh (bool): Refresh package metadata. Default ``False``

    Returns:
        dict: Returns a dict containing the changes.

        If the package is removed by ``pkg.remove``:

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

        If the package is already uninstalled:

            {'<package>': {'current': 'not installed'}}

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.remove <package name>
        salt '*' pkg.remove <package1>,<package2>,<package3>
        salt '*' pkg.remove pkgs='["foo", "bar"]'
    usaltenvubaseurefreshu0Must pass a single package or a list of packagesupkg_resource.parse_targetsiRRRuUnable to locate package {0}u%s %s not installeduu
not installeducurrentulatestu-%s %s using package latest entry to to removeu{0} not installedu*%s %s no definition to remove this versionu!{0} no definition, cannot removeduuninstalleru	cache_diruuninstall_flagsu	installeru5No installer or uninstaller configured for package %suno uninstaller definedusalt:uhttp:uhttps:uftp:ucp.cache_diruE@init.sls$ucp.is_cachedu
cp.cache_fileuUnable to cache %suunable to cacheucp.hash_fileu{0}: {1}u/u\uextra_uninstall_flagsu{0} {1}umsiexecuComSpecu{0}\system32\cmd.exeuWINDIRu"{0}" /X "{1}"u"{0}"u
use_schedulerutask.create_taskR.uupdate-salt-softwareR�uSystemR5R�uExecuteR�R�u/s /c "{0}"R�R�uOnceR�u
1975-01-01R�u01:00R�R�u
task.run_waituFailed to remove %suScheduled Task failed to runufaileduuninstall statusucmd.run_allu"{0}" /s /c "{1}"R�utraceR�R�uretcodeusuccessi�ureport_reboot_exit_codesu$system.set_reboot_required_witnessedusuccess, reboot requirediiusuccess, reboot initiatedu
retcode %suuninstaller output: %sustdoutupkg_resource.stringifyc3@s|]}|�kVqdS(N((t.0R.(R(s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pys	<genexpr>�sig�?c3@s|]}|�kVqdS(N((RR.(R(s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pys	<genexpr>�su9Expected changes for package removal may not have occuredN(usalt:uhttp:uhttps:uftp:(#RRRRRRRKRRRRIR&RVRR�R%RcR)RiR�R�R�R�R	t
expandvarsR�R�R�R"RtallR�RR$R�(!R.R9R,RRR-RRRR�RR@tmsgtremoval_targetstver_installttargettuninstallerRtuninstall_flagsR�R�RR�RR�RRR�RRRt
found_chgstend_t((Rs8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pyR��s(/!





	"$

	

 
cK@std|d||�S(u�
    Package purges are not supported, this function is identical to
    ``remove()``.

    .. versionadded:: 0.16.0

    Args:

        name (str): The name of the package to be deleted.

        version (str):
            The version of the package to be deleted. If this option is
            used in combination with the ``pkgs`` option below, then this
            version will be applied to all targeted packages.

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

    Kwargs:
        saltenv (str): Salt environment. Default ``base``
        refresh (bool): Refresh package metadata. Default ``False``

    Returns:
        dict: 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"]'
    R.R9(R�(R.R9R,((s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pytpurge�s$ubasec	C@s5t|�}|jdkr8tjd�td|�ndtkrYtjd�tdStjd�y�tjj	t
�}tjjj
|jd��g}y<tjjj|j|j��p�i�}|td<|SWn!tk
r�}tj|�iSXWdQXWn.tk
r0}tjd	�tj|�iSXdS(
uV
    Returns the existing package metadata db. Will create it, if it does not
    exist, however will not refresh it.

    Args:
        saltenv (str): Salt environment. Default ``base``

    Returns:
        dict: A dict containing contents of metadata db.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.get_repo_data
    i����u,No winrepo.p cache file. Refresh pkg db now.Ruwinrepo.datau0get_repo_data returning results from __context__u&get_repo_data called reading from diskurbNuNot able to read repo file(R{R|RR%R�R�RRR�R�RzRR�R�R�RtdecodetloadstreadR�t	exceptiontIOErrorR�(RR�R�trepofileR�R�((s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pyR7(s,


*



cC@sNi}t|�jdi�}tjs+|Sx|D]}||||<q2W|S(uT
    Return a reverse map of full pkg names to the names recognized by winrepo.
    uname_map(R7RRtPY2(Rt
u_name_mapRMtk((s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pyRHYs	
cC@s"t|�jdi�j|i�S(uj
    Return package info. Returns empty map if package not available
    TODO: Add option for version
    urepo(R7R(R.R((s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pyR&hscC@s t|�t|�krdSdS(u+
    Compare software package versions
    ii����(R
(tpkg1tpkg2((s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pyR!pscC@s^t|�dkr%ttj|��Sy t|dtt��j�SWntk
rYdSXdS(u�
    Returns the latest version of the package.
    Will return 'latest' or version number string, and
    'Not Found' if 'Not Found' is the only entry.
    iRuN(	R*tnextRtiterkeysR RR!R"R#(R@((s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pyR'ws
uu==cC@s�|std��n|s*td��n|dkrKtjtj�}n|dkrltjtj�}n|dkr�d}n|dkr�d}ntjjj|||dt	�S(uw
    Compare software package versions

    Args:
        ver1 (str): A software version to compare
        oper (str): The operand to use to compare
        ver2 (str): A software version to compare

    Returns:
        bool: True if the comparison is valid, otherwise False

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.compare_versions 1.2 >= 1.3
    ucompare_version, ver1 is blankucompare_version, ver2 is blankulatestu	Not Foundu	0.0.0.0.0tignore_epoch(
RRR)tsystmaxsizeRRRAtcompareR(RRR((s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pyR(�s		(Ft__doc__t
__future__RRRR�R~R�tloggingR�RdR�R4t	functoolsRtsalt.extRtsalt.ext.six.moves.urllib.parseRR�tsalt.exceptionsRRRtsalt.utils.argsRtsalt.utils.datatsalt.utils.filestsalt.utils.hashutilstsalt.utils.pathtsalt.utils.pkgtsalt.utils.platformtsalt.utils.versionstsalt.utils.win_functionst
salt.syspathstsalt.payloadR	R
t	getLoggert__name__RRRR3R4RR<RCRDRRRJR6R�R{R�R�R�R�RcRRR�R%R7RHR&R!R'R((((s8/usr/lib/python2.7/site-packages/salt/modules/win_pkg.pyt<module>&sv			b	(	<	2O�>	E	�	O	g	H	%	��	�#)1		

Zerion Mini Shell 1.0