mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Make event based LaneStacks have unique names so there are no collisions
This commit is contained in:
parent
6b34d360be
commit
73b5a3ca54
@ -112,7 +112,10 @@ def get_event(node, sock_dir=None, transport='zeromq', opts=None, listen=True):
|
||||
return SaltEvent(node, sock_dir, opts)
|
||||
elif transport == 'raet':
|
||||
import salt.utils.raetevent
|
||||
return salt.utils.raetevent.SaltEvent(node, sock_dir, listen)
|
||||
return salt.utils.raetevent.SaltEvent(node,
|
||||
sock_dir=sock_dir,
|
||||
listen=listen,
|
||||
opts=opts)
|
||||
|
||||
|
||||
def tagify(suffix='', prefix='', base=SALT):
|
||||
|
@ -6,6 +6,7 @@ This module is used to manage events via RAET
|
||||
'''
|
||||
|
||||
# Import python libs
|
||||
import os
|
||||
import logging
|
||||
import time
|
||||
from collections import MutableMapping
|
||||
@ -26,21 +27,30 @@ class SaltEvent(object):
|
||||
'''
|
||||
The base class used to manage salt events
|
||||
'''
|
||||
def __init__(self, node, sock_dir=None, listen=True):
|
||||
def __init__(self, node, sock_dir=None, listen=True, opts=None):
|
||||
'''
|
||||
Set up the stack and remote yard
|
||||
'''
|
||||
self.node = node
|
||||
self.sock_dir = sock_dir
|
||||
self.listen = listen
|
||||
if opts is None:
|
||||
opts = {}
|
||||
self.opts = opts
|
||||
self.__prep_stack()
|
||||
|
||||
def __prep_stack(self):
|
||||
self.yid = salt.utils.gen_jid()
|
||||
name = 'event' + self.yid
|
||||
cachedir = self.opts.get('cachedir', os.path.join('/var/cache/salt', self.node))
|
||||
basedirpath = os.path.abspath(
|
||||
os.path.join(cachedir, 'raet'))
|
||||
self.connected = False
|
||||
self.stack = LaneStack(
|
||||
name=name,
|
||||
yid=self.yid,
|
||||
lanename=self.node,
|
||||
basedirpath=basedirpath,
|
||||
sockdirpath=self.sock_dir)
|
||||
self.stack.Pk = raeting.packKinds.pack
|
||||
self.router_yard = RemoteYard(
|
||||
|
Loading…
Reference in New Issue
Block a user