From: Kefu Chai Date: Wed, 21 Jul 2021 03:07:55 +0000 (+0800) Subject: qa/tasks/vstart_runner: add optional "sudo" param to _run_python() X-Git-Tag: v17.1.0~1319^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0017df2006bda64973799ab50735477674c3a5cd;p=ceph.git qa/tasks/vstart_runner: add optional "sudo" param to _run_python() 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 --- diff --git a/qa/tasks/vstart_runner.py b/qa/tasks/vstart_runner.py index 55d8af8beea7..851816b2c3df 100644 --- a/qa/tasks/vstart_runner.py +++ b/qa/tasks/vstart_runner.py @@ -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):