Fix master side scheduled jobs to return events

This commit is contained in:
Denys Havrysh 2017-06-20 17:21:35 +03:00
parent e7fc30f482
commit e206c381c6

View file

@ -888,9 +888,10 @@ class Schedule(object):
ret['success'] = False
ret['retcode'] = 254
finally:
# Only attempt to return data to the master
# if the scheduled job is running on a minion.
if '__role' in self.opts and self.opts['__role'] == 'minion':
# Only attempt to return data to the master if the scheduled job is running
# on a master itself or a minion.
if '__role' in self.opts and self.opts['__role'] in ('master', 'minion'):
# The 'return_job' option is enabled by default even if not set
if 'return_job' in data and not data['return_job']:
pass
else:
@ -918,6 +919,7 @@ class Schedule(object):
log.exception("Unhandled exception firing event: {0}".format(exc))
log.debug('schedule.handle_func: Removing {0}'.format(proc_fn))
try:
os.unlink(proc_fn)
except OSError as exc: