From d0b39463831ac818ba97ff7489685da1d8db5f60 Mon Sep 17 00:00:00 2001 From: Eric Windisch Date: Wed, 30 Jan 2013 20:48:05 -0500 Subject: Use importutils for matchmaker import. Per Vish's suggestion. this should be simplier, cull redundant code, and otherwise cut the fat. Change-Id: I9fa3effdc8e9e2f3f124690ecf77ee8bb7d4d39e --- openstack/common/rpc/impl_zmq.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'openstack') diff --git a/openstack/common/rpc/impl_zmq.py b/openstack/common/rpc/impl_zmq.py index 86d2bc5..ea461a7 100644 --- a/openstack/common/rpc/impl_zmq.py +++ b/openstack/common/rpc/impl_zmq.py @@ -17,7 +17,6 @@ import os import pprint import socket -import string import sys import types import uuid @@ -780,18 +779,5 @@ def _get_ctxt(): def _get_matchmaker(): global matchmaker if not matchmaker: - # rpc_zmq_matchmaker should be set to a 'module.Class' - mm_path = CONF.rpc_zmq_matchmaker.split('.') - mm_module = '.'.join(mm_path[:-1]) - mm_class = mm_path[-1] - - # Only initialize a class. - if mm_path[-1][0] not in string.ascii_uppercase: - LOG.error(_("Matchmaker could not be loaded.\n" - "rpc_zmq_matchmaker is not a class.")) - raise RPCException(_("Error loading Matchmaker.")) - - mm_impl = importutils.import_module(mm_module) - mm_constructor = getattr(mm_impl, mm_class) - matchmaker = mm_constructor() + matchmaker = importutils.import_object(CONF.rpc_zmq_matchmaker) return matchmaker -- cgit