mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Bugfix and refactor due to the crash on unknown package and incorrect return value
This commit is contained in:
parent
a6c285bd12
commit
decb989eb4
1 changed files with 3 additions and 6 deletions
|
@ -210,12 +210,9 @@ def latest_version(*names, **kwargs):
|
|||
names = sorted(list(set(names)))
|
||||
package_info = info_available(*names)
|
||||
for name in names:
|
||||
pkg_info = package_info.get(name)
|
||||
status = pkg_info.get('status', '').lower()
|
||||
if pkg_info is not None and status.startswith('not installed') or status.startswith('out-of-date'):
|
||||
ret[name] = pkg_info.get('version')
|
||||
else:
|
||||
ret[name] = ''
|
||||
pkg_info = package_info.get(name, {})
|
||||
if pkg_info.get('status', '').lower() in ['not installed', 'out-of-date']:
|
||||
ret[name] = pkg_info
|
||||
|
||||
return ret
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue