diff --git a/ceilometer/collector.py b/ceilometer/collector.py index 9db3ad43b..0ac00f26d 100644 --- a/ceilometer/collector.py +++ b/ceilometer/collector.py @@ -81,7 +81,6 @@ class CollectorService(service.DispatchedService, rpc_service.Service): sample['counter_type'] = sample['type'] LOG.debug("UDP: Storing %s", str(sample)) self.dispatcher_manager.map_method('record_metering_data', - None, sample) except Exception: LOG.exception(_("UDP: Unable to store meter")) @@ -107,7 +106,6 @@ class CollectorService(service.DispatchedService, rpc_service.Service): RPC publisher, this method receives them for processing. """ self.dispatcher_manager.map_method('record_metering_data', - context=context, data=data) diff --git a/ceilometer/dispatcher/__init__.py b/ceilometer/dispatcher/__init__.py index fff32b203..13b9ca88e 100644 --- a/ceilometer/dispatcher/__init__.py +++ b/ceilometer/dispatcher/__init__.py @@ -27,7 +27,7 @@ class Base(object): self.conf = conf @abc.abstractmethod - def record_metering_data(self, context, data): + def record_metering_data(self, data): """Recording metering data interface.""" @abc.abstractmethod diff --git a/ceilometer/dispatcher/database.py b/ceilometer/dispatcher/database.py index 9b98aa97d..fa00b7798 100644 --- a/ceilometer/dispatcher/database.py +++ b/ceilometer/dispatcher/database.py @@ -40,7 +40,7 @@ class DatabaseDispatcher(dispatcher.Base): super(DatabaseDispatcher, self).__init__(conf) self.storage_conn = storage.get_connection(conf) - def record_metering_data(self, context, data): + def record_metering_data(self, data): # We may have receive only one counter on the wire if not isinstance(data, list): data = [data] diff --git a/ceilometer/dispatcher/file.py b/ceilometer/dispatcher/file.py index bd83e3222..b4b5a2a17 100644 --- a/ceilometer/dispatcher/file.py +++ b/ceilometer/dispatcher/file.py @@ -78,7 +78,7 @@ class FileDispatcher(dispatcher.Base): dispatcher_logger.addHandler(rfh) self.log = dispatcher_logger - def record_metering_data(self, context, data): + def record_metering_data(self, data): if self.log: self.log.info(data) diff --git a/ceilometer/tests/dispatcher/test_db.py b/ceilometer/tests/dispatcher/test_db.py index 257e20117..80510841d 100644 --- a/ceilometer/tests/dispatcher/test_db.py +++ b/ceilometer/tests/dispatcher/test_db.py @@ -45,7 +45,7 @@ class TestDispatcherDB(test.BaseTestCase): with mock.patch.object(self.dispatcher.storage_conn, 'record_metering_data') as record_metering_data: - self.dispatcher.record_metering_data(self.ctx, msg) + self.dispatcher.record_metering_data(msg) record_metering_data.assert_called_once_with(msg) @@ -65,7 +65,7 @@ class TestDispatcherDB(test.BaseTestCase): self.dispatcher.storage_conn = ErrorConnection() - self.dispatcher.record_metering_data(self.ctx, msg) + self.dispatcher.record_metering_data(msg) assert not self.dispatcher.storage_conn.called, \ 'Should not have called the storage connection' @@ -86,7 +86,7 @@ class TestDispatcherDB(test.BaseTestCase): with mock.patch.object(self.dispatcher.storage_conn, 'record_metering_data') as record_metering_data: - self.dispatcher.record_metering_data(self.ctx, msg) + self.dispatcher.record_metering_data(msg) record_metering_data.assert_called_once_with(expected) @@ -107,6 +107,6 @@ class TestDispatcherDB(test.BaseTestCase): with mock.patch.object(self.dispatcher.storage_conn, 'record_metering_data') as record_metering_data: - self.dispatcher.record_metering_data(self.ctx, msg) + self.dispatcher.record_metering_data(msg) record_metering_data.assert_called_once_with(expected) diff --git a/ceilometer/tests/dispatcher/test_file.py b/ceilometer/tests/dispatcher/test_file.py index 1699c9bc9..098258618 100644 --- a/ceilometer/tests/dispatcher/test_file.py +++ b/ceilometer/tests/dispatcher/test_file.py @@ -59,7 +59,7 @@ class TestDispatcherFile(test.BaseTestCase): ) # The record_metering_data method should exist and not produce errors. - dispatcher.record_metering_data(None, msg) + dispatcher.record_metering_data(msg) # After the method call above, the file should have been created. self.assertTrue(os.path.exists(handler.baseFilename)) @@ -91,7 +91,7 @@ class TestDispatcherFile(test.BaseTestCase): ) # The record_metering_data method should exist and not produce errors. - dispatcher.record_metering_data(None, msg) + dispatcher.record_metering_data(msg) # After the method call above, the file should have been created. self.assertTrue(os.path.exists(handler.baseFilename)) diff --git a/ceilometer/tests/test_collector.py b/ceilometer/tests/test_collector.py index ebc37d790..74ee4880c 100644 --- a/ceilometer/tests/test_collector.py +++ b/ceilometer/tests/test_collector.py @@ -77,7 +77,6 @@ class TestCollector(tests_base.BaseTestCase): self.srv.record_metering_data(None, self.counter) mock_dispatcher.record_metering_data.assert_called_once_with( - context=None, data=self.counter) def test_udp_receive(self): @@ -102,7 +101,6 @@ class TestCollector(tests_base.BaseTestCase): self._verify_udp_socket(udp_socket) mock_dispatcher.record_metering_data.assert_called_once_with( - None, self.counter) def test_udp_receive_storage_error(self): @@ -129,7 +127,6 @@ class TestCollector(tests_base.BaseTestCase): self._verify_udp_socket(udp_socket) mock_dispatcher.record_metering_data.assert_called_once_with( - None, self.counter) @staticmethod