From 32a4b510aa93664f2beaadecedc9ce6e8e87b931 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 17 Jul 2019 17:00:57 -0500 Subject: [PATCH] mgr/crash: don't make these methods static Signed-off-by: Sage Weil --- src/pybind/mgr/crash/module.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/pybind/mgr/crash/module.py b/src/pybind/mgr/crash/module.py index d825dcffed4..d8fd7bbc19a 100644 --- a/src/pybind/mgr/crash/module.py +++ b/src/pybind/mgr/crash/module.py @@ -103,18 +103,7 @@ class Module(MgrModule): return handler(self, command, inbuf) - @staticmethod - def validate_crash_metadata(inbuf): - # raise any exceptions to caller - metadata = json.loads(inbuf) - for f in ['crash_id', 'timestamp']: - if f not in metadata: - raise AttributeError("missing '%s' field" % (f)) - time = time_from_string(metadata['timestamp']) - return metadata - - @staticmethod - def time_from_string(timestr): + def time_from_string(self, timestr): # drop the 'Z' timezone indication, it's always UTC timestr = timestr.rstrip('Z') try: @@ -122,6 +111,15 @@ class Module(MgrModule): except ValueError: return datetime.datetime.strptime(timestr, OLD_DATEFMT) + def validate_crash_metadata(self, inbuf): + # raise any exceptions to caller + metadata = json.loads(inbuf) + for f in ['crash_id', 'timestamp']: + if f not in metadata: + raise AttributeError("missing '%s' field" % f) + time = self.time_from_string(metadata['timestamp']) + return metadata + def timestamp_filter(self, f): """ Filter crash reports by timestamp. -- 2.39.5