From: Sage Weil Date: Tue, 16 Jul 2019 14:18:50 +0000 (-0500) Subject: mgr/crash: improve validation on post X-Git-Tag: v14.2.5~61^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c3134abb147c7362454a7dc6d433eed66a730745;p=ceph.git mgr/crash: improve validation on post Signed-off-by: Sage Weil (cherry picked from commit 422871d63ea8069453c435bd5559bea68f942eaf) --- diff --git a/src/pybind/mgr/crash/module.py b/src/pybind/mgr/crash/module.py index 04a008bca9b7..6898f32c4526 100644 --- a/src/pybind/mgr/crash/module.py +++ b/src/pybind/mgr/crash/module.py @@ -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