]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/telemetry: anonymizing smartctl report itself
authorYaarit Hatuka <yaarit@redhat.com>
Fri, 31 Jan 2020 21:44:30 +0000 (16:44 -0500)
committerYaarit Hatuka <yaarit@redhat.com>
Fri, 31 Jan 2020 21:44:30 +0000 (16:44 -0500)
smartctl JSON output contains the device's serial number in two
different keys ('serial_number' & 'output'). Serial is now obfuscated in
both.

Fixes: https://tracker.ceph.com/issues/43939
Signed-off-by: Yaarit Hatuka <yaarit@redhat.com>
src/pybind/mgr/telemetry/module.py

index ce8dd71e51a1ca63b7dbcfbda189dbcff4af1c8c..e782d01732e799e9ab7b296493d9186843108bf7 100644 (file)
@@ -395,9 +395,9 @@ class Module(MgrModule):
                                                            host, anon_host))
 
             # anonymize the smartctl report itself
-            for k in ['serial_number']:
-                if k in m:
-                    m.pop(k)
+            serial = devid.rsplit('_', 1)[1]
+            m_str = json.dumps(m)
+            m = json.loads(m_str.replace(serial, 'deleted'))
 
             if anon_host not in res:
                 res[anon_host] = {}