]> git.apps.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)
committerSage Weil <sage@newdream.net>
Tue, 16 Mar 2021 13:00:59 +0000 (08:00 -0500)
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>
(cherry picked from commit 5dd9db970994530002df3da6be075974bfef2767)

src/pybind/mgr/prometheus/__init__.py
src/pybind/mgr/prometheus/module.py

index d39184947b44ae882779b3e00a06b1b4cab158af..af8d6616083e4dbcdfc44e08376b0c0b628f287e 100644 (file)
@@ -1 +1,2 @@
+# flake8: noqa
 from .module import Module, StandbyModule
index 6a38ed36ed9c116eb6cc9dbdcf965f2ca2f8ce18..a0f2a5024e3976b5e10f3754745310aa4adf5142 100644 (file)
@@ -230,7 +230,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)
@@ -951,9 +951,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']
@@ -1076,8 +1076,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