Skip to content

Commit 920b2eb

Browse files
author
阿绿
committed
PullRequest: 36 chore: export libs and check check version
Merge branch check_libs of [email protected]:oceanbase/OBShell-SDK-Python.git into master https://code.alipay.com/oceanbase/OBShell-SDK-Python/pull_requests/36 Signed-off-by: 甘霖 <[email protected]> * check version * opt
1 parent 900f616 commit 920b2eb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

obshell/ssh.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,11 @@ def check_remote_dir_empty(client: SshClient, work_dir: str):
254254
return ret and len(ret.stdout) == 0
255255

256256

257+
def check_observer_version(client: SshClient, work_dir: str):
258+
logger.debug(f"Check observer version in remote directory: {work_dir}")
259+
return client.execute(f"export LD_LIBRARY_PATH='{work_dir}/lib'; {work_dir}/bin/observer -V")
260+
261+
257262
def initialize_nodes(rpm_packages: List[str], force_clean: bool, configs: List[NodeConfig]):
258263
""" Initialize nodes by uploading RPM packages and optionally cleaning directories.
259264
@@ -308,6 +313,12 @@ def initialize_nodes(rpm_packages: List[str], force_clean: bool, configs: List[N
308313

309314
if not ret:
310315
raise Exception('Failed to create link %s -> %s: %s' % (dest_path, target_path, ret.stderr))
316+
317+
for ssh_client in ssh_clients.values():
318+
ret = check_observer_version(ssh_client, ssh_client.config.work_dir)
319+
if not ret:
320+
raise Exception(f'Check {ssh_client.config.ip}:{ssh_client.config.work_dir} observer version failed, maybe be oceanbase-ce-libs not installed. Reason: {ret.stderr}')
321+
311322
except Exception as e:
312323
raise e
313324
finally:

0 commit comments

Comments
 (0)