Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
wayyoungboy committed Aug 16, 2024
1 parent 40d6cd2 commit 53dfb46
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 deletions.
3 changes: 1 addition & 2 deletions core.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,7 @@ def gather_function(self, function_type, opt):
handler_log = GatherLogHandler(self.context)
handler_log.handle()
handler_obproxy = GatherObProxyLogHandler(self.context)
handler_obproxy.handle()
return ObdiagResult(ObdiagResult.SUCCESS_CODE, data={"store_dir": self.context.get_variable("store_dir")})
return handler_obproxy.handle()
elif function_type == 'gather_sysstat':
handler = GatherOsInfoHandler(self.context)
return handler.handle()
Expand Down
11 changes: 9 additions & 2 deletions diag_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,16 @@ def do_command(self):
if ROOT_IO.silent:
if isinstance(ret, ObdiagResult) is False:
ROOT_IO.error('The return value of the command is not ObdiagResult. Please contact thebase community. The return value is: {0}'.format(ret))
ret = ObdiagResult(code=ObdiagResult.SERVER_ERROR_CODE, error_data={"err_info": "The return value of the command is not ObdiagResult. Maybe the command not support silent. Please contact thebase community."})
ret = ObdiagResult(code=ObdiagResult.SERVER_ERROR_CODE, error_data= "The return value of the command is not ObdiagResult. Maybe the command not support silent. Please contact thebase community." )
ret.set_trace_id(self.trace_id)
ret.set_command(self.prev_cmd)

def args_to_str(args):
args_str = ""
for arg in args:
args_str += arg + " "
return args_str.strip()

ret.set_command(self.prev_cmd + " " + args_to_str(self.args))
ROOT_IO.set_silent(False)
ROOT_IO.print(ret.get_result())
ROOT_IO.set_silent(True)
Expand Down
4 changes: 2 additions & 2 deletions handler/gather/gather_scenes.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ def handle(self):
self.execute()
if self.is_inner:
result = self.__get_sql_result()
return ObdiagResult(ObdiagResult.SUCCESS_CODE, data={"store_dir": result})
return ObdiagResult(ObdiagResult.SUCCESS_CODE, data={"store_dir": self.report_path})
else:
return ObdiagResult(ObdiagResult.SUCCESS_CODE, data={"store_dir": result})
return ObdiagResult(ObdiagResult.SUCCESS_CODE, data={"store_dir": self.report_path})

def execute(self):
try:
Expand Down
6 changes: 4 additions & 2 deletions handler/gather/gather_tabledump.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ def handle(self):
return ObdiagResult(ObdiagResult.SERVER_ERROR_CODE, error_data="init failed")
excute_status = self.execute()
if not self.is_innner and excute_status:
return self.__print_result()
self.__print_result()
return ObdiagResult(ObdiagResult.SUCCESS_CODE, data={"store_dir": self.store_dir})
return ObdiagResult(ObdiagResult.SERVER_ERROR_CODE, error_data="execute failed")

def execute(self):
try:
Expand Down Expand Up @@ -255,4 +257,4 @@ def __print_result(self):
self.stdio.print("\nAnalyze SQL Summary:")
self.stdio.print(table)
self.stdio.print("\n")
return ObdiagResult(ObdiagResult.SERVER_ERROR_CODE, data={"firstrow": data})
return
16 changes: 8 additions & 8 deletions update/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ def execute(self):
return self.handle_update_offline(file_path)
if NetUtils.network_connectivity(remote_server) is False:
self.stdio.warn("[update] network connectivity failed. Please check your network connection.")
return ObdiagResult(ObdiagResult.SERVER_ERROR_CODE, error_data={"msg": "network connectivity failed. Please check your network connection."})
return ObdiagResult(ObdiagResult.SERVER_ERROR_CODE, error_data="network connectivity failed. Please check your network connection.")
NetUtils.download_file(remote_version_file_name, os.path.expanduser(local_version_file_name))
with open(local_version_file_name, 'r') as file:
remote_data = yaml.safe_load(file)
if remote_data.get("obdiag_version") is None:
self.stdio.warn("obdiag_version is None. Do not perform the upgrade process.")
return ObdiagResult(ObdiagResult.SERVER_ERROR_CODE, error_data={"msg": "obdiag_version is None. Do not perform the upgrade process."})
return ObdiagResult(ObdiagResult.SERVER_ERROR_CODE, error_data="obdiag_version is None. Do not perform the upgrade process.")
else:
self.remote_obdiag_version = remote_data["obdiag_version"].strip()
if StringUtils.compare_versions_greater(self.remote_obdiag_version, self.local_obdiag_version):
Expand All @@ -77,15 +77,15 @@ def execute(self):
)
return ObdiagResult(
ObdiagResult.SERVER_ERROR_CODE,
error_data={
"msg": "remote_obdiag_version is {0}. local_obdiag_version is {1}. "
"remote_obdiag_version>local_obdiag_version. Unable to update dependency files, please upgrade "
"obdiag. Do not perform the upgrade process.".format(self.remote_obdiag_version, self.local_obdiag_version)
},
error_data=
"remote_obdiag_version is {0}. local_obdiag_version is {1}. "
"remote_obdiag_version>local_obdiag_version. Unable to update dependency files, please upgrade "
"obdiag. Do not perform the upgrade process.".format(self.remote_obdiag_version, self.local_obdiag_version)
,
)
if remote_data.get("remote_tar_sha") is None:
self.stdio.warn("remote_tar_sha is None. Do not perform the upgrade process.")
return ObdiagResult(ObdiagResult.SERVER_ERROR_CODE, error_data={"msg": "remote_tar_sha is None. Do not perform the upgrade process."})
return ObdiagResult(ObdiagResult.SERVER_ERROR_CODE, error_data= "remote_tar_sha is None. Do not perform the upgrade process.")
else:
self.remote_tar_sha = remote_data["remote_tar_sha"]
# need update?
Expand Down

0 comments on commit 53dfb46

Please sign in to comment.