Skip to content

Commit

Permalink
Merge pull request #294 from wayyoungboy/2.3.0-qulei
Browse files Browse the repository at this point in the history
fix bug
  • Loading branch information
Teingi authored Jul 3, 2024
2 parents 2151a8a + 274e573 commit d473583
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
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

0 comments on commit d473583

Please sign in to comment.