mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +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
@ -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…
Reference in New Issue
Block a user