Merge pull request #34259 from rallytime/merge-2016.3

[2016.3] Merge forward from 2015.8 to 2016.3
This commit is contained in:
Nicole Thomas 2016-06-24 10:27:30 -04:00 committed by GitHub
commit 39579ce5f6
2 changed files with 27 additions and 3 deletions

View File

@ -228,6 +228,10 @@ def list_pkgs(versions_as_list=False, **kwargs):
for x in ('removed', 'purge_desired')]):
return {}
if kwargs.get('refresh', False):
# _get_name_map() needs a refresh_db if cache is not present
refresh_db()
ret = {}
name_map = _get_name_map()
for pkg_name, val in six.iteritems(_get_reg_software()):

View File

@ -297,7 +297,14 @@ def _find_install_targets(name=None,
if __grains__['os'] == 'FreeBSD':
kwargs['with_origin'] = True
cur_pkgs = __salt__['pkg.list_pkgs'](versions_as_list=True, **kwargs)
try:
cur_pkgs = __salt__['pkg.list_pkgs'](versions_as_list=True, **kwargs)
except CommandExecutionError as exc:
return {'name': name,
'changes': {},
'result': False,
'comment': exc.strerror}
if any((pkgs, sources)):
if pkgs:
desired = _repack_pkgs(pkgs)
@ -1064,7 +1071,13 @@ def installed(
# If version is empty, it means the latest version is installed
# so we grab that version to avoid passing an empty string
if not version:
version = __salt__['pkg.version'](name)
try:
version = __salt__['pkg.version'](name)
except CommandExecutionError as exc:
return {'name': name,
'changes': {},
'result': False,
'comment': exc.strerror}
kwargs['allow_updates'] = allow_updates
result = _find_install_targets(name, version, pkgs, sources,
@ -1576,7 +1589,6 @@ def latest(
else:
desired_pkgs = [name]
cur = __salt__['pkg.version'](*desired_pkgs, **kwargs)
try:
avail = __salt__['pkg.latest_version'](*desired_pkgs,
fromrepo=fromrepo,
@ -1590,6 +1602,14 @@ def latest(
'newest available version of package(s): {0}'
.format(exc)}
try:
cur = __salt__['pkg.version'](*desired_pkgs, **kwargs)
except CommandExecutionError as exc:
return {'name': name,
'changes': {},
'result': False,
'comment': exc.strerror}
# Remove the rtag if it exists, ensuring only one refresh per salt run
# (unless overridden with refresh=True)
if os.path.isfile(rtag) and refresh: