Skip to content

Commit

Permalink
update remote_client when use remote_client_sudo (#716)
Browse files Browse the repository at this point in the history
* fix: major_hold_scene dmesg get

 add: version check task

* rca disconnection support env  'from' 'to'

* rca disconnection support env  'from' 'to'

* rca disconnection support env  'from' 'to'

* add check core_file is exist by kernel.core_pattern

* update check task: cluster.datafile_next

* rename DockerFile.dev && check ~/.bashrc exist

* fix major_hold download file

* add check add network_speed

* fix check task

* fix check task

* fix analyze_log when ret_key not exist, error_code_info is also not exist.

* fix analyze_log when ret_key not exist, error_code_info is also not exist.

* change find_cmd

* DBA_OB_TASK_OPT_STAT_GATHER_HISTORY. This view has been introduced since version 4.2.0.

* fix check task obld_version format

* fix check task old_version format

* fix check task old_version format

* after downland the file, clear the tmp package file

* fix delete GatherLogOnNode tmp_dir

* add check task

* obstack support aarch64

* obstack support aarch64

* obstack support aarch64

* obstack support aarch64

* obstack support aarch64

* obstack support aarch64

* obstack support aarch64

* update Jinja2 to 3.1.5

* update remote_client when use remote_client_sudo

* update remote_client when use remote_client_sudo
  • Loading branch information
wayyoungboy authored Jan 24, 2025
1 parent ef6b099 commit 37ac10d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/common/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ def get_observer_version(context):
return observer_version


# Please prioritize using get_observer_version
def get_observer_version_by_ssh(ssh_client, ob_install_dir, stdio):
"""
get observer version
Expand Down Expand Up @@ -310,8 +311,7 @@ def get_obproxy_version(context):


# Only applicable to the community version


# Please prioritize using get_observer_version
def get_observer_version_by_sql(context, ob_cluster):
context.stdio.verbose("start get_observer_version_by_sql . input: {0}:{1}".format(ob_cluster.get("db_host"), ob_cluster.get("db_port")))
try:
Expand Down
5 changes: 2 additions & 3 deletions src/common/ssh_client/remote_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,8 @@ def exec_cmd(self, cmd):
# check sudo without password
self.stdio.verbose("use remote_client_sudo")
stdin, stdout, stderr = self._ssh_fd.exec_command("sudo -n true")
if stderr:
if len(stderr.read().decode('utf-8').strip()) > 0:
raise Exception(stderr.read().decode('utf-8'))
if stderr or stdout.channel.recv_exit_status() > 0:
raise Exception("the node {0} does not have sudo permission without password".format(self.get_name()))
cmd = "sudo {0}".format(cmd)
cmd = cmd.replace("&&", "&& sudo ")
self.stdio.verbose('Execute Shell command on server {0}:{1}'.format(self.host_ip, cmd))
Expand Down
1 change: 1 addition & 0 deletions src/handler/gather/gather_component_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ def handle(self):
return
else:
self.stdio.verbose("gather_log_on_node {0} download log to local store_dir: {1}".format(self.ssh_client.get_ip(), self.store_dir))
self.ssh_client.exec_cmd("chomd -R a+rx {0}".format(self.tmp_dir))
self.ssh_client.download(tar_file, os.path.join(self.store_dir, os.path.basename("{0}".format(tar_file))))
self.stdio.verbose("download success. gather_log_on_node {0} delete tar file: {1}".format(self.ssh_client.get_ip(), tar_file))
self.ssh_client.exec_cmd("rm -rf {0}".format(tar_file))
Expand Down

0 comments on commit 37ac10d

Please sign in to comment.