diff --git a/ceilometer/compute/notifications/cpu.py b/ceilometer/compute/notifications/cpu.py index bf718b9b8..7af186da3 100644 --- a/ceilometer/compute/notifications/cpu.py +++ b/ceilometer/compute/notifications/cpu.py @@ -39,15 +39,14 @@ class ComputeMetricsNotificationBase(notifications.ComputeNotificationBase): try: for metric in message['payload']['metrics']: if name == metric['name']: - info = {} - info['payload'] = metric - info['event_type'] = message['event_type'] - info['publisher_id'] = message['publisher_id'] - info['resource_id'] = '%s_%s' % ( - message['payload']['host'], - message['payload']['nodename']) - info['timestamp'] = str(timeutils.parse_strtime( - metric['timestamp'])) + info = {'payload': metric, + 'event_type': message['event_type'], + 'publisher_id': message['publisher_id'], + 'resource_id': '%s_%s' % ( + message['payload']['host'], + message['payload']['nodename']), + 'timestamp': str(timeutils.parse_strtime( + metric['timestamp']))} return info except Exception as err: LOG.warning(_('An error occurred while building %(m)s ' diff --git a/ceilometer/hardware/notifications/ipmi.py b/ceilometer/hardware/notifications/ipmi.py index 87adaa81f..deb69ce9d 100644 --- a/ceilometer/hardware/notifications/ipmi.py +++ b/ceilometer/hardware/notifications/ipmi.py @@ -96,14 +96,13 @@ class SensorNotification(plugin.NotificationBase): data) def _package_payload(self, message, payload): - info = {} - info['publisher_id'] = message['publisher_id'] - info['timestamp'] = message['payload']['timestamp'] - info['event_type'] = message['payload']['event_type'] - info['user_id'] = message['payload'].get('user_id') - info['project_id'] = message['payload'].get('project_id') # NOTE(chdent): How much of the payload should we keep? - info['payload'] = payload + info = {'publisher_id': message['publisher_id'], + 'timestamp': message['payload']['timestamp'], + 'event_type': message['payload']['event_type'], + 'user_id': message['payload'].get('user_id'), + 'project_id': message['payload'].get('project_id'), + 'payload': payload} return info def process_notification(self, message): diff --git a/ceilometer/tests/dispatcher/test_db.py b/ceilometer/tests/dispatcher/test_db.py index 9fab137c5..de9b0400a 100644 --- a/ceilometer/tests/dispatcher/test_db.py +++ b/ceilometer/tests/dispatcher/test_db.py @@ -53,8 +53,7 @@ class TestDispatcherDB(test.BaseTestCase): msg = {'counter_name': 'test', 'resource_id': self.id(), 'counter_volume': 1, - } - msg['message_signature'] = 'invalid-signature' + 'message_signature': 'invalid-signature'} class ErrorConnection: diff --git a/ceilometer/tests/network/statistics/opendaylight/test_client.py b/ceilometer/tests/network/statistics/opendaylight/test_client.py index aedfc1de7..ebb1ed7bb 100644 --- a/ceilometer/tests/network/statistics/opendaylight/test_client.py +++ b/ceilometer/tests/network/statistics/opendaylight/test_client.py @@ -39,10 +39,9 @@ class TestClientHTTPBasicAuth(test.BaseTestCase): self.parsed_url.netloc, self.parsed_url.path, None, None, None)) - odl_params = {} - odl_params['auth'] = self.params.get('auth')[0] - odl_params['user'] = self.params.get('user')[0] - odl_params['password'] = self.params.get('password')[0] + odl_params = {'auth': self.params.get('auth')[0], + 'user': self.params.get('user')[0], + 'password': self.params.get('password')[0]} self.client = client.Client(self.endpoint, odl_params) self.resp = mock.MagicMock() diff --git a/ceilometer/tests/network/test_floatingip.py b/ceilometer/tests/network/test_floatingip.py index 9e0987126..8985c0308 100644 --- a/ceilometer/tests/network/test_floatingip.py +++ b/ceilometer/tests/network/test_floatingip.py @@ -88,7 +88,6 @@ class TestFloatingIPPollster(test.BaseTestCase): self.assertEqual(set(['ip.floating']), set([s.name for s in samples])) def test_get_samples_cached(self): - cache = {} - cache['floating_ips'] = self.fake_get_ips()[:2] + cache = {'floating_ips': self.fake_get_ips()[:2]} samples = list(self.pollster.get_samples(self.manager, cache)) self.assertEqual(2, len(samples))