From: Sage Weil Date: Tue, 16 Jul 2019 14:18:50 +0000 (-0500) Subject: mgr/crash: improve validation on post X-Git-Tag: v15.1.0~2091^2~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=422871d63ea8069453c435bd5559bea68f942eaf;p=ceph.git mgr/crash: improve validation on post Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/crash/module.py b/src/pybind/mgr/crash/module.py index b639a282c83..12de0f5ba1b 100644 --- a/src/pybind/mgr/crash/module.py +++ b/src/pybind/mgr/crash/module.py @@ -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