summaryrefslogtreecommitdiff
path: root/ironic_python_agent/utils.py
diff options
context:
space:
mode:
authorDmitry Tantsur <dtantsur@protonmail.com>2020-06-26 15:14:38 +0200
committerDmitry Tantsur <dtantsur@protonmail.com>2020-06-26 15:19:04 +0200
commit0eee26ea66c752715d863dfa03f8490f6ff04100 (patch)
treedb0d9809bb914fa14c4f52404d3f10b2e2d8142a /ironic_python_agent/utils.py
parent46bf7e0ef4c9c3d17effdcc67accfac09f916cf1 (diff)
downloadironic-python-agent-0eee26ea66c752715d863dfa03f8490f6ff04100.tar.gz
Fix confusing logging when running asynchronous commands
We log them as completed when they start executing. Also fix a problem in remove_large_keys that prevented items with defaultdict from being logged. Change-Id: I34a06cc85f55c693416f8c4c9877d55d6affafc9
Diffstat (limited to 'ironic_python_agent/utils.py')
-rw-r--r--ironic_python_agent/utils.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/ironic_python_agent/utils.py b/ironic_python_agent/utils.py
index 211070ac..637737dd 100644
--- a/ironic_python_agent/utils.py
+++ b/ironic_python_agent/utils.py
@@ -634,10 +634,9 @@ _LARGE_KEYS = frozenset(['configdrive', 'system_logs'])
def remove_large_keys(var):
"""Remove specific keys from the var, recursing into dicts and lists."""
if isinstance(var, abc.Mapping):
- return var.__class__(
- (key, remove_large_keys(value)
- if key not in _LARGE_KEYS else '<...>')
- for key, value in var.items())
+ return {key: (remove_large_keys(value)
+ if key not in _LARGE_KEYS else '<...>')
+ for key, value in var.items()}
elif isinstance(var, abc.Sequence) and not isinstance(var, str):
return var.__class__(map(remove_large_keys, var))
else: