Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug #294

Merged
merged 2 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions common/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ def __init__(self, stdio=None):
def run(self, cmd):
try:
self.stdio.verbose("[local host] run cmd = [{0}] on localhost".format(cmd))
cmd = "bash -c '{0}'".format(cmd)
out = subprocess.Popen(cmd, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, shell=True)
out = subprocess.Popen(cmd, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, shell=True, executable='/bin/bash')
stdout, stderr = out.communicate()
if stderr:
self.stdio.error("run cmd = [{0}] on localhost, stderr=[{1}]".format(cmd, stderr))
Expand All @@ -42,8 +41,7 @@ def run(self, cmd):
def run_get_stderr(self, cmd):
try:
self.stdio.verbose("run cmd = [{0}] on localhost".format(cmd))
cmd = "bash -c '{0}'".format(cmd)
out = subprocess.Popen(cmd, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, shell=True)
out = subprocess.Popen(cmd, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, shell=True, executable='/bin/bash')
stdout, stderr = out.communicate()
return stderr
except:
Expand Down Expand Up @@ -351,7 +349,6 @@ def get_observer_version_by_sql(ob_cluster, stdio=None):
ob_version_info = ob_connector.execute_sql("select version();")
except Exception as e:
raise Exception("get_observer_version_by_sql Exception. Maybe cluster'info is error: " + e.__str__())

ob_version = ob_version_info[0]
stdio.verbose("get_observer_version_by_sql ob_version_info is {0}".format(ob_version))
version = re.findall(r'OceanBase(_)?(.CE)?-v(.+)', ob_version[0])
Expand Down
6 changes: 2 additions & 4 deletions common/ssh_client/local_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ def __init__(self, context=None, node=None):
def exec_cmd(self, cmd):
try:
self.stdio.verbose("[local host] run cmd = [{0}] on localhost".format(cmd))
cmd = "bash -c '{0}'".format(cmd)
out = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, executable='/bin/bash')
stdout, stderr = out.communicate()
if stderr:
return stderr.decode('utf-8')
Expand All @@ -56,8 +55,7 @@ def ssh_invoke_shell_switch_user(self, new_user, cmd, time_out):
try:
cmd = "su - {0} -c '{1}'".format(new_user, cmd)
self.stdio.verbose("[local host] ssh_invoke_shell_switch_user cmd = [{0}] on localhost".format(cmd))
cmd = "bash -c '{0}'".format(cmd)
out = subprocess.Popen(cmd, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, shell=True)
out = subprocess.Popen(cmd, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, shell=True, executable='/bin/bash')
stdout, stderr = out.communicate()
if stderr:
return stderr.decode('utf-8')
Expand Down
3 changes: 1 addition & 2 deletions handler/checker/result/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ def _verify_base(self):
else:
real_shell = env + '="' + str(self.env_dict[env]) + '"\n' + real_shell
self.stdio.verbose("real_shell: {0}".format(real_shell))
real_shell = "bash -c '{0}'".format(real_shell)
process = subprocess.Popen(real_shell, shell=True, stdout=subprocess.PIPE)
process = subprocess.Popen(real_shell, shell=True, stdout=subprocess.PIPE, executable='/bin/bash')
out, err = process.communicate()
process.stdout.close()
result = out[:-1].decode('utf-8')
Expand Down
Loading