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

[2016.3] Merge forward from 2015.8 to 2016.3 #33976

Merged
merged 8 commits into from
Jun 13, 2016
5 changes: 3 additions & 2 deletions doc/_themes/saltstack2/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -252,8 +253,8 @@


</div>
{% endif %}
</div>
{% endif %}
</div> <!--end footer-->
{%- endblock %}

Expand Down
4 changes: 4 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import sys
import os
import types
import time

from sphinx.directives import TocTree

Expand Down Expand Up @@ -201,6 +202,8 @@ def inner(fn, *iargs, **ikwargs):
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
Expand Down Expand Up @@ -346,6 +349,7 @@ def inner(fn, *iargs, **ikwargs):
'next_release_dir': next_release_dir,
'search_cx': search_cx,
'build_type': build_type,
'today': today,
}

html_use_index = True
Expand Down
28 changes: 24 additions & 4 deletions salt/client/ssh/wrapper/grains.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Import python libs
from __future__ import absolute_import
import collections
import copy
import math

# Import salt libs
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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)

Expand Down
21 changes: 0 additions & 21 deletions salt/modules/cmdmod.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 4 additions & 3 deletions salt/modules/saltutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
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
)
Expand Down Expand Up @@ -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,
Expand Down