mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Change the socket to use a hash of the minion id
This commit is contained in:
parent
0cff0e4976
commit
3a0a4125d6
@ -9,6 +9,7 @@ import multiprocessing
|
||||
|
||||
import fnmatch
|
||||
import os
|
||||
import hashlib
|
||||
import re
|
||||
import threading
|
||||
import time
|
||||
@ -482,13 +483,14 @@ class Minion(object):
|
||||
# Prepare the minion event system
|
||||
#
|
||||
# Start with the publish socket
|
||||
id_hash = hashlib.md5(self.opts['id']).hexdigest()
|
||||
epub_sock_path = os.path.join(
|
||||
self.opts['sock_dir'],
|
||||
'minion_event_{0}_pub.ipc'.format(self.opts['id'])
|
||||
'minion_event_{0}_pub.ipc'.format(id_hash)
|
||||
)
|
||||
epull_sock_path = os.path.join(
|
||||
self.opts['sock_dir'],
|
||||
'minion_event_{0}_pull.ipc'.format(self.opts['id'])
|
||||
'minion_event_{0}_pull.ipc'.format(id_hash)
|
||||
)
|
||||
epub_sock = context.socket(zmq.PUB)
|
||||
if self.opts.get('ipc_mode', '') == 'tcp':
|
||||
|
@ -14,6 +14,7 @@ Manage events
|
||||
#
|
||||
# Import Python libs
|
||||
import os
|
||||
import hashlib
|
||||
import errno
|
||||
import logging
|
||||
import multiprocessing
|
||||
@ -43,6 +44,7 @@ class SaltEvent(object):
|
||||
Return the string uri for the location of the pull and pub sockets to
|
||||
use for firing and listening to events
|
||||
'''
|
||||
id_hash = hashlib.md5(kwargs.get('id', '')).hexdigest()
|
||||
if node == 'master':
|
||||
puburi = 'ipc://{0}'.format(os.path.join(
|
||||
sock_dir,
|
||||
@ -63,11 +65,11 @@ class SaltEvent(object):
|
||||
else:
|
||||
puburi = 'ipc://{0}'.format(os.path.join(
|
||||
sock_dir,
|
||||
'minion_event_{0}_pub.ipc'.format(kwargs.get('id', ''))
|
||||
'minion_event_{0}_pub.ipc'.format(id_hash)
|
||||
))
|
||||
pulluri = 'ipc://{0}'.format(os.path.join(
|
||||
sock_dir,
|
||||
'minion_event_{0}_pull.ipc'.format(kwargs.get('id', ''))
|
||||
'minion_event_{0}_pull.ipc'.format(id_hash)
|
||||
))
|
||||
log.debug(
|
||||
'{0} PUB socket URI: {1}'.format(self.__class__.__name__, puburi)
|
||||
|
Loading…
Reference in New Issue
Block a user