# Path: tuskar/openstack/common/importutils.py
# def import_class(import_str):
# def import_object(import_str, *args, **kwargs):
# def import_object_ns(name_space, import_str, *args, **kwargs):
# def import_module(import_str):
# def try_import(import_str, default=None):
# 
# Path: tuskar/openstack/common/log.py
# _DEFAULT_LOG_DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
# CONF = cfg.CONF
#     LEVEL_COLORS = {
#         logging.DEBUG: '\033[00;32m',  # GREEN
#         logging.INFO: '\033[00;36m',  # CYAN
#         logging.AUDIT: '\033[01;36m',  # BOLD CYAN
#         logging.WARN: '\033[01;33m',  # BOLD YELLOW
#         logging.ERROR: '\033[01;31m',  # BOLD RED
#         logging.CRITICAL: '\033[01;31m',  # BOLD RED
#     }
#     class NullHandler(logging.Handler):
# class BaseLoggerAdapter(logging.LoggerAdapter):
# class LazyAdapter(BaseLoggerAdapter):
# class ContextAdapter(BaseLoggerAdapter):
# class JSONFormatter(logging.Formatter):
# class LogConfigError(Exception):
# class WritableLogger(object):
# class ContextFormatter(logging.Formatter):
# class ColorHandler(logging.StreamHandler):
# class DeprecatedConfig(Exception):
#         def handle(self, record):
#         def emit(self, record):
#         def createLock(self):
# def _dictify_context(context):
# def _get_binary_name():
# def _get_log_file_path(binary=None):
#     def audit(self, msg, *args, **kwargs):
#     def __init__(self, name='unknown', version='unknown'):
#     def logger(self):
#     def __init__(self, logger, project_name, version_string):
#     def handlers(self):
#     def deprecated(self, msg, *args, **kwargs):
#     def process(self, msg, kwargs):
#     def __init__(self, fmt=None, datefmt=None):
#     def formatException(self, ei, strip_newlines=True):
#     def format(self, record):
# def _create_logging_excepthook(product_name):
#     def logging_excepthook(type, value, tb):
#     def __init__(self, log_config, err_msg):
#     def __str__(self):
# def _load_log_config(log_config):
# def setup(product_name):
# def set_defaults(logging_context_format_string):
# def _find_facility_from_conf():
# def _setup_logging_from_conf():
# def getLogger(name='unknown', version='unknown'):
# def getLazyLogger(name='unknown', version='unknown'):
#     def __init__(self, logger, level=logging.INFO):
#     def write(self, msg):
#     def format(self, record):
#     def formatException(self, exc_info, record=None):
#     def format(self, record):
#     def __init__(self, msg):
# 
# Path: tuskar/openstack/common/rpc/matchmaker.py
# CONF = cfg.CONF
# LOG = logging.getLogger(__name__)
# class MatchMakerException(Exception):
# class Exchange(object):
# class Binding(object):
# class MatchMakerBase(object):
# class HeartbeatMatchMakerBase(MatchMakerBase):
# class DirectBinding(Binding):
# class TopicBinding(Binding):
# class FanoutBinding(Binding):
# class StubExchange(Exchange):
# class LocalhostExchange(Exchange):
# class DirectExchange(Exchange):
# class MatchMakerLocalhost(MatchMakerBase):
# class MatchMakerStub(MatchMakerBase):
#     def __init__(self):
#     def run(self, key):
#     def __init__(self):
#     def test(self, key):
#     def __init__(self):
#     def register(self, key, host):
#     def ack_alive(self, key, host):
#     def is_alive(self, topic, host):
#     def expire(self, topic, host):
#     def send_heartbeats(self):
#     def unregister(self, key, host):
#     def start_heartbeat(self):
#     def stop_heartbeat(self):
#     def add_binding(self, binding, rule, last=True):
#     def queues(self, key):
#     def __init__(self):
#     def send_heartbeats(self):
#     def ack_alive(self, key, host):
#     def backend_register(self, key, host):
#     def backend_unregister(self, key, key_host):
#     def register(self, key, host):
#     def unregister(self, key, host):
#     def start_heartbeat(self):
#         def do_heartbeat():
#     def stop_heartbeat(self):
#     def test(self, key):
#     def test(self, key):
#     def test(self, key):
#     def run(self, key):
#     def __init__(self, host='localhost'):
#     def run(self, key):
#     def __init__(self):
#     def run(self, key):
#     def __init__(self, host='localhost'):
#     def __init__(self):


from oslo.config import cfg
from tuskar.openstack.common import importutils
from tuskar.openstack.common import log as logging
from tuskar.openstack.common.rpc import matchmaker as mm_common
"""
The MatchMaker classes should accept a Topic or Fanout exchange key and
return keys for direct exchanges, per (approximate) AMQP parlance.
"""



redis = importutils.try_import('redis')


matchmaker_redis_opts = [
    cfg.StrOpt('host',
               default='127.0.0.1',
               help='Host to locate redis'),
    cfg.IntOpt('port',
               default=6379,
               help='Use this port to connect to redis host.'),
    cfg.StrOpt('password',
               default=None,
               help='Password for Redis server. (optional)'),
]

CONF = cfg.CONF
opt_group = cfg.OptGroup(name='matchmaker_redis',
                         title='Options for Redis-based MatchMaker')
CONF.register_group(opt_group)
CONF.register_opts(matchmaker_redis_opts, opt_group)
LOG = logging.getLogger(__name__)



