Merge pull request #33976 from rallytime/merge-2016.3

[2016.3] Merge forward from 2015.8 to 2016.3
This commit is contained in:
Nicole Thomas 2016-06-13 15:29:40 -04:00 committed by GitHub
commit 2e934cffef
5 changed files with 35 additions and 30 deletions

View file

@ -221,10 +221,11 @@
<div class="footer">
<hr />
{% if on_saltstack %}
<div class="row">
{% if on_saltstack %}
<div class="col-sm-6">
<p><i>Generated on {{today}}.</i></p>
{% if build_type == "latest" %}
<p>You are viewing docs for the latest stable release, {{ latest_release }}. Switch to docs for the previous stable release, <a data-container="body" data-toggle="tooltip" data-placement="bottom" title="Docs for the previous stable release" href="/en/{{ previous_release_dir }}/">{{ previous_release }}</a>, or to a recent doc build from the <a data-container="body" data-toggle="tooltip" data-placement="bottom" title="Latest docs from the develop branch" href="/en/develop/">develop</a> branch.</p>
@ -252,8 +253,8 @@
</div>
{% endif %}
</div>
{% endif %}
</div> <!--end footer-->
{%- endblock %}

View file

@ -7,6 +7,7 @@ import functools
import sys
import os
import types
import time
from sphinx.directives import TocTree
@ -201,6 +202,8 @@ previous_release_dir = '2015.8' # path on web server for previous branch
next_release = '' # next release
next_release_dir = '' # path on web server for next release branch
today = time.strftime("%B %d, %Y") + " at " + time.strftime("%X %Z")
# < --- START do not merge these settings to other branches START ---> #
build_type = 'latest' # latest, previous, develop, next
release = latest_release # version, latest_release, previous_release
@ -346,6 +349,7 @@ html_context = {
'next_release_dir': next_release_dir,
'search_cx': search_cx,
'build_type': build_type,
'today': today,
}
html_use_index = True

View file

@ -6,6 +6,7 @@ Return/control aspects of the grains data
# Import python libs
from __future__ import absolute_import
import collections
import copy
import math
# Import salt libs
@ -138,7 +139,11 @@ def ls(): # pylint: disable=C0103
return sorted(__grains__)
def filter_by(lookup_dict, grain='os_family', merge=None, default='default'):
def filter_by(lookup_dict,
grain='os_family',
merge=None,
default='default',
base=None):
'''
.. versionadded:: 0.17.0
@ -201,6 +206,14 @@ def filter_by(lookup_dict, grain='os_family', merge=None, default='default'):
.. versionadded:: 2014.1.0
:param base: A lookup_dict key to use for a base dictionary. The
grain-selected ``lookup_dict`` is merged over this and then finally
the ``merge`` dictionary is merged. This allows common values for
each case to be collected in the base and overridden by the grain
selection dictionary and the merge dictionary. Default is None.
.. versionadded:: 2015.8.11, 2016.3.2
CLI Example:
.. code-block:: bash
@ -216,15 +229,22 @@ def filter_by(lookup_dict, grain='os_family', merge=None, default='default'):
default, None)
)
if base and base in lookup_dict:
base_values = lookup_dict[base]
if ret is None:
ret = base_values
elif isinstance(base_values, collections.Mapping):
if not isinstance(ret, collections.Mapping):
raise SaltException('filter_by default and look-up values must both be dictionaries.')
ret = salt.utils.dictupdate.update(copy.deepcopy(base_values), ret)
if merge:
if not isinstance(merge, collections.Mapping):
raise SaltException('filter_by merge argument must be a dictionary.')
else:
if ret is None:
ret = merge
else:
salt.utils.dictupdate.update(ret, merge)

View file

@ -853,27 +853,6 @@ def run(cmd,
log_callback = _check_cb(log_callback)
if 'pid' in ret and '__pub_jid' in kwargs:
# Stuff the child pid in the JID file
try:
proc_dir = os.path.join(__opts__['cachedir'], 'proc')
jid_file = os.path.join(proc_dir, kwargs['__pub_jid'])
if os.path.isfile(jid_file):
serial = salt.payload.Serial(__opts__)
with salt.utils.fopen(jid_file, 'rb') as fn_:
jid_dict = serial.load(fn_)
if 'child_pids' in jid_dict:
jid_dict['child_pids'].append(ret['pid'])
else:
jid_dict['child_pids'] = [ret['pid']]
# Rewrite file
with salt.utils.fopen(jid_file, 'w+b') as fn_:
fn_.write(serial.dumps(jid_dict))
except (NameError, TypeError):
# Avoids errors from msgpack not being loaded in salt-ssh
pass
lvl = _check_loglevel(output_loglevel)
if lvl is not None:
if not ignore_retcode and ret['retcode'] != 0:

View file

@ -51,6 +51,8 @@ import salt.utils.minion
import salt.utils.process
import salt.utils.url
import salt.wheel
import salt.utils.psutil_compat as psutil
from salt.exceptions import (
SaltReqTimeoutError, SaltRenderError, CommandExecutionError, SaltInvocationError
)
@ -862,10 +864,9 @@ def signal_job(jid, sig):
for data in running():
if data['jid'] == jid:
try:
for proc in psutil.Process(pid=data['pid']).children(recursive=True):
proc.send_signal(sig)
os.kill(int(data['pid']), sig)
if 'child_pids' in data:
for pid in data['child_pids']:
os.kill(int(pid), sig)
return 'Signal {0} sent to job {1} at pid {2}'.format(
int(sig),
jid,