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

ZD 762 #33942

Merged
merged 3 commits into from
Jun 13, 2016
Merged

ZD 762 #33942

Show file tree
Hide file tree
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
21 changes: 0 additions & 21 deletions salt/modules/cmdmod.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,27 +816,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.url
import salt.transport
import salt.wheel
import salt.utils.psutil_compat as psutil

from salt.exceptions import (
SaltReqTimeoutError, SaltRenderError, CommandExecutionError, SaltInvocationError
)
Expand Down Expand Up @@ -856,10 +858,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