# Path: tuskar/openstack/common/importutils.py
# def import_class(import_str):
# def import_object(import_str, *args, **kwargs):
# def import_object_ns(name_space, import_str, *args, **kwargs):
# def import_module(import_str):
# def try_import(import_str, default=None):
# 
# Path: tuskar/openstack/common/log.py
# _DEFAULT_LOG_DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
# CONF = cfg.CONF
#     LEVEL_COLORS = {
#         logging.DEBUG: '\033[00;32m',  # GREEN
#         logging.INFO: '\033[00;36m',  # CYAN
#         logging.AUDIT: '\033[01;36m',  # BOLD CYAN
#         logging.WARN: '\033[01;33m',  # BOLD YELLOW
#         logging.ERROR: '\033[01;31m',  # BOLD RED
#         logging.CRITICAL: '\033[01;31m',  # BOLD RED
#     }
#     class NullHandler(logging.Handler):
# class BaseLoggerAdapter(logging.LoggerAdapter):
# class LazyAdapter(BaseLoggerAdapter):
# class ContextAdapter(BaseLoggerAdapter):
# class JSONFormatter(logging.Formatter):
# class LogConfigError(Exception):
# class WritableLogger(object):
# class ContextFormatter(logging.Formatter):
# class ColorHandler(logging.StreamHandler):
# class DeprecatedConfig(Exception):
#         def handle(self, record):
#         def emit(self, record):
#         def createLock(self):
# def _dictify_context(context):
# def _get_binary_name():
# def _get_log_file_path(binary=None):
#     def audit(self, msg, *args, **kwargs):
#     def __init__(self, name='unknown', version='unknown'):
#     def logger(self):
#     def __init__(self, logger, project_name, version_string):
#     def handlers(self):
#     def deprecated(self, msg, *args, **kwargs):
#     def process(self, msg, kwargs):
#     def __init__(self, fmt=None, datefmt=None):
#     def formatException(self, ei, strip_newlines=True):
#     def format(self, record):
# def _create_logging_excepthook(product_name):
#     def logging_excepthook(type, value, tb):
#     def __init__(self, log_config, err_msg):
#     def __str__(self):
# def _load_log_config(log_config):
# def setup(product_name):
# def set_defaults(logging_context_format_string):
# def _find_facility_from_conf():
# def _setup_logging_from_conf():
# def getLogger(name='unknown', version='unknown'):
# def getLazyLogger(name='unknown', version='unknown'):
#     def __init__(self, logger, level=logging.INFO):
#     def write(self, msg):
#     def format(self, record):
#     def formatException(self, exc_info, record=None):
#     def format(self, record):
#     def __init__(self, msg):
# 
# Path: tuskar/openstack/common/rpc/matchmaker.py
# CONF = cfg.CONF
# LOG = logging.getLogger(__name__)
# class MatchMakerException(Exception):
# class Exchange(object):
# class Binding(object):
# class MatchMakerBase(object):
# class HeartbeatMatchMakerBase(MatchMakerBase):
# class DirectBinding(Binding):
# class TopicBinding(Binding):
# class FanoutBinding(Binding):
# class StubExchange(Exchange):
# class LocalhostExchange(Exchange):
# class DirectExchange(Exchange):
# class MatchMakerLocalhost(MatchMakerBase):
# class MatchMakerStub(MatchMakerBase):
#     def __init__(self):
#     def run(self, key):
#     def __init__(self):
#     def test(self, key):
#     def __init__(self):
#     def register(self, key, host):
#     def ack_alive(self, key, host):
#     def is_alive(self, topic, host):
#     def expire(self, topic, host):
#     def send_heartbeats(self):
#     def unregister(self, key, host):
#     def start_heartbeat(self):
#     def stop_heartbeat(self):
#     def add_binding(self, binding, rule, last=True):
#     def queues(self, key):
#     def __init__(self):
#     def send_heartbeats(self):
#     def ack_alive(self, key, host):
#     def backend_register(self, key, host):
#     def backend_unregister(self, key, key_host):
#     def register(self, key, host):
#     def unregister(self, key, host):
#     def start_heartbeat(self):
#         def do_heartbeat():
#     def stop_heartbeat(self):
#     def test(self, key):
#     def test(self, key):
#     def test(self, key):
#     def run(self, key):
#     def __init__(self, host='localhost'):
#     def run(self, key):
#     def __init__(self):
#     def run(self, key):
#     def __init__(self, host='localhost'):
#     def __init__(self):


# Path: tuskar/openstack/common/rpc/matchmaker_redis.py
from oslo.config import cfg
from tuskar.openstack.common import importutils
from tuskar.openstack.common import log as logging
from tuskar.openstack.common.rpc import matchmaker as mm_common

"""
The MatchMaker classes should accept a Topic or Fanout exchange key and
return keys for direct exchanges, per (approximate) AMQP parlance.
"""



redis = importutils.try_import('redis')


matchmaker_redis_opts = [
    cfg.StrOpt('host',
               default='127.0.0.1',
               help='Host to locate redis'),
    cfg.IntOpt('port',
               default=6379,
               help='Use this port to connect to redis host.'),
    cfg.StrOpt('password',
               default=None,
               help='Password for Redis server. (optional)'),
]

CONF = cfg.CONF
opt_group = cfg.OptGroup(name='matchmaker_redis',
                         title='Options for Redis-based MatchMaker')
CONF.register_group(opt_group)
CONF.register_opts(matchmaker_redis_opts, opt_group)
LOG = logging.getLogger(__name__)



class RedisExchange(mm_common.Exchange):