]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/test_orchestrator: fix _get_ceph_daemons() 34689/head
authorAlfonso Martínez <almartin@redhat.com>
Wed, 22 Apr 2020 13:31:50 +0000 (15:31 +0200)
committerAlfonso Martínez <almartin@redhat.com>
Wed, 22 Apr 2020 13:41:13 +0000 (15:41 +0200)
* Improved regex to match appropriate processes' strings.
* Removed unused variables.

Fixes: https://tracker.ceph.com/issues/45186
Signed-off-by: Alfonso Martínez <almartin@redhat.com>
src/pybind/mgr/test_orchestrator/module.py

index 04942c4d1733ea800058d024500e9d7a956a4129..32fef723244537979d3c49b8f8ba2c801436988a 100644 (file)
@@ -165,11 +165,10 @@ class TestOrchestrator(MgrModule, orchestrator.Orchestrator):
         types = ("mds", "osd", "mon", "rgw", "mgr")
         out = map(str, check_output(['ps', 'aux']).splitlines())
         processes = [p for p in out if any(
-            [('ceph-' + t in p) for t in types])]
+            [('ceph-{} '.format(t) in p) for t in types])]
 
         daemons = []
         for p in processes:
-            daemon = orchestrator.DaemonDescription()
             # parse daemon type
             m = re.search('ceph-([^ ]+)', p)
             if m:
@@ -179,7 +178,6 @@ class TestOrchestrator(MgrModule, orchestrator.Orchestrator):
 
             # parse daemon ID. Possible options: `-i <id>`, `--id=<id>`, `--id <id>`
             patterns = [r'-i\s(\w+)', r'--id[\s=](\w+)']
-            daemon_id = None
             for pattern in patterns:
                 m = re.search(pattern, p)
                 if m: