Skip to content

Commit

Permalink
Merge pull request #12711 from eliasp/states_pkg-allow_updates
Browse files Browse the repository at this point in the history
Allow packages to be updated on their own
  • Loading branch information
thatch45 committed May 13, 2014
2 parents 86617cd + 7db6c98 commit 998b3cc
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion salt/states/pkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 998b3cc

Please sign in to comment.