Merge pull request #35133 from rallytime/merge-2016.3

[2016.3] Merge forward from 2015.8 to 2016.3
This commit is contained in:
Nicole Thomas 2016-08-02 12:06:18 -06:00 committed by GitHub
commit bf04bd3316
3 changed files with 67 additions and 7 deletions

View file

@ -0,0 +1,6 @@
============================
Salt 2015.8.12 Release Notes
============================
Version 2015.8.12 is a bugfix release for :doc:`2015.8.0
</topics/releases/2015.8.0>`.

View file

@ -40,6 +40,17 @@ the repo's URL. Configuration details can be found below.
'dev-*':
- bar
Additionally, while git_pillar allows for the branch/tag to be overridden
(see :ref:`here <git-pillar-env-remap>`, or :ref:`here
<git-pillar-env-remap-legacy>` for Salt releases before 2015.8.0), keep in
mind that the top file must reference the actual environment name. It is
common practice to make the environment in a git_pillar top file match the
branch/tag name, but when remapping, the environment of course no longer
matches the branch/tag, and the top file needs to be adjusted accordingly.
When expected Pillar values configured in git_pillar are missing, this is a
common misconfiguration that may be to blame, and is a good first step in
troubleshooting.
.. _git-pillar-pre-2015-8-0:
Configuring git_pillar for Salt releases before 2015.8.0
@ -69,6 +80,8 @@ specified under :conf_master:`ext_pillar`:
- git: master https://gitserver/git-pillar.git
- git: dev https://gitserver/git-pillar.git
.. _git-pillar-env-remap-legacy:
To remap a specific branch to a specific Pillar environment, use the format
``<branch>:<env>``:
@ -179,6 +192,18 @@ Per-remote configuration parameters are supported (similar to :ref:`gitfs
<gitfs-per-remote-config>`), and global versions of the git_pillar
configuration parameters can also be set.
.. _git-pillar-env-remap:
To remap a specific branch to a specific Pillar environment, use the ``env``
per-remote parameter:
.. code-block:: yaml
ext_pillar:
- git:
- production https://gitserver/git-pillar.git:
- env: prod
With the addition of pygit2_ support, git_pillar can now interact with
authenticated remotes. Authentication works just like in gitfs (as outlined in
the :ref:`Git Fileserver Backend Walkthrough <gitfs-authentication>`), only
@ -187,10 +212,9 @@ instead of ``gitfs`` (e.g. :conf_master:`git_pillar_pubkey`,
:conf_master:`git_pillar_privkey`, :conf_master:`git_pillar_passphrase`, etc.).
.. note::
The ``name`` parameter can be used to further differentiate between two
remotes with the same URL. If you're using two remotes with the same URL,
the ``name`` option is required.
remotes with the same URL and branch. When using two remotes with the same
URL, the ``name`` option is required.
.. _GitPython: https://github.com/gitpython-developers/GitPython
.. _pygit2: https://github.com/libgit2/pygit2

View file

@ -1070,8 +1070,24 @@ def installed(
if not isinstance(version, six.string_types) and version is not None:
version = str(version)
was_refreshed = False
if version is not None and version == 'latest':
version = __salt__['pkg.latest_version'](name)
try:
version = __salt__['pkg.latest_version'](name,
fromrepo=fromrepo,
refresh=refresh)
except CommandExecutionError as exc:
return {'name': name,
'changes': {},
'result': False,
'comment': 'An error was encountered while checking the '
'newest available version of package(s): {0}'
.format(exc)}
was_refreshed = refresh
refresh = False
# If version is empty, it means the latest version is installed
# so we grab that version to avoid passing an empty string
if not version:
@ -1084,6 +1100,13 @@ def installed(
'comment': exc.strerror}
kwargs['allow_updates'] = allow_updates
# if windows and a refresh
# is required, we will have to do a refresh when _find_install_targets
# calls pkg.list_pkgs
if salt.utils.is_windows():
kwargs['refresh'] = refresh
result = _find_install_targets(name, version, pkgs, sources,
fromrepo=fromrepo,
skip_suggestions=skip_suggestions,
@ -1093,6 +1116,11 @@ def installed(
reinstall=reinstall,
**kwargs)
if salt.utils.is_windows():
was_refreshed = was_refreshed or refresh
kwargs.pop('refresh')
refresh = False
try:
(desired, targets, to_unpurge,
to_reinstall, altered_files, warnings) = result
@ -1238,9 +1266,6 @@ def installed(
reinstall=bool(to_reinstall),
normalize=normalize,
**kwargs)
if os.path.isfile(rtag) and refresh:
os.remove(rtag)
except CommandExecutionError as exc:
ret = {'name': name, 'result': False}
if exc.info:
@ -1255,6 +1280,8 @@ def installed(
ret['comment'] += '\n\n' + '. '.join(warnings) + '.'
return ret
was_refreshed = was_refreshed or refresh
if isinstance(pkg_ret, dict):
changes['installed'].update(pkg_ret)
elif isinstance(pkg_ret, six.string_types):
@ -1306,6 +1333,9 @@ def installed(
failed_hold = [hold_ret[x] for x in hold_ret
if not hold_ret[x]['result']]
if os.path.isfile(rtag) and was_refreshed:
os.remove(rtag)
if to_unpurge:
changes['purge_desired'] = __salt__['lowpkg.unpurge'](*to_unpurge)