# Path: tuskar/openstack/common/rpc/common.py
# CONF = cfg.CONF
# LOG = logging.getLogger(__name__)
# _RPC_ENVELOPE_VERSION = '2.0'
# _VERSION_KEY = 'oslo.version'
# _MESSAGE_KEY = 'oslo.message'
#     SANITIZE = {'set_admin_password': [('args', 'new_pass')],
#                 'run_instance': [('args', 'admin_password')],
#                 'route_message': [('args', 'message', 'args', 'method_info',
#                                    'method_kwargs', 'password'),
#                                   ('args', 'message', 'args', 'method_info',
#                                    'method_kwargs', 'admin_password')]}
# class RPCException(Exception):
# class RemoteError(RPCException):
# class Timeout(RPCException):
# class DuplicateMessageError(RPCException):
# class InvalidRPCConnectionReuse(RPCException):
# class UnsupportedRpcVersion(RPCException):
# class UnsupportedRpcEnvelopeVersion(RPCException):
# class RpcVersionCapError(RPCException):
# class Connection(object):
# class CommonRpcContext(object):
# class ClientException(Exception):
#     def __init__(self, message=None, **kwargs):
#     def __init__(self, exc_type=None, value=None, traceback=None):
#     def __init__(self, info=None, topic=None, method=None):
#     def close(self):
#     def create_consumer(self, topic, proxy, fanout=False):
#     def create_worker(self, topic, proxy, pool_name):
#     def join_consumer_pool(self, callback, pool_name, topic, exchange_name):
#     def consume_in_thread(self):
# def _safe_log(log_func, msg, msg_data):
# def serialize_remote_exception(failure_info, log_failure=True):
# def deserialize_remote_exception(conf, data):
#     def __init__(self, **kwargs):
#     def __getattr__(self, key):
#     def to_dict(self):
#     def from_dict(cls, values):
#     def deepcopy(self):
#     def update_store(self):
#     def elevated(self, read_deleted=None, overwrite=False):
#     def __init__(self):
# def catch_client_exception(exceptions, func, *args, **kwargs):
# def client_exceptions(*exceptions):
#     def outer(func):
#         def inner(*args, **kwargs):
# def version_is_compatible(imp_version, version):
# def serialize_msg(raw_msg):
# def deserialize_msg(msg):
# 
# Path: tuskar/openstack/common/rpc/serializer.py
# class Serializer(object):
# class NoOpSerializer(Serializer):
#     def serialize_entity(self, context, entity):
#     def deserialize_entity(self, context, entity):
#     def serialize_entity(self, context, entity):
#     def deserialize_entity(self, context, entity):


from tuskar.openstack.common.rpc import common as rpc_common
from tuskar.openstack.common.rpc import serializer as rpc_serializer
    def some_remote_method(self, arg1, arg2, newarg=None):
        # The code needs to deal with newarg=None for cases
        # where an older client sends a message without it.
        pass

On the client side, the same changes should be made as in example 1.  The
minimum version that supports the new parameter should be specified.
"""



class RpcDispatcher(object):
    """Dispatch rpc messages according to the requested API version.

    This class can be used as the top level 'manager' for a service.  It
    contains a list of underlying managers that have an API_VERSION attribute.
    """

    def __init__(self, callbacks, serializer=None):
        """Initialize the rpc dispatcher.

        :param callbacks: List of proxy objects that are an instance
                          of a class with rpc methods exposed.  Each proxy
                          object should have an RPC_API_VERSION attribute.
        :param serializer: The Serializer object that will be used to
                           deserialize arguments before the method call and
                           to serialize the result after it returns.
        """
        self.callbacks = callbacks
        if serializer is None:

# Path: tuskar/openstack/common/rpc/common.py
# CONF = cfg.CONF
# LOG = logging.getLogger(__name__)
# _RPC_ENVELOPE_VERSION = '2.0'
# _VERSION_KEY = 'oslo.version'
# _MESSAGE_KEY = 'oslo.message'
#     SANITIZE = {'set_admin_password': [('args', 'new_pass')],
#                 'run_instance': [('args', 'admin_password')],
#                 'route_message': [('args', 'message', 'args', 'method_info',
#                                    'method_kwargs', 'password'),
#                                   ('args', 'message', 'args', 'method_info',
#                                    'method_kwargs', 'admin_password')]}
# class RPCException(Exception):
# class RemoteError(RPCException):
# class Timeout(RPCException):
# class DuplicateMessageError(RPCException):
# class InvalidRPCConnectionReuse(RPCException):
# class UnsupportedRpcVersion(RPCException):
# class UnsupportedRpcEnvelopeVersion(RPCException):
# class RpcVersionCapError(RPCException):
# class Connection(object):
# class CommonRpcContext(object):
# class ClientException(Exception):
#     def __init__(self, message=None, **kwargs):
#     def __init__(self, exc_type=None, value=None, traceback=None):
#     def __init__(self, info=None, topic=None, method=None):
#     def close(self):
#     def create_consumer(self, topic, proxy, fanout=False):
#     def create_worker(self, topic, proxy, pool_name):
#     def join_consumer_pool(self, callback, pool_name, topic, exchange_name):
#     def consume_in_thread(self):
# def _safe_log(log_func, msg, msg_data):
# def serialize_remote_exception(failure_info, log_failure=True):
# def deserialize_remote_exception(conf, data):
#     def __init__(self, **kwargs):
#     def __getattr__(self, key):
#     def to_dict(self):
#     def from_dict(cls, values):
#     def deepcopy(self):
#     def update_store(self):
#     def elevated(self, read_deleted=None, overwrite=False):
#     def __init__(self):
# def catch_client_exception(exceptions, func, *args, **kwargs):
# def client_exceptions(*exceptions):
#     def outer(func):
#         def inner(*args, **kwargs):
# def version_is_compatible(imp_version, version):
# def serialize_msg(raw_msg):
# def deserialize_msg(msg):
# 
# Path: tuskar/openstack/common/rpc/serializer.py
# class Serializer(object):
# class NoOpSerializer(Serializer):
#     def serialize_entity(self, context, entity):
#     def deserialize_entity(self, context, entity):
#     def serialize_entity(self, context, entity):
#     def deserialize_entity(self, context, entity):


# Path: tuskar/openstack/common/rpc/dispatcher.py
from tuskar.openstack.common.rpc import common as rpc_common
from tuskar.openstack.common.rpc import serializer as rpc_serializer

    def some_remote_method(self, arg1, arg2, newarg=None):
        # The code needs to deal with newarg=None for cases
        # where an older client sends a message without it.
        pass

On the client side, the same changes should be made as in example 1.  The
minimum version that supports the new parameter should be specified.
"""



class RpcDispatcher(object):
    """Dispatch rpc messages according to the requested API version.

    This class can be used as the top level 'manager' for a service.  It
    contains a list of underlying managers that have an API_VERSION attribute.
    """

    def __init__(self, callbacks, serializer=None):
        """Initialize the rpc dispatcher.

        :param callbacks: List of proxy objects that are an instance
                          of a class with rpc methods exposed.  Each proxy
                          object should have an RPC_API_VERSION attribute.
        :param serializer: The Serializer object that will be used to
                           deserialize arguments before the method call and
                           to serialize the result after it returns.
        """
        self.callbacks = callbacks
        if serializer is None:

            serializer = rpc_serializer.NoOpSerializer()