pylinting, better log messages, docstrings, no logic changes

This commit is contained in:
vs 2014-07-03 10:38:06 -07:00
parent e6f8f02b14
commit df7b1b34f4

View File

@ -12,6 +12,9 @@ from collections import defaultdict
import salt.payload import salt.payload
import salt.auth import salt.auth
import salt.utils import salt.utils
import logging
log = logging.getLogger(__name__)
try: try:
from raet import raeting, nacling from raet import raeting, nacling
@ -25,6 +28,9 @@ except ImportError:
class Channel(object): class Channel(object):
'''
Factory class to create communication-channels for different transport
'''
@staticmethod @staticmethod
def factory(opts, **kwargs): def factory(opts, **kwargs):
# Default to ZeroMQ for now # Default to ZeroMQ for now
@ -143,11 +149,13 @@ class ZeroMQChannel(Channel):
if key not in ZeroMQChannel.sreq_cache: if key not in ZeroMQChannel.sreq_cache:
if self.opts['master_type'] == 'failover': if self.opts['master_type'] == 'failover':
# remove all cached sreqs to the old master # remove all cached sreqs to the old master to prevent
# zeromq from reconnecting to old masters automagically
for check_key in self.sreq_cache.keys(): for check_key in self.sreq_cache.keys():
if self.opts['master_uri'] != check_key[0]: if self.opts['master_uri'] != check_key[0]:
del self.sreq_cache[check_key] del self.sreq_cache[check_key]
print("removed {0}".format(check_key)) log.debug('Removed obsolete sreq-object from '
'sreq_cache for master {0}'.format(check_key[0]))
ZeroMQChannel.sreq_cache[key] = salt.payload.SREQ(self.master_uri) ZeroMQChannel.sreq_cache[key] = salt.payload.SREQ(self.master_uri)