Merge "Stop storing ramdisk logs with the introspection data"

This commit is contained in:
Jenkins 2016-03-01 12:28:28 +00:00 committed by Gerrit Code Review
commit 54f368ef97
3 changed files with 32 additions and 5 deletions

View File

@ -31,6 +31,7 @@ LOG = utils.getProcessingLogger(__name__)
_CREDENTIALS_WAIT_RETRIES = 10
_CREDENTIALS_WAIT_PERIOD = 3
_STORAGE_EXCLUDED_KEYS = {'logs'}
def _find_node_info(introspection_data, failures):
@ -148,7 +149,9 @@ def _process_node(node, introspection_data, node_info):
_run_post_hooks(node_info, introspection_data)
if CONF.processing.store_data == 'swift':
swift_object_name = swift.store_introspection_data(introspection_data,
stored_data = {k: v for k, v in introspection_data.items()
if k not in _STORAGE_EXCLUDED_KEYS}
swift_object_name = swift.store_introspection_data(stored_data,
node_info.uuid)
LOG.info(_LI('Introspection data was stored in Swift in object %s'),
swift_object_name,

View File

@ -403,11 +403,29 @@ class TestProcessNode(BaseTest):
CONF.set_override('store_data', 'swift', 'processing')
swift_conn = swift_mock.return_value
name = 'inspector_data-%s' % self.uuid
expected = json.dumps(self.data)
expected = self.data.copy()
self.call()
swift_conn.create_object.assert_called_once_with(name, expected)
swift_conn.create_object.assert_called_once_with(name, mock.ANY)
self.assertEqual(expected,
json.loads(swift_conn.create_object.call_args[0][1]))
self.assertCalledWithPatch(self.patch_props, self.cli.node.update)
@mock.patch.object(process.swift, 'SwiftAPI', autospec=True)
def test_store_data_no_logs(self, swift_mock, filters_mock,
post_hook_mock):
CONF.set_override('store_data', 'swift', 'processing')
swift_conn = swift_mock.return_value
name = 'inspector_data-%s' % self.uuid
expected = self.data.copy()
self.data['logs'] = 'something'
self.call()
swift_conn.create_object.assert_called_once_with(name, mock.ANY)
self.assertEqual(expected,
json.loads(swift_conn.create_object.call_args[0][1]))
self.assertCalledWithPatch(self.patch_props, self.cli.node.update)
@mock.patch.object(process.swift, 'SwiftAPI', autospec=True)
@ -423,9 +441,11 @@ class TestProcessNode(BaseTest):
'value': name,
'op': 'add'}
)
expected = json.dumps(self.data)
expected = self.data.copy()
self.call()
swift_conn.create_object.assert_called_once_with(name, expected)
swift_conn.create_object.assert_called_once_with(name, mock.ANY)
self.assertEqual(expected,
json.loads(swift_conn.create_object.call_args[0][1]))
self.assertCalledWithPatch(self.patch_props, self.cli.node.update)

View File

@ -0,0 +1,4 @@
---
upgrade:
- Ramdisk logs are no longer part of data stored to Swift and returned
by the API.