diff --git a/script/gs_check b/script/gs_check index 7cac364..05d5625 100644 --- a/script/gs_check +++ b/script/gs_check @@ -29,6 +29,16 @@ import time import pwd import grp import pickle +package_path = os.path.dirname(os.path.realpath(__file__)) +ld_path = package_path + "/gspylib/clib" +if 'LD_LIBRARY_PATH' not in os.environ: + os.environ['LD_LIBRARY_PATH'] = ld_path + os.execve(os.path.realpath(__file__), sys.argv, os.environ) +if not os.environ.get('LD_LIBRARY_PATH').startswith(ld_path): + os.environ['LD_LIBRARY_PATH'] = \ + ld_path + ":" + os.environ['LD_LIBRARY_PATH'] + os.execve(os.path.realpath(__file__), sys.argv, os.environ) + import xml.etree.cElementTree as ETree from itertools import combinations from datetime import datetime, timedelta diff --git a/script/gs_install b/script/gs_install index cd6bfb0..1c60f8b 100644 --- a/script/gs_install +++ b/script/gs_install @@ -21,6 +21,15 @@ import os import sys +package_path = os.path.dirname(os.path.realpath(__file__)) +ld_path = package_path + "/gspylib/clib" +if 'LD_LIBRARY_PATH' not in os.environ: + os.environ['LD_LIBRARY_PATH'] = ld_path + os.execve(os.path.realpath(__file__), sys.argv, os.environ) +if not os.environ.get('LD_LIBRARY_PATH').startswith(ld_path): + os.environ['LD_LIBRARY_PATH'] = \ + ld_path + ":" + os.environ['LD_LIBRARY_PATH'] + os.execve(os.path.realpath(__file__), sys.argv, os.environ) sys.path.append(sys.path[0]) from gspylib.common.GaussLog import GaussLog diff --git a/script/gs_postuninstall b/script/gs_postuninstall index 30f2027..0a1f8d9 100644 --- a/script/gs_postuninstall +++ b/script/gs_postuninstall @@ -31,7 +31,7 @@ ld_path = package_path + "/gspylib/clib" if 'LD_LIBRARY_PATH' not in os.environ: os.environ['LD_LIBRARY_PATH'] = ld_path os.execve(os.path.realpath(__file__), sys.argv, os.environ) -if ld_path not in os.environ.get('LD_LIBRARY_PATH'): +if not os.environ.get('LD_LIBRARY_PATH').startswith(ld_path): os.environ['LD_LIBRARY_PATH'] = \ ld_path + ":" + os.environ['LD_LIBRARY_PATH'] os.execve(os.path.realpath(__file__), sys.argv, os.environ) diff --git a/script/gs_preinstall b/script/gs_preinstall index abc8141..e9e4194 100644 --- a/script/gs_preinstall +++ b/script/gs_preinstall @@ -318,9 +318,9 @@ General options: ld_path = package_path + "/gspylib/clib" rerun = True - if not 'LD_LIBRARY_PATH' in os.environ: + if 'LD_LIBRARY_PATH' not in os.environ: os.environ['LD_LIBRARY_PATH'] = ld_path - elif not ld_path in os.environ.get('LD_LIBRARY_PATH'): + elif not os.environ.get('LD_LIBRARY_PATH').startswith(ld_path): os.environ['LD_LIBRARY_PATH'] = \ ld_path + ":" + os.environ['LD_LIBRARY_PATH'] else: diff --git a/script/gs_ssh b/script/gs_ssh index c50a8f5..bb15220 100644 --- a/script/gs_ssh +++ b/script/gs_ssh @@ -20,6 +20,15 @@ ############################################################################# import os import sys +package_path = os.path.dirname(os.path.realpath(__file__)) +ld_path = package_path + "/gspylib/clib" +if 'LD_LIBRARY_PATH' not in os.environ: + os.environ['LD_LIBRARY_PATH'] = ld_path + os.execve(os.path.realpath(__file__), sys.argv, os.environ) +if not os.environ.get('LD_LIBRARY_PATH').startswith(ld_path): + os.environ['LD_LIBRARY_PATH'] = \ + ld_path + ":" + os.environ['LD_LIBRARY_PATH'] + os.execve(os.path.realpath(__file__), sys.argv, os.environ) from gspylib.common.GaussLog import GaussLog from gspylib.common.Common import DefaultValue diff --git a/script/gs_sshexkey b/script/gs_sshexkey index 14a2e1a..fe3034e 100644 --- a/script/gs_sshexkey +++ b/script/gs_sshexkey @@ -33,6 +33,16 @@ import grp import socket import getpass import shutil +package_path = os.path.dirname(os.path.realpath(__file__)) +ld_path = package_path + "/gspylib/clib" +if 'LD_LIBRARY_PATH' not in os.environ: + os.environ['LD_LIBRARY_PATH'] = ld_path + os.execve(os.path.realpath(__file__), sys.argv, os.environ) +if not os.environ.get('LD_LIBRARY_PATH').startswith(ld_path): + os.environ['LD_LIBRARY_PATH'] = \ + ld_path + ":" + os.environ['LD_LIBRARY_PATH'] + os.execve(os.path.realpath(__file__), sys.argv, os.environ) + from gspylib.common.GaussLog import GaussLog from gspylib.common.ErrorCode import ErrorCode from gspylib.threads.parallelTool import parallelTool diff --git a/script/gspylib/inspection/common/CheckResult.py b/script/gspylib/inspection/common/CheckResult.py index c40d8b9..87281e5 100644 --- a/script/gspylib/inspection/common/CheckResult.py +++ b/script/gspylib/inspection/common/CheckResult.py @@ -236,7 +236,8 @@ class CheckResult(object): for itemResult in self._items: resultDic['name'] = itemResult.name resultDic['category'] = itemResult.category - resultDic['std'] = itemResult.standard.decode('utf-8', 'ignore') + resultDic['std'] = "" if itemResult.standard.strip() == "" \ + else itemResult.standard.decode('utf-8', 'ignore') resultDic['rst'] = itemResult.rst resultDic['analysis'] = itemResult.analysis resultDic['suggestion'] = itemResult.suggestion diff --git a/script/gspylib/inspection/items/network/CheckNICModel.py b/script/gspylib/inspection/items/network/CheckNICModel.py index baf120e..e617128 100644 --- a/script/gspylib/inspection/items/network/CheckNICModel.py +++ b/script/gspylib/inspection/items/network/CheckNICModel.py @@ -66,8 +66,8 @@ class CheckNICModel(BaseItem): cmd = "lspci |grep %s" % PCIAddr (status, output) = subprocess.getstatusoutput(cmd) self.result.raw += "%s\n" % (output) - if (status == 0 and len(output.split(':')) == 3): - modelInfo = output.split(':')[2].split('(')[0] + if status == 0 and len(output.split(':')) >= 3: + modelInfo = ':'.join(output.split(':')[2:]).split('(')[0] self.result.val += "model: %s\n" % (modelInfo.strip()) else: self.result.val += "Failed to get NIC %s model" \ diff --git a/simpleInstall/install.sh b/simpleInstall/install.sh index ebc393f..941e597 100644 --- a/simpleInstall/install.sh +++ b/simpleInstall/install.sh @@ -106,7 +106,7 @@ function fn_get_openGauss_tar() then url="https://opengauss.obs.cn-south-1.myhuaweicloud.com/1.1.0/${system_arch}/openGauss-1.1.0-${system_name}-64bit-all.tar.gz" echo "Downloading openGauss tar from official website at ${install_tar}" - wget $url --timeout=30 --tries=3 && tar -zxvf openGauss-1.1.0-${system_name}-64bit-all.tar.gz + wget $url --timeout=30 --tries=3 && tar -zxf openGauss-1.1.0-${system_name}-64bit-all.tar.gz if [ $? -ne 0 ] then echo "wget error. The $install_tar need openGauss-1.1.0-${system_name}-64bit-om.tar.gz"