Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow packages to be updated on their own #12711

Merged
merged 2 commits into from
May 13, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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