diff --git a/ceilometer/objectstore/swift_middleware.py b/ceilometer/objectstore/swift_middleware.py index 6ad6dc253..950bea321 100644 --- a/ceilometer/objectstore/swift_middleware.py +++ b/ceilometer/objectstore/swift_middleware.py @@ -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, diff --git a/tests/objectstore/test_swift_middleware.py b/tests/objectstore/test_swift_middleware.py index daafadc9e..f89214d66 100644 --- a/tests/objectstore/test_swift_middleware.py +++ b/tests/objectstore/test_swift_middleware.py @@ -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',