Skip to content

Commit

Permalink
Merge pull request #34256 from tmehlinger/master-fire-event-orchestra…
Browse files Browse the repository at this point in the history
…tion

detect running from master in State.event method
  • Loading branch information
Mike Place committed Jun 28, 2016
2 parents cd35e73 + 7b8791c commit 31de61e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions salt/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -1936,7 +1936,13 @@ def event(self, chunk_ret, length, fire_event=False):
chunk is evaluated an event will be set up to the master with the
results.
'''
if not self.opts.get('local') and (self.opts.get('state_events', True) or fire_event) and self.opts.get('master_uri'):
if not self.opts.get('local') and (self.opts.get('state_events', True) or fire_event):
if not self.opts.get('master_uri'):
ev_func = lambda ret, tag, preload=None: salt.utils.event.get_master_event(
self.opts, self.opts['sock_dir'], listen=False).fire_event(ret, tag)
else:
ev_func = self.functions['event.fire_master']

ret = {'ret': chunk_ret}
if fire_event is True:
tag = salt.utils.event.tagify(
Expand All @@ -1952,7 +1958,7 @@ def event(self, chunk_ret, length, fire_event=False):
)
ret['len'] = length
preload = {'jid': self.jid}
self.functions['event.fire_master'](ret, tag, preload=preload)
ev_func(ret, tag, preload=preload)

def call_chunk(self, low, running, chunks):
'''
Expand Down

0 comments on commit 31de61e

Please sign in to comment.