mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
update event system to bind to minion events properly
This commit is contained in:
parent
9446902d42
commit
7c29074903
@ -28,30 +28,46 @@ class SaltEvent(object):
|
||||
'''
|
||||
The base class used to manage salt events
|
||||
'''
|
||||
def __init__(self, sock_dir, node):
|
||||
def __init__(self, sock_dir, node, **kwargs):
|
||||
self.serial = salt.payload.Serial({'serial': 'msgpack'})
|
||||
self.context = zmq.Context()
|
||||
self.poller = zmq.Poller()
|
||||
self.cpub = False
|
||||
self.cpush = False
|
||||
self.puburi, self.pulluri = self.__load_uri(sock_dir, node, **kwargs)
|
||||
|
||||
def __load_uri(self, sock_dir, node, **kwargs):
|
||||
'''
|
||||
Return the string uri for the location of the pull and pub sockets to
|
||||
use for firing ind listening to events
|
||||
'''
|
||||
if node == 'master':
|
||||
self.puburi = 'ipc://{0}'.format(os.path.join(
|
||||
puburi = 'ipc://{0}'.format(os.path.join(
|
||||
sock_dir,
|
||||
'master_event_pub.ipc'
|
||||
))
|
||||
self.pulluri = 'ipc://{0}'.format(os.path.join(
|
||||
pulluri = 'ipc://{0}'.format(os.path.join(
|
||||
sock_dir,
|
||||
'master_event_pull.ipc'
|
||||
))
|
||||
return puburi, pulluri
|
||||
if kwargs.get('ipc_mode', '') == 'tcp':
|
||||
puburi = 'tcp://127.0.0.1:{0}'.format(
|
||||
kwargs.get('tcp_pub_port', 4510)
|
||||
)
|
||||
pulluri = 'tcp://127.0.0.1:{0}'.format(
|
||||
kwargs.get('tcp_pull_port', 4511)
|
||||
)
|
||||
else:
|
||||
self.puburi = 'ipc://{0}'.format(os.path.join(
|
||||
puburi = 'ipc://{0}'.format(os.path.join(
|
||||
sock_dir,
|
||||
'minion_event_pub.ipc'
|
||||
'minion_event_{0}_pub.ipc'.format(kwargs.get('id'), '')
|
||||
))
|
||||
self.pulluri = 'ipc://{0}'.format(os.path.join(
|
||||
pulluri = 'ipc://{0}'.format(os.path.join(
|
||||
sock_dir,
|
||||
'minion_event_pull.ipc'
|
||||
'minion_event_{0}_pull.ipc'.format(kwargs.get('id'), '')
|
||||
))
|
||||
return puburi, pulluri
|
||||
|
||||
def connect_pub(self):
|
||||
'''
|
||||
|
Loading…
Reference in New Issue
Block a user