Merge "Stop storing ramdisk logs with the introspection data"
This commit is contained in:
commit
54f368ef97
|
@ -31,6 +31,7 @@ LOG = utils.getProcessingLogger(__name__)
|
||||||
|
|
||||||
_CREDENTIALS_WAIT_RETRIES = 10
|
_CREDENTIALS_WAIT_RETRIES = 10
|
||||||
_CREDENTIALS_WAIT_PERIOD = 3
|
_CREDENTIALS_WAIT_PERIOD = 3
|
||||||
|
_STORAGE_EXCLUDED_KEYS = {'logs'}
|
||||||
|
|
||||||
|
|
||||||
def _find_node_info(introspection_data, failures):
|
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)
|
_run_post_hooks(node_info, introspection_data)
|
||||||
|
|
||||||
if CONF.processing.store_data == 'swift':
|
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)
|
node_info.uuid)
|
||||||
LOG.info(_LI('Introspection data was stored in Swift in object %s'),
|
LOG.info(_LI('Introspection data was stored in Swift in object %s'),
|
||||||
swift_object_name,
|
swift_object_name,
|
||||||
|
|
|
@ -403,11 +403,29 @@ class TestProcessNode(BaseTest):
|
||||||
CONF.set_override('store_data', 'swift', 'processing')
|
CONF.set_override('store_data', 'swift', 'processing')
|
||||||
swift_conn = swift_mock.return_value
|
swift_conn = swift_mock.return_value
|
||||||
name = 'inspector_data-%s' % self.uuid
|
name = 'inspector_data-%s' % self.uuid
|
||||||
expected = json.dumps(self.data)
|
expected = self.data.copy()
|
||||||
|
|
||||||
self.call()
|
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)
|
self.assertCalledWithPatch(self.patch_props, self.cli.node.update)
|
||||||
|
|
||||||
@mock.patch.object(process.swift, 'SwiftAPI', autospec=True)
|
@mock.patch.object(process.swift, 'SwiftAPI', autospec=True)
|
||||||
|
@ -423,9 +441,11 @@ class TestProcessNode(BaseTest):
|
||||||
'value': name,
|
'value': name,
|
||||||
'op': 'add'}
|
'op': 'add'}
|
||||||
)
|
)
|
||||||
expected = json.dumps(self.data)
|
expected = self.data.copy()
|
||||||
|
|
||||||
self.call()
|
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)
|
self.assertCalledWithPatch(self.patch_props, self.cli.node.update)
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
upgrade:
|
||||||
|
- Ramdisk logs are no longer part of data stored to Swift and returned
|
||||||
|
by the API.
|
Loading…
Reference in New Issue