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 stack #331

Merged
merged 17 commits into from
Jul 16, 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
2 changes: 1 addition & 1 deletion common/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def upload_file(ssh_client, local_path, remote_path, stdio=None):
"""
stdio.verbose("Please wait a moment, upload file to server {0}, local file path {1}, remote file path {2}".format(ssh_client.get_name(), local_path, remote_path))
try:
ssh_client.upload(local_path, remote_path)
ssh_client.upload(remote_path, local_path)
except Exception as e:
stdio.error("Upload File Failed error: {0}".format(e))

Expand Down
7 changes: 4 additions & 3 deletions handler/gather/gather_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,16 +304,17 @@ def __pharse_log(self, ssh_client, home_path, log_name, gather_path):
if type(self.grep_options) == str:
grep_cmd = "grep -e '{grep_options}' {log_dir}/{log_name} >> {gather_path}/{log_name} ".format(grep_options=self.grep_options, gather_path=gather_path, log_name=log_name, log_dir=log_path)
elif type(self.grep_options) == list and len(self.grep_options) > 0:
grep_litter_cmd = ""
for grep_option in self.grep_options:
if type(grep_option) != str:
self.stdio.error('The grep args must be string or list of strings, but got {0}'.format(type(grep_option)))
raise Exception('The grep args must be string or list of strings, but got {0}'.format(type(grep_option)))
elif grep_option == "":
self.stdio.warn('The grep args must be string or list of strings, but got ""')
continue
grep_litter_cmd += "| grep -e '{0}'".format(grep_option)
grep_cmd = "cat {log_dir}/{log_name} {grep_options} >> {gather_path}/{log_name} ".format(grep_options=grep_litter_cmd, gather_path=gather_path, log_name=log_name, log_dir=log_path)
if grep_cmd == "":
grep_cmd = "grep -e '{0}' ".format(grep_option) + "{log_dir}/{log_name}".format(log_name=log_name, log_dir=log_path)
grep_cmd += "| grep -e '{0}'".format(grep_option)
grep_cmd += " >> {gather_path}/{log_name} ".format(gather_path=gather_path, log_name=log_name, log_dir=log_path)
self.stdio.verbose('grep files, run cmd = [{0}]'.format(grep_cmd))
ssh_client.exec_cmd(grep_cmd)
else:
Expand Down
9 changes: 5 additions & 4 deletions handler/gather/gather_obproxy_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,17 +263,18 @@ def __pharse_log(self, ssh_client, home_path, log_name, gather_path):
if type(self.grep_args) == str:
grep_cmd = "grep -e '{grep_args}' {log_dir}/{log_name} >> {gather_path}/{log_name} ".format(grep_args=self.grep_args, gather_path=gather_path, log_name=log_name, log_dir=log_path)
elif type(self.grep_args) == list and len(self.grep_args) > 0:
grep_litter_cmd = ""
for grep_arg in self.grep_args:
if type(grep_arg) != str:
self.stdio.error('The grep args must be string or list of strings, but got {0}'.format(type(grep_arg)))
raise Exception('The grep args must be string or list of strings, but got {0}'.format(type(grep_arg)))
elif grep_arg == "":
self.stdio.warn('The grep args must be string or list of strings, but got ""')
continue
grep_litter_cmd += "| grep -e '{0}'".format(grep_arg)

grep_cmd = "cat {log_dir}/{log_name} {grep_args} >> {gather_path}/{log_name} ".format(grep_args=grep_litter_cmd, gather_path=gather_path, log_name=log_name, log_dir=log_path)
if grep_cmd == "":
grep_cmd = "grep -e '{0}' ".format(grep_arg) + "{log_dir}/{log_name}".format(log_name=log_name, log_dir=log_path)
continue
grep_cmd += "| grep -e '{0}'".format(grep_arg)
grep_cmd += " >> {log_dir}/{log_name}".format(log_name=log_name, log_dir=log_path)
self.stdio.verbose("grep files, run cmd = [{0}]".format(grep_cmd))
ssh_client.exec_cmd(grep_cmd)
else:
Expand Down
2 changes: 1 addition & 1 deletion handler/gather/gather_obstack2.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def __chmod_obstack2(self, ssh_client):

def __is_obstack_exists(self, ssh_client):
cmd = "test -e {file} && echo exists".format(file=const.OBSTACK2_DEFAULT_INSTALL_PATH)
stdout = ssh_client.exec_cmd(cmd)[0]
stdout = ssh_client.exec_cmd(cmd)
if stdout == 'exists':
return False
else:
Expand Down
7 changes: 1 addition & 6 deletions handler/rca/rca_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,7 @@ def __init__(self, context):
obproxy_version = ""
try:
if len(context_obproxy_nodes) > 0:
obproxy_version = get_obproxy_version(
True,
context_obproxy_nodes[0]["ssher"],
context_obproxy_nodes[0]["home_path"],
self.stdio,
)
obproxy_version = get_obproxy_version(context)
except Exception as e:
self.stdio.warn("RCAHandler.init Failed to get obproxy version. Error:{0}".format(e))
if obproxy_version != "":
Expand Down
Loading