mgr/telemetry: dict.pop() errs on nonexistent key

I suggested this in a review, but failed to correctly understand
what happens when the key doesn't exist.  Test for it.

Signed-off-by: Dan Mick <dan.mick@redhat.com>
This commit is contained in:
Dan Mick 2019-10-10 15:18:51 -07:00
parent 8cd683aa60
commit 19028f0d9d

View File

@ -336,7 +336,8 @@ class Module(MgrModule):
# anonymize the smartctl report itself
for k in ['serial_number']:
m.pop(k)
if k in m:
m.pop(k)
res[anon_devid] = m
return res