mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #48534 from xetix/fix-zypper-latest_version
Fix behaviour of function latest_version in zypper module when multip…
This commit is contained in:
commit
6973152057
2 changed files with 3 additions and 0 deletions
|
@ -581,6 +581,8 @@ def latest_version(*names, **kwargs):
|
|||
status = pkg_info.get('status', '').lower()
|
||||
if status.find('not installed') > -1 or status.find('out-of-date') > -1:
|
||||
ret[name] = pkg_info.get('version')
|
||||
else:
|
||||
ret[name] = ''
|
||||
|
||||
# Return a string if only one package name passed
|
||||
if len(names) == 1 and len(ret):
|
||||
|
|
|
@ -361,6 +361,7 @@ class ZypperTestCase(TestCase, LoaderModuleMockMixin):
|
|||
ZyppCallMock(return_value=get_test_data('zypper-available.txt'))), \
|
||||
patch('salt.modules.zypper.refresh_db', MagicMock(return_value=True)):
|
||||
self.assertEqual(zypper.latest_version('vim'), '7.4.326-2.62')
|
||||
self.assertDictEqual(zypper.latest_version('vim', 'fakepkg'), {'vim': '7.4.326-2.62', 'fakepkg': ''})
|
||||
|
||||
def test_upgrade_success(self):
|
||||
'''
|
||||
|
|
Loading…
Add table
Reference in a new issue