Fix crash with scheduler and runners (#31106)

* runner wrapper ClientFuncsDict do not provide access to 'pack' attribute
* runners do not provide retcode, therefore ignore it in the schedule if it is not
  provided by __context__
This commit is contained in:
Duncan Mac-Vicar P 2016-02-13 00:23:30 +01:00
parent c5e5af827c
commit 9ad8cb1e6b
2 changed files with 10 additions and 1 deletions

View file

@ -53,6 +53,12 @@ class ClientFuncsDict(collections.MutableMapping):
def __init__(self, client):
self.client = client
def __getattr__(self, attr):
'''
Provide access eg. to 'pack'
'''
return getattr(self.client.functions, attr)
def __setitem__(self, key, val):
raise NotImplementedError()

View file

@ -700,7 +700,10 @@ class Schedule(object):
)
)
ret['retcode'] = self.functions.pack['__context__']['retcode']
# runners do not provide retcode
if 'retcode' in self.functions.pack['__context__']:
ret['retcode'] = self.functions.pack['__context__']['retcode']
ret['success'] = True
except Exception:
log.exception("Unhandled exception running {0}".format(ret['fun']))