From 7b73fe24ce63e36dea924164c98e0a15fd1d7684 Mon Sep 17 00:00:00 2001 From: dongwenjuan Date: Wed, 8 Aug 2018 17:18:41 +0800 Subject: bugfix: kill the stunnel when cleanup Popen.terminate() will kill the child process, but if you set the shell argument to True, this is the process ID of the spawned shell, so the stunnels are still exit.It will cause the failure of stunnel setup in the next test runtime. see: https://stackoverflow.com/questions/4789837/how-to-terminate-a-python-subprocess-launched-with-shell-true/4791612#4791612 Change-Id: I578611510f5bd1eb0dbd9a08ab408ccf101594f7 Signed-off-by: dongwenjuan --- doctor_tests/installer/base.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'doctor_tests') diff --git a/doctor_tests/installer/base.py b/doctor_tests/installer/base.py index f312130a..f37b7f1a 100644 --- a/doctor_tests/installer/base.py +++ b/doctor_tests/installer/base.py @@ -64,16 +64,15 @@ class BaseInstaller(object): " -o StrictHostKeyChecking=no" " -i %s %s@%s -R %s:localhost:%s" " sleep 600 > ssh_tunnel.%s" - " 2>&1 < /dev/null &" + " 2>&1 < /dev/null " % (self.key_file, self.node_user_name, node_ip, self.conf.consumer.port, self.conf.consumer.port, node_ip)) - server = subprocess.Popen(cmd, shell=True) + server = subprocess.Popen('exec ' + cmd, shell=True) self.servers.append(server) - server.communicate() def _get_ssh_key(self, client, key_path): self.log.info('Get SSH keys from %s installer......' -- cgit 1.2.3-korg