mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Add utils func for firing an event containing orchestration args
This commit is contained in:
parent
e9b214e9f8
commit
26a0850c19
@ -148,6 +148,27 @@ def get_master_event(opts, sock_dir, listen=True, io_loop=None):
|
||||
)
|
||||
|
||||
|
||||
def fire_args(opts, jid, tag_data, prefix=''):
|
||||
'''
|
||||
Fire an event containing the arguments passed to an orchestration job
|
||||
'''
|
||||
try:
|
||||
tag_suffix = [jid, 'args']
|
||||
except NameError:
|
||||
pass
|
||||
else:
|
||||
try:
|
||||
_event = get_master_event(opts, opts['sock_dir'], listen=False)
|
||||
tag = tagify(tag_suffix, prefix)
|
||||
_event.fire_event(tag_data, tag=tag)
|
||||
except Exception as exc:
|
||||
# Don't let a problem here hold up the rest of the orchestration
|
||||
log.warning(
|
||||
'Failed to fire args event %s with data %s: %s',
|
||||
tag, tag_data, exc
|
||||
)
|
||||
|
||||
|
||||
def tagify(suffix='', prefix='', base=SALT):
|
||||
'''
|
||||
convenience function to build a namespaced event tag string
|
||||
|
Loading…
Reference in New Issue
Block a user