initial addition of event system minion module

This commit is contained in:
Thomas S Hatch 2012-06-30 13:41:14 -06:00
parent e285aa8d5c
commit 27b5da0f82

25
salt/modules/event.py Normal file
View 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()))