]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/telemetry: dict.pop() errs on nonexistent key 30854/head
authorDan Mick <dan.mick@redhat.com>
Thu, 10 Oct 2019 22:18:51 +0000 (15:18 -0700)
committerDan Mick <dan.mick@redhat.com>
Thu, 10 Oct 2019 22:18:51 +0000 (15:18 -0700)
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>
src/pybind/mgr/telemetry/module.py

index 6065a52cbb805967cb4e54593b65d23502464eb8..e730903ea9fe67af6d32000b8def8d10371691bc 100644 (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