Merge pull request #38925 from terminalmage/issue38540

Fix two wheel issues in netapi
This commit is contained in:
Mike Place 2017-01-25 11:28:51 -07:00 committed by GitHub
commit b27733cc33
2 changed files with 14 additions and 5 deletions

View file

@ -1805,9 +1805,9 @@ class ClearFuncs(object):
'user': token['name']}
try:
self.event.fire_event(data, tagify([jid, 'new'], 'wheel'))
ret = self.wheel_.call_func(fun, **clear_load)
data['return'] = ret
data['success'] = True
ret = self.wheel_.call_func(fun, full_return=True, **clear_load)
data['return'] = ret['return']
data['success'] = ret['success']
self.event.fire_event(data, tagify([jid, 'ret'], 'wheel'))
return {'tag': tag,
'data': data}

View file

@ -668,8 +668,17 @@ class SignalHandlingMultiprocessingProcess(MultiprocessingProcess):
def default_signals(*signals):
old_signals = {}
for signum in signals:
old_signals[signum] = signal.getsignal(signum)
signal.signal(signum, signal.SIG_DFL)
try:
signal.signal(signum, signal.SIG_DFL)
old_signals[signum] = signal.getsignal(signum)
except ValueError as exc:
# This happens when a netapi module attempts to run a function
# using wheel_async, because the process trying to register signals
# will not be the main PID.
log.trace(
'Failed to register signal for signum %d: %s',
signum, exc
)
# Do whatever is needed with the reset signals
yield