summaryrefslogtreecommitdiff
path: root/ironic/drivers/modules/inspector/interface.py
diff options
context:
space:
mode:
authorDmitry Tantsur <dtantsur@protonmail.com>2023-03-14 16:18:08 +0100
committerDmitry Tantsur <dtantsur@protonmail.com>2023-03-14 18:26:06 +0100
commite30ba65f94133f5829b477e1fe255aae1dc519e7 (patch)
tree765b4cedbf70a3c61fae5f9eac46a80d7afc2b3e /ironic/drivers/modules/inspector/interface.py
parent3dd54a11018f5f766cbbdaef4aac5e20cb76f7d6 (diff)
downloadironic-e30ba65f94133f5829b477e1fe255aae1dc519e7.tar.gz
Refactoring: clean up inspection data handlers
* Avoid using the term "introspection". We need to settle on either "inspection" or "introspection", and the Ironic API already uses the former. * Accept (and return) inventory and plugin data separately to reflect the Ironic API (single JSON blobs are an Inspector legacy). * Make sure to mention the container name in error logging. * Use more readable formatting syntax for building Swift names. * Do not mock objects with dicts (in unit tests). * Simplify inventory API tests. Change-Id: Id8c4bc6d35b9634f5a5ac2b345a8fd7f1dba13c0
Diffstat (limited to 'ironic/drivers/modules/inspector/interface.py')
-rw-r--r--ironic/drivers/modules/inspector/interface.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/ironic/drivers/modules/inspector/interface.py b/ironic/drivers/modules/inspector/interface.py
index 8792b7b88..e72077003 100644
--- a/ironic/drivers/modules/inspector/interface.py
+++ b/ironic/drivers/modules/inspector/interface.py
@@ -299,15 +299,17 @@ def _check_status(task):
_inspection_error_handler(task, error)
elif status.is_finished:
_clean_up(task)
- store_data = CONF.inventory.data_backend
- if store_data == 'none':
- LOG.debug('Introspection data storage is disabled, the data will '
- 'not be saved for node %(node)s', {'node': node.uuid})
+ if CONF.inventory.data_backend == 'none':
+ LOG.debug('Inspection data storage is disabled, the data will '
+ 'not be saved for node %s', node.uuid)
return
introspection_data = inspector_client.get_introspection_data(
node.uuid, processed=True)
- inspect_utils.store_introspection_data(node, introspection_data,
- task.context)
+ # TODO(dtantsur): having no inventory is an abnormal state, handle it.
+ inventory = introspection_data.pop('inventory', {})
+ inspect_utils.store_inspection_data(node, inventory,
+ introspection_data,
+ task.context)
def _clean_up(task):