]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks/vstart_runner: add optional "sudo" param to _run_python()
authorKefu Chai <kchai@redhat.com>
Wed, 21 Jul 2021 03:07:55 +0000 (11:07 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 22 Jul 2021 02:08:27 +0000 (10:08 +0800)
to silence mypy warnings like:

tasks/vstart_runner.py:691: error: Definition of "_run_python" in base class "LocalCephFSMount" is incompatible with definition in base class "CephFSMount"
tasks/vstart_runner.py:705: error: Definition of "_run_python" in base class "LocalCephFSMount" is incompatible with definition in base class "CephFSMount"

Signed-off-by: Kefu Chai <kchai@redhat.com>
qa/tasks/vstart_runner.py

index 55d8af8beea760ec2aa44b80c1c918b3d0e4f2b9..851816b2c3df595db14a2759ad28d474198891d3 100644 (file)
@@ -659,12 +659,16 @@ class LocalCephFSMount():
         path = "{0}/client.{1}.*.asok".format(d, self.client_id)
         return path
 
-    def _run_python(self, pyscript, py_version='python'):
+    def _run_python(self, pyscript, py_version='python', sudo=False):
         """
         Override this to remove the daemon-helper prefix that is used otherwise
         to make the process killable.
         """
-        return self.client_remote.run(args=[py_version, '-c', pyscript],
+        args = []
+        if sudo:
+            args.append('sudo')
+        args += [py_version, '-c', pyscript]
+        return self.client_remote.run(args=args,
                                       wait=False, stdout=StringIO())
 
     def setup_netns(self):