]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/crash: improve validation on post
authorSage Weil <sage@redhat.com>
Tue, 16 Jul 2019 14:18:50 +0000 (09:18 -0500)
committerSage Weil <sage@redhat.com>
Fri, 15 Nov 2019 14:33:44 +0000 (08:33 -0600)
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 422871d63ea8069453c435bd5559bea68f942eaf)

src/pybind/mgr/crash/module.py

index 04a008bca9b77aecee44c4e60a02e7a2447984a4..6898f32c45265b7f4c811b37571e53238d4ae5dd 100644 (file)
@@ -107,8 +107,9 @@ class Module(MgrModule):
     def validate_crash_metadata(inbuf):
         # raise any exceptions to caller
         metadata = json.loads(inbuf)
-        if 'crash_id' not in metadata:
-            raise AttributeError("missing 'crash_id' field")
+        for f in ['crash_id', 'timestamp']:
+            if f not in metadata:
+                raise AttributeError("missing '%s' field" % (f))
         return metadata
 
     @staticmethod