diff options
author | Sage Weil <sage@redhat.com> | 2019-07-16 16:18:50 +0200 |
---|---|---|
committer | Sage Weil <sage@redhat.com> | 2019-07-19 16:43:04 +0200 |
commit | 422871d63ea8069453c435bd5559bea68f942eaf (patch) | |
tree | dd5814a32de7feb68bce9e531602578db51dcbb0 /src/pybind | |
parent | mgr/crash: automatically prune old crashes after a year (diff) | |
download | ceph-422871d63ea8069453c435bd5559bea68f942eaf.tar.xz ceph-422871d63ea8069453c435bd5559bea68f942eaf.zip |
mgr/crash: improve validation on post
Signed-off-by: Sage Weil <sage@redhat.com>
Diffstat (limited to 'src/pybind')
-rw-r--r-- | src/pybind/mgr/crash/module.py | 5 |
1 files changed, 3 insertions, 2 deletions
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 |