红旗可以使用centos安装 拷贝文件做文件存在校验

This commit is contained in:
zhang_xubo
2022-04-01 11:24:25 +08:00
parent 8978221ba4
commit 45e0738d9f
3 changed files with 27 additions and 8 deletions

View File

@ -874,3 +874,12 @@ class FileUtil(object):
if status != 0:
raise Exception(ErrorCode.GAUSS_502["GAUSS_50201"] % "log file" +
" Directory:%s." % user_dir + " Error: \n%s" % file_output)
@staticmethod
def checkFileExists(file):
"""
function : change file exists
input : file name
output: NA
"""
return os.path.exists(file)

View File

@ -2328,16 +2328,21 @@ def copyCerts():
oldOmSslCerts = os.path.join(g_opts.oldClusterAppPath, "share/sslcert/om")
newOmSslCerts = os.path.join(g_opts.newClusterAppPath, "share/sslcert/om")
if FileUtil.checkFileExists("%s/server.key.cipher" % oldBinPath):
FileUtil.cpFile("%s/server.key.cipher" % oldBinPath, "%s/" % newBinPath)
FileUtil.changeMode(DefaultValue.KEY_FILE_MODE, "%s/server.key.cipher" %
newBinPath)
if FileUtil.checkFileExists("%s/server.key.rand" % oldBinPath):
FileUtil.cpFile("%s/server.key.rand" % oldBinPath, "%s/" % newBinPath)
FileUtil.changeMode(DefaultValue.KEY_FILE_MODE, "%s/server.key.rand" %
newBinPath)
for certFile in DefaultValue.SERVER_CERT_LIST:
if FileUtil.checkFileExists("%s/%s" % (oldOmSslCerts, certFile)):
FileUtil.cpFile("%s/%s" % (oldOmSslCerts, certFile), "%s/" %
newOmSslCerts)
FileUtil.changeMode(DefaultValue.KEY_FILE_MODE, "%s/server.key.cipher" %
newBinPath)
FileUtil.changeMode(DefaultValue.KEY_FILE_MODE, "%s/server.key.rand" %
newBinPath)
FileUtil.changeMode(DefaultValue.KEY_FILE_MODE, "%s/*" %
newOmSslCerts)

View File

@ -183,6 +183,11 @@ class LinuxPlatform(object):
"%s-%s-%s-%s.%s" % (
prefix_str, packageVersion, PAK_ASIANUX,
BIT_VERSION, postfix_str))
if not os.path.exists(os.path.normpath(file_name)):
file_name = os.path.join(dir_name, "./../../",
"%s-%s-%s-%s.%s" % (
prefix_str, packageVersion, PAK_CENTOS,
BIT_VERSION, postfix_str))
elif distname == SUSE and version.split('.')[0] in ("11", "12"):
file_name = os.path.join(dir_name, "./../../",
"%s-%s-%s-%s.%s" % (