]> 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, 19 Jul 2019 14:43:04 +0000 (09:43 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/pybind/mgr/crash/module.py

index b639a282c835ca0bfa0cf70e29f3d613044458a7..12de0f5ba1bba5cb1dd897c1cd16999d0f1f1c78 100644 (file)
@@ -108,8 +108,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