From c3134abb147c7362454a7dc6d433eed66a730745 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 16 Jul 2019 09:18:50 -0500 Subject: [PATCH] mgr/crash: improve validation on post Signed-off-by: Sage Weil (cherry picked from commit 422871d63ea8069453c435bd5559bea68f942eaf) --- src/pybind/mgr/crash/module.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/crash/module.py b/src/pybind/mgr/crash/module.py index 04a008bca9b77..6898f32c45265 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 -- 2.39.5