return empty dict on no changes

This commit is contained in:
twangboy 2018-08-07 12:25:15 -06:00
parent 6532706d2f
commit 47b2898a85
No known key found for this signature in database
GPG key ID: 93FF3BDEB278C9EB
2 changed files with 2 additions and 4 deletions

View file

@ -1229,7 +1229,6 @@ def install(name=None, refresh=False, pkgs=None, **kwargs):
if pkg_name in old:
log.debug('"%s" version "%s" is already installed',
pkg_name, old[pkg_name][0])
ret[pkg_name] = {'current': old[pkg_name][0]}
continue
# Get the most recent version number available from winrepo.p
version_num = _get_latest_pkg_version(pkginfo)
@ -1244,7 +1243,6 @@ def install(name=None, refresh=False, pkgs=None, **kwargs):
# Desired version number already installed
log.debug('"%s" version "%s" is already installed',
pkg_name, version_num)
ret[pkg_name] = {'current': version_num}
continue
# If version number not installed, is the version available?
elif version_num.lower() != 'latest' and version_num not in pkginfo:

View file

@ -122,7 +122,7 @@ class WinPkgInstallTestCase(TestCase, LoaderModuleMockMixin):
win_pkg.__salt__,
{'cmd.run_all':
MagicMock(return_value={'retcode': 0})}):
expected = {'nsis': {'current': '3.03'}}
expected = {}
result = win_pkg.install(name='nsis')
self.assertDictEqual(expected, result)
@ -148,6 +148,6 @@ class WinPkgInstallTestCase(TestCase, LoaderModuleMockMixin):
win_pkg.__salt__,
{'cmd.run_all':
MagicMock(return_value={'retcode': 0})}):
expected = {'nsis': {'current': '3.03'}}
expected = {}
result = win_pkg.install(name='nsis', version='3.03')
self.assertDictEqual(expected, result)