]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/crash: add crash to flake8 test
authorKefu Chai <kchai@redhat.com>
Wed, 10 Feb 2021 07:29:33 +0000 (15:29 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 10 Feb 2021 15:12:30 +0000 (23:12 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/pybind/mgr/crash/__init__.py
src/pybind/mgr/crash/module.py
src/pybind/mgr/tox.ini

index 8f210ac9247ea49624b20582ca8206e56055fbcd..ee85dc9d376e61235d719cf25585769bd07299a6 100644 (file)
@@ -1 +1,2 @@
+# flake8: noqa
 from .module import Module
index d386d2529a9ecee16b8b83a2062c68435e4c23fa..1cbe2026fb9365ac37c9eda8fde1f9100a91ed94 100644 (file)
@@ -42,13 +42,13 @@ class Module(MgrModule):
         Option(
             name='warn_recent_interval',
             type='secs',
-            default=60*60*24*14,
+            default=60 * 60 * 24 * 14,
             desc='time interval in which to warn about recent crashes',
             runtime=True),
         Option(
             name='retain_interval',
             type='secs',
-            default=60*60*24 * 365,
+            default=60 * 60 * 24 * 365,
             desc='how long to retain crashes before pruning them',
             runtime=True),
     ]
@@ -97,8 +97,8 @@ class Module(MgrModule):
             seconds=self.warn_recent_interval)
         recent = {
             crashid: crash for crashid, crash in self.crashes.items()
-            if (self.time_from_string(cast(str, crash['timestamp'])) > cutoff and
-                'archived' not in crash)
+            if (self.time_from_string(cast(str, crash['timestamp'])) > cutoff
+                and 'archived' not in crash)
         }
         num = len(recent)
         health_checks: Dict[str, Dict[str, Union[int, str, List[str]]]] = {}
@@ -284,7 +284,7 @@ class Module(MgrModule):
         """
         Remove crashes older than <keep> days
         """
-        self._prune(keep * 60*60*24)
+        self._prune(keep * datetime.timedelta(days=1).total_seconds())
         return 0, '', ''
 
     def _prune(self, seconds: float) -> None:
index 10c66b3a6a26f4ca7657542ee4135c73ce63de28..dd7e1a43d63b096b7245d88eb6965a8a77837bec 100644 (file)
@@ -116,6 +116,7 @@ deps =
     flake8
 modules =
     cephadm
+    crash
     devicehealth
     hello
     orchestrator