mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Merge pull request #34259 from rallytime/merge-2016.3
[2016.3] Merge forward from 2015.8 to 2016.3
This commit is contained in:
commit
39579ce5f6
@ -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()):
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user