mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
initial addition of event system minion module
This commit is contained in:
parent
e285aa8d5c
commit
27b5da0f82
25
salt/modules/event.py
Normal file
25
salt/modules/event.py
Normal file
@ -0,0 +1,25 @@
|
||||
'''
|
||||
Fire events on the minion, events can be fired up to the master
|
||||
'''
|
||||
# Import Salt libs
|
||||
import salt.crypt
|
||||
import salt.payload
|
||||
|
||||
def fire_master(data, tag):
|
||||
'''
|
||||
Fire an event off on the master server
|
||||
'''
|
||||
serial = salt.payload.Serial(__opts__)
|
||||
context = zmq.Context()
|
||||
socket = context.socket(zmq.REQ)
|
||||
socket.connect(__opts__['master_uri'])
|
||||
load = {'id': self.id_,
|
||||
'tag': tag,
|
||||
'data': data,
|
||||
'cmd': '_minion_event'}
|
||||
auth = salt.crypt.SAuth(__opts__)
|
||||
payload['load'] = auth.crypticle.dumps(load)
|
||||
auth = salt.crypt.SAuth(__opts__)
|
||||
socket.send(serial.dumps(payload))
|
||||
return auth.crypticle.loads(serial.loads(socket.recv()))
|
||||
|
Loading…
Reference in New Issue
Block a user