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: v15.1.0~2091^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=32a4b510aa93664f2beaadecedc9ce6e8e87b931;p=ceph.git mgr/crash: don't make these methods static Signed-off-by: Sage Weil --- 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.