Merge pull request #28731 from garethgreenaway/27392_2015_5_scheduler_return_job_master

Fixes to salt scheduler in 2015.5, ensuring that return_job is only used on minion scheduler
This commit is contained in:
Mike Place 2015-11-13 09:58:06 -07:00
commit bed45f4208

View file

@ -562,17 +562,20 @@ class Schedule(object):
)
)
if 'return_job' in data and not data['return_job']:
pass
else:
# Send back to master so the job is included in the job list
mret = ret.copy()
mret['jid'] = 'req'
channel = salt.transport.Channel.factory(self.opts, usage='salt_schedule')
load = {'cmd': '_return', 'id': self.opts['id']}
for key, value in mret.items():
load[key] = value
channel.send(load)
# 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':
if 'return_job' in data and not data['return_job']:
pass
else:
# Send back to master so the job is included in the job list
mret = ret.copy()
mret['jid'] = 'req'
channel = salt.transport.Channel.factory(self.opts, usage='salt_schedule')
load = {'cmd': '_return', 'id': self.opts['id']}
for key, value in mret.items():
load[key] = value
channel.send(load)
except Exception:
log.exception("Unhandled exception running {0}".format(ret['fun']))