]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/prometheus: add prometheus to flake8 test
authorKefu Chai <kchai@redhat.com>
Wed, 10 Feb 2021 07:49:03 +0000 (15:49 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 10 Feb 2021 15:31:05 +0000 (23:31 +0800)
for the explanation why we should add a line break before a binary
operator. see
https://www.python.org/dev/peps/pep-0008/#should-a-line-break-before-or-after-a-binary-operator

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/pybind/mgr/prometheus/__init__.py
src/pybind/mgr/prometheus/module.py
src/pybind/mgr/tox.ini

index d39184947b44ae882779b3e00a06b1b4cab158af..af8d6616083e4dbcdfc44e08376b0c0b628f287e 100644 (file)
@@ -1 +1,2 @@
+# flake8: noqa
 from .module import Module, StandbyModule
index 587dbd3ba25218e46f8abd9917a186b8c8611430..5400dbbf7e7c7879e58cc7e38c43b11d4855915c 100644 (file)
@@ -201,7 +201,7 @@ class MetricCollectionThread(threading.Thread):
 
                 try:
                     data = self.mod.collect()
-                except:
+                except Exception:
                     # Log any issues encountered during the data collection and continue
                     self.mod.log.exception("failed to collect metrics:")
                     self.event.wait(self.mod.scrape_interval)
@@ -922,9 +922,9 @@ class Module(MgrModule):
         else:
             namespace_regex = '^(.*)$'
 
-        if 'query' in self.rbd_stats and \
-           (pool_id_regex != self.rbd_stats['query']['key_descriptor'][0]['regex'] or
-                namespace_regex != self.rbd_stats['query']['key_descriptor'][1]['regex']):
+        if ('query' in self.rbd_stats
+            and (pool_id_regex != self.rbd_stats['query']['key_descriptor'][0]['regex']
+                 or namespace_regex != self.rbd_stats['query']['key_descriptor'][1]['regex'])):
             self.remove_osd_perf_query(self.rbd_stats['query_id'])
             del self.rbd_stats['query_id']
             del self.rbd_stats['query']
@@ -1047,8 +1047,8 @@ class Module(MgrModule):
                         if nspace_name not in nspace_names:
                             del pool['images'][nspace_name]
                     for nspace_name in nspace_names:
-                        if (nspace_name and
-                                not rbd.namespace_exists(ioctx, nspace_name)):
+                        if nspace_name and\
+                           not rbd.namespace_exists(ioctx, nspace_name):
                             self.log.debug('unknown namespace %s for pool %s' %
                                            (nspace_name, pool_name))
                             continue
index 8be4bd90eccbf02fdbcdb843e84e6938303a84d5..36c9ef9eec649161e02b3166f733b2a77f3b3df3 100644 (file)
@@ -121,6 +121,7 @@ modules =
     devicehealth
     hello
     orchestrator
+    prometheus
 commands =
     flake8 --config=tox.ini {posargs} \
       {posargs:{[testenv:flake8]modules}}