diff --git a/salt/states/pkg.py b/salt/states/pkg.py index 3a86cecfa21a..0269f55cd25f 100644 --- a/salt/states/pkg.py +++ b/salt/states/pkg.py @@ -241,8 +241,11 @@ def _find_install_targets(name=None, # Change it to "==" so that the version comparison works if comparison in ['=', '']: comparison = '==' + if 'allow_updates' in kwargs: + if kwargs['allow_updates']: + comparison = '>=' if not _fulfills_version_spec(cver, comparison, verstr): - # Current version did not match desired, add to targets + log.debug('Current version ({0} did not match ({1}) desired ({2}), add to targets'.format(cver, comparison, verstr)) targets[pkgname] = pkgver if problems: @@ -337,6 +340,7 @@ def installed( skip_suggestions=False, pkgs=None, sources=None, + allow_updates=False, **kwargs): ''' Verify that the package is installed, and that it is the correct version @@ -428,6 +432,13 @@ def installed( .. versionadded:: Helium + allow_updates + Allow the package to be updated outside Salt's control (e.g. auto updates on Windows). + This means a package on the Minion can have a newer version than the latest available + in the repository without enforcing a re-installation of the package. + + .. versionadded:: Helium + Example: .. code-block:: yaml @@ -546,6 +557,7 @@ def installed( if not isinstance(version, string_types) and version is not None: version = str(version) + kwargs['allow_updates'] = allow_updates result = _find_install_targets(name, version, pkgs, sources, fromrepo=fromrepo, skip_suggestions=skip_suggestions,