swift: configure RPC service correctly

This fixes bug #1124121

Change-Id: I51d476a7cb4aa3f261249ccd62965c44ab8584ea
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2013-02-13 14:30:45 +01:00
parent 85d086def3
commit cd90e6b428
2 changed files with 7 additions and 1 deletions

View File

@ -27,6 +27,7 @@ from ceilometer.openstack.common import cfg
from ceilometer.openstack.common import context
from ceilometer.openstack.common import timeutils
from ceilometer import pipeline
from ceilometer import service
from swift.common.utils import split_path
@ -51,7 +52,7 @@ class CeilometerMiddleware(object):
def __init__(self, app, conf):
self.app = app
cfg.CONF([], project='ceilometer')
service.prepare_service()
publisher_manager = dispatch.NameDispatchExtensionManager(
namespace=pipeline.PUBLISHER_NAMESPACE,
check_func=lambda x: True,

View File

@ -23,6 +23,7 @@ from webob import Request
from ceilometer.tests import base
from ceilometer.objectstore import swift_middleware
from ceilometer import pipeline
from ceilometer.openstack.common import cfg
class FakeApp(object):
@ -60,6 +61,10 @@ class TestSwiftMiddleware(base.TestCase):
def start_response(*args):
pass
def test_rpc_setup(self):
app = swift_middleware.CeilometerMiddleware(FakeApp(), {})
self.assertEqual(cfg.CONF.control_exchange, 'ceilometer')
def test_get(self):
app = swift_middleware.CeilometerMiddleware(FakeApp(), {})
req = Request.blank('/1.0/account/container/obj',