diff --git a/ceilometer/service.py b/ceilometer/service.py index e6e68ed2..aac72424 100644 --- a/ceilometer/service.py +++ b/ceilometer/service.py @@ -112,7 +112,7 @@ cfg.CONF.register_opt(COLL_OPT, 'collector') LOG = log.getLogger(__name__) -def prepare_service(argv=None): +def prepare_service(argv=None, config_files=None): oslo_i18n.enable_lazy() log.register_options(cfg.CONF) log_levels = (cfg.CONF.default_log_levels + @@ -121,7 +121,8 @@ def prepare_service(argv=None): if argv is None: argv = sys.argv cfg.CONF(argv[1:], project='ceilometer', validate_default_values=True, - version=version.version_info.version_string()) + version=version.version_info.version_string(), + default_config_files=config_files) log.setup(cfg.CONF, 'ceilometer') # NOTE(liusheng): guru cannot run with service under apache daemon, so when # ceilometer-api running with mod_wsgi, the argv is [], we don't start diff --git a/ceilometer/tests/functional/gabbi/fixtures.py b/ceilometer/tests/functional/gabbi/fixtures.py index 437b2e38..76ddd47e 100644 --- a/ceilometer/tests/functional/gabbi/fixtures.py +++ b/ceilometer/tests/functional/gabbi/fixtures.py @@ -56,7 +56,7 @@ class ConfigFixture(fixture.GabbiFixture): if db_url is None: raise case.SkipTest('No database connection configured') - service.prepare_service([]) + service.prepare_service(argv=[], config_files=[]) conf = fixture_config.Config().conf self.conf = conf opts.set_defaults(self.conf) diff --git a/ceilometer/tests/functional/test_notification.py b/ceilometer/tests/functional/test_notification.py index e55b6f5b..e053540c 100644 --- a/ceilometer/tests/functional/test_notification.py +++ b/ceilometer/tests/functional/test_notification.py @@ -199,7 +199,8 @@ class BaseRealNotification(tests_base.BaseTestCase): def setUp(self): super(BaseRealNotification, self).setUp() self.CONF = self.useFixture(fixture_config.Config()).conf - service.prepare_service([]) + # Dummy config file to avoid looking for system config + service.prepare_service(argv=[], config_files=[]) self.setup_messaging(self.CONF, 'nova') pipeline_cfg_file = self.setup_pipeline(['instance', 'memory']) @@ -452,7 +453,7 @@ class TestRealNotificationMultipleAgents(tests_base.BaseTestCase): def setUp(self): super(TestRealNotificationMultipleAgents, self).setUp() self.CONF = self.useFixture(fixture_config.Config()).conf - service.prepare_service([]) + service.prepare_service(argv=[], config_files=[]) self.setup_messaging(self.CONF, 'nova') pipeline_cfg_file = self.setup_pipeline(['instance', 'memory']) diff --git a/ceilometer/tests/unit/dispatcher/test_gnocchi.py b/ceilometer/tests/unit/dispatcher/test_gnocchi.py index 1c48c222..7c10f168 100644 --- a/ceilometer/tests/unit/dispatcher/test_gnocchi.py +++ b/ceilometer/tests/unit/dispatcher/test_gnocchi.py @@ -53,7 +53,7 @@ class DispatcherTest(base.BaseTestCase): def setUp(self): super(DispatcherTest, self).setUp() self.conf = self.useFixture(config_fixture.Config()) - ceilometer_service.prepare_service([]) + ceilometer_service.prepare_service(argv=[], config_files=[]) self.conf.config( resources_definition_file=self.path_get( 'etc/ceilometer/gnocchi_resources.yaml'), @@ -330,7 +330,7 @@ class DispatcherWorkflowTest(base.BaseTestCase, return_value=ks_client)) self.ks_client = ks_client - ceilometer_service.prepare_service([]) + ceilometer_service.prepare_service(argv=[], config_files=[]) self.conf.config( resources_definition_file=self.path_get( 'etc/ceilometer/gnocchi_resources.yaml'), diff --git a/ceilometer/tests/unit/meter/test_notifications.py b/ceilometer/tests/unit/meter/test_notifications.py index ba7f0eaf..30446b2a 100644 --- a/ceilometer/tests/unit/meter/test_notifications.py +++ b/ceilometer/tests/unit/meter/test_notifications.py @@ -193,7 +193,7 @@ class TestMeterProcessing(test.BaseTestCase): def setUp(self): super(TestMeterProcessing, self).setUp() self.CONF = self.useFixture(fixture_config.Config()).conf - ceilometer_service.prepare_service([]) + ceilometer_service.prepare_service(argv=[], config_files=[]) self.handler = notifications.ProcessMeterNotifications(mock.Mock()) def test_fallback_meter_path(self): diff --git a/ceilometer/tests/unit/network/statistics/opencontrail/test_client.py b/ceilometer/tests/unit/network/statistics/opencontrail/test_client.py index f0eec1f5..fdee69c9 100644 --- a/ceilometer/tests/unit/network/statistics/opencontrail/test_client.py +++ b/ceilometer/tests/unit/network/statistics/opencontrail/test_client.py @@ -25,7 +25,7 @@ class TestOpencontrailClient(base.BaseTestCase): def setUp(self): super(TestOpencontrailClient, self).setUp() self.conf = self.useFixture(config_fixture.Config()) - ceilometer_service.prepare_service([]) + ceilometer_service.prepare_service(argv=[], config_files=[]) self.client = client.Client('http://127.0.0.1:8081', {'arg1': 'aaa'}) self.get_resp = mock.MagicMock() diff --git a/ceilometer/tests/unit/network/statistics/opendaylight/test_client.py b/ceilometer/tests/unit/network/statistics/opendaylight/test_client.py index 5fa1f26d..7b2250ee 100644 --- a/ceilometer/tests/unit/network/statistics/opendaylight/test_client.py +++ b/ceilometer/tests/unit/network/statistics/opendaylight/test_client.py @@ -32,7 +32,7 @@ class TestClientHTTPBasicAuth(base.BaseTestCase): def setUp(self): super(TestClientHTTPBasicAuth, self).setUp() self.conf = self.useFixture(config_fixture.Config()) - ceilometer_service.prepare_service([]) + ceilometer_service.prepare_service(argv=[], config_files=[]) self.parsed_url = urlparse.urlparse( 'http://127.0.0.1:8080/controller/nb/v2?container_name=default&' 'container_name=egg&auth=%s&user=admin&password=admin_pass&'