mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
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:
commit
bed45f4208
1 changed files with 14 additions and 11 deletions
|
@ -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']))
|
||||
|
|
Loading…
Add table
Reference in a new issue