From: Sage Weil Date: Wed, 17 Jul 2019 22:00:57 +0000 (-0500) Subject: mgr/crash: don't make these methods static X-Git-Tag: v14.2.5~61^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d1b97f79497f9dcfef4dba30d51d10b0d4c18fc1;p=ceph.git mgr/crash: don't make these methods static Signed-off-by: Sage Weil (cherry picked from commit 32a4b510aa93664f2beaadecedc9ce6e8e87b931) --- diff --git a/src/pybind/mgr/crash/module.py b/src/pybind/mgr/crash/module.py index 214f8df3f89..0b40a444561 100644 --- a/src/pybind/mgr/crash/module.py +++ b/src/pybind/mgr/crash/module.py @@ -102,22 +102,20 @@ class Module(MgrModule): return handler(self, command, inbuf) - @staticmethod - def validate_crash_metadata(inbuf): + def time_from_string(self, timestr): + # drop the 'Z' timezone indication, it's always UTC + timestr = timestr.rstrip('Z') + return datetime.datetime.strptime(timestr, 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 = time_from_string(metadata['timestamp']) + raise AttributeError("missing '%s' field" % f) + time = self.time_from_string(metadata['timestamp']) return metadata - @staticmethod - def time_from_string(timestr): - # drop the 'Z' timezone indication, it's always UTC - timestr = timestr.rstrip('Z') - return datetime.datetime.strptime(timestr, DATEFMT) - def timestamp_filter(self, f): """ Filter crash reports by timestamp.