Merge pull request #34437 from hrumph/pkg_state_problem3

Fix problem with calling latest_version in win_pkg in develop branch.
This commit is contained in:
Mike Place 2016-07-05 09:22:54 -06:00 committed by GitHub
commit a2fde91ad7
2 changed files with 6 additions and 2 deletions

View File

@ -53,7 +53,7 @@ def __virtual__():
return (False, "Module win_pkg: module only works on Windows systems") return (False, "Module win_pkg: module only works on Windows systems")
def latest_version(saltenv='base', *names, **kwargs): def latest_version(*names, **kwargs):
''' '''
Return the latest version of the named package available for upgrade or Return the latest version of the named package available for upgrade or
installation. If more than one package name is specified, a dict of installation. If more than one package name is specified, a dict of
@ -78,6 +78,8 @@ def latest_version(saltenv='base', *names, **kwargs):
for name in names: for name in names:
ret[name] = '' ret[name] = ''
saltenv = kwargs.get('saltenv', 'base')
# Refresh before looking for the latest version available # Refresh before looking for the latest version available
if salt.utils.is_true(kwargs.get('refresh', True)): if salt.utils.is_true(kwargs.get('refresh', True)):
refresh_db(saltenv) refresh_db(saltenv)

View File

@ -1161,7 +1161,7 @@ def installed(
version = str(version) version = str(version)
if version is not None and version == 'latest': if version is not None and version == 'latest':
version = __salt__['pkg.latest_version'](name) version = __salt__['pkg.latest_version'](name, **kwargs)
# If version is empty, it means the latest version is installed # If version is empty, it means the latest version is installed
# so we grab that version to avoid passing an empty string # so we grab that version to avoid passing an empty string
if not version: if not version:
@ -1721,6 +1721,8 @@ def latest(
else: else:
desired_pkgs = [name] desired_pkgs = [name]
kwargs['saltenv'] = __env__
try: try:
avail = __salt__['pkg.latest_version'](*desired_pkgs, avail = __salt__['pkg.latest_version'](*desired_pkgs,
fromrepo=fromrepo, fromrepo=fromrepo,