!746 无法通过修改osid.conf在bclinux安装openGauss集群

Merge pull request !746 from 雷紫薇/bug_131553
This commit is contained in:
opengauss_bot
2024-05-25 06:39:45 +00:00
committed by Gitee
8 changed files with 84 additions and 64 deletions

View File

@ -76,6 +76,7 @@ UNIONTECH = "uniontech"
UOS = "uos"
SUPPORT_WHOLE_PLATFORM_LIST = [SUSE, REDHAT, CENTOS, EULEROS, FUSIONOS,
OPENEULER, KYLIN, ASIANUX, DEBIAN, UBUNTU, UOS, UNIONTECH]
SUPPORT_USER_DEFINED_OS_LIST = []
# RedhatX platform
SUPPORT_RHEL_SERIES_PLATFORM_LIST = [REDHAT, CENTOS, "kylin", "asianux"]
SUPPORT_RHEL6X_VERSION_LIST = ["6.4", "6.5", "6.6", "6.7", "6.8", "6.9", "10"]
@ -320,7 +321,7 @@ def linux_distribution(distname='', version='', idNum='',
"""
is_flag_osid = False
is_flag_oscorrect = True
is_flag_oscorrect = False
try:
etc = os.listdir('/etc')
except os.error:
@ -341,8 +342,7 @@ def linux_distribution(distname='', version='', idNum='',
if distname == "UnionTech":
distname = "uos"
# Read the first line
if gFile is None:
return distname, version, idNum
if gFile is not None:
with open('/etc/' + gFile, 'r') as f:
firstline = f.readline()
_distname, _version, _id = _parse_release_file(firstline)
@ -358,7 +358,8 @@ def linux_distribution(distname='', version='', idNum='',
idNum = _id
if is_flag_oscorrect == True:
return distname, version, idNum
elif is_flag_oscorrect == False:
if is_flag_oscorrect == False:
# Read system information from configuration file
# Call the function and pass in the filename
osid_path = os.path.realpath(
@ -379,10 +380,10 @@ def linux_distribution(distname='', version='', idNum='',
if is_flag_osid:
if selected_data['os']:
distname = selected_data['os']
SUPPORT_USER_DEFINED_OS_LIST.append(distname)
SUPPORT_USER_DEFINED_OS_LIST.append(distname.lower())
if selected_data['version']:
version = selected_data['version']
if selected_data['bit']:
idNum = selected_data['bit']
return distname, version, idNum
def dist(supported_dists=_supported_dists):
@ -1737,6 +1738,12 @@ class LinuxPlatform(GenericPlatform):
prefixStr, packageVersion,
PAK_UOS,
BIT_VERSION, postfixStr))
elif distname in SUPPORT_USER_DEFINED_OS_LIST:
fileName = os.path.join(dirName, "./../../../",
"%s-%s-%s-%s.%s" % (
prefixStr, packageVersion,
SUPPORT_USER_DEFINED_OS_LIST[0],
BIT_VERSION, postfixStr))
else:
raise Exception(ErrorCode.GAUSS_519["GAUSS_51900"] +
"Supported platforms are: %s." % str(
@ -2156,7 +2163,8 @@ class RHELPlatform(LinuxPlatform):
version[0:3] in SUPPORT_RHEL_SERIES_VERSION_LIST)) or
(distName.lower() == OPENEULER) or
(distName.lower() == FUSIONOS) or
(distName.lower() == DEBIAN and version == "buster/sid")
(distName.lower() == DEBIAN and version == "buster/sid") or
(distName.lower() in SUPPORT_USER_DEFINED_OS_LIST)
)):
return distName.lower(), version[0:3]
else:
@ -2214,7 +2222,8 @@ class UserPlatform():
# Kylin "10" 64bit
# Ubuntu "18.04" 64bit
distName, version, idNum = dist()
if distName.lower() not in SUPPORT_WHOLE_PLATFORM_LIST:
if dist_name.lower() not in SUPPORT_WHOLE_PLATFORM_LIST \
and dist_name.lower() not in SUPPORT_USER_DEFINED_OS_LIST:
raise Exception(ErrorCode.GAUSS_519["GAUSS_51900"] +
"Supported platforms are: %s." % str(
SUPPORT_WHOLE_PLATFORM_LIST))

View File

@ -48,7 +48,7 @@ from os_platform.linux_distro import LinuxDistro
from os_platform.common import SUPPORT_RHEL6X_VERSION_LIST, \
SUPPORT_RHEL7X_VERSION_LIST, SUPPORT_SUSE12X_VERSION_LIST, \
SUPPORT_SUSE11X_VERSION_LIST, SUPPORT_RHEL8X_VERSION_LIST, \
SUPPORT_RHEL_LEAST_VERSION
SUPPORT_RHEL_LEAST_VERSION, SUPPORT_USER_DEFINED_OS_LIST
sys.path.insert(0, localDirPath + "/../../lib")
import psutil
@ -1914,6 +1914,9 @@ def CheckPlatformInfo():
elif (data.distname == "debian" or data.version == "buster/sid"):
mixed_type = "%s" % data.distname
platform_str = "%s_%s_%s" % (data.distname, data.version, data.bits)
elif (data.distname in SUPPORT_USER_DEFINED_OS_LIST):
mixed_type = "%s" % data.distname
platform_str = "%s_%s_%s" % (data.distname, data.version, data.bits)
else:
g_logger.log("Warning reason: %s version is not the official version"
"supported by OM, but you can still deploy and install it" %

View File

@ -21,7 +21,7 @@
from gspylib.common.ErrorCode import ErrorCode
from os_platform.common import SUPPORT_WHOLE_PLATFORM_LIST, SUSE, \
SUPPORT_RHEL_SERIES_PLATFORM_LIST
SUPPORT_RHEL_SERIES_PLATFORM_LIST, SUPPORT_USER_DEFINED_OS_LIST
from os_platform.linux_distro import LinuxDistro
from os_platform.rhel_platform import RHELPlatform
from os_platform.sles_platform import SLESPlatform
@ -44,7 +44,8 @@ class UserPlatform(object):
# Kylin "10" 64bit
# Ubuntu "18.04" 64bit
dist_name = LinuxDistro.linux_distribution()[0]
if dist_name.lower() not in SUPPORT_WHOLE_PLATFORM_LIST:
if dist_name.lower() not in SUPPORT_WHOLE_PLATFORM_LIST \
and dist_name.lower() not in SUPPORT_USER_DEFINED_OS_LIST:
raise Exception(ErrorCode.GAUSS_519["GAUSS_51900"] +
"Supported platforms are: %s." % str(
SUPPORT_WHOLE_PLATFORM_LIST))

View File

@ -35,6 +35,7 @@ UNIONTECH = "uniontech"
UOS = "uos"
SUPPORT_WHOLE_PLATFORM_LIST = [SUSE, REDHAT, CENTOS, EULEROS, OPENEULER, KYLIN,
FUSIONOS, ASIANUX, DEBIAN, UBUNTU, UOS, UNIONTECH]
SUPPORT_USER_DEFINED_OS_LIST = []
# RedhatX platform
SUPPORT_RHEL_SERIES_PLATFORM_LIST = [REDHAT, CENTOS, "kylin", "asianux"]
SUPPORT_RHEL6X_VERSION_LIST = ["6.4", "6.5", "6.6", "6.7", "6.8", "6.9", "10"]

View File

@ -24,7 +24,8 @@ import re
import select
import sys
from os_platform.common import _supported_dists,SUPPORT_WHOLE_PLATFORM_LIST
from os_platform.common import _supported_dists,SUPPORT_WHOLE_PLATFORM_LIST,\
SUPPORT_USER_DEFINED_OS_LIST
ISCONFIGURETRUE = "# isConfigure = TRUE"
ISCONFIGUREFALSE = "# isConfigure = FALSE"
@ -237,7 +238,7 @@ class LinuxDistro(object):
"""
is_flag_osid = False
is_flag_oscorrect = True
is_flag_oscorrect = False
try:
etc_dir = os.listdir('/etc')
except os.error:
@ -259,8 +260,7 @@ class LinuxDistro(object):
if distname == "UnionTech":
distname = "uos"
# Read the first line
if gFile is None:
return distname, version, idNum
if gFile is not None:
with open('/etc/' + gFile, 'r') as f:
firstline = f.readline()
_distname, _version, _id = LinuxDistro._parse_release_file(firstline)
@ -276,7 +276,8 @@ class LinuxDistro(object):
idNum = _id
if is_flag_oscorrect == True:
return distname, version, idNum
elif is_flag_oscorrect == False:
if is_flag_oscorrect == False:
# Read system information from configuration file
# Call the function and pass in the filename
osid_path = os.path.realpath(
@ -297,8 +298,8 @@ class LinuxDistro(object):
if is_flag_osid:
if selected_data['os']:
distname = selected_data['os']
SUPPORT_USER_DEFINED_OS_LIST.append(distname)
SUPPORT_USER_DEFINED_OS_LIST.append(distname.lower())
if selected_data['version']:
version = selected_data['version']
if selected_data['bit']:
idNum = selected_data['bit']
return distname, version, idNum

View File

@ -26,7 +26,7 @@ from os_platform.common import REDHAT, PAK_REDHAT, BIT_VERSION, \
CENTOS, UOS, PAK_EULER, PAK_CENTOS, ASIANUX, SUSE, PAK_ASIANUX, \
EULEROS, OPENEULER, KYLIN, PAK_OPENEULER, SUPPORT_WHOLE_PLATFORM_LIST,\
BLANK_SPACE, PAK_UBUNTU, DEBIAN, PAK_KYLIN, PAK_UOS, PAK_SUSE, PAK_DEBIAN, \
FUSIONOS, PAK_FUSIONOS
FUSIONOS, PAK_FUSIONOS, SUPPORT_USER_DEFINED_OS_LIST
from os_platform.linux_distro import LinuxDistro
@ -231,6 +231,11 @@ class LinuxPlatform(object):
self.package_file_path(prefix_str, packageVersion, PAK_FUSIONOS, postfix_str)
]
elif distname in SUPPORT_USER_DEFINED_OS_LIST:
file_name_list = [
self.package_file_path(prefix_str, packageVersion, SUPPORT_USER_DEFINED_OS_LIST[0], postfix_str)
]
else:
raise Exception(ErrorCode.GAUSS_519["GAUSS_51900"] +
"Supported platforms are: %s." % str(

View File

@ -27,7 +27,7 @@ from os_platform.common import BIT_VERSION, EULEROS, SUPPORT_EULEROS_VERSION_LIS
FUSIONOS, SUPPORT_RHEL_SERIES_PLATFORM_LIST, \
SUPPORT_RHEL_SERIES_VERSION_LIST, OPENEULER, CENTOS, \
UOS, UNIONTECH, SUPPORT_UOS_VERSION_LIST, \
SUPPORT_RHEL7X_VERSION_LIST, DEBIAN, BLANK_SPACE
SUPPORT_RHEL7X_VERSION_LIST, DEBIAN, BLANK_SPACE, SUPPORT_USER_DEFINED_OS_LIST
from os_platform.linux_distro import LinuxDistro
from os_platform.linux_platform import LinuxPlatform
@ -172,7 +172,8 @@ class RHELPlatform(LinuxPlatform):
version[0:3] in SUPPORT_RHEL_SERIES_VERSION_LIST)) or
(dist_name.lower() == OPENEULER) or
(dist_name.lower() == FUSIONOS) or
(dist_name.lower() == DEBIAN and version == "buster/sid")
(dist_name.lower() == DEBIAN and version == "buster/sid") or
(dist_name.lower() in SUPPORT_USER_DEFINED_OS_LIST)
)):
return dist_name.lower(), version[0:3]
elif((bits == BIT_VERSION and

View File

@ -7,23 +7,22 @@
# Kylin "10" 64bit
# Ubuntu "18.04" 64bit
# -------------------why to configure-------------------------------
# OM工具对OS版本是强依赖,目前各大厂商基于openEuler、centos等开源
# 操作系统做了相关适配,当利用OM对openGauss安装时,checkos等OS检查项
# 会报错,所以我们设置一个osid.configure文件,在该文件中对openEuler、
# centos做相关设置,可以使用户顺利做相关校验,安装成功。
# The osid.conf file can reduce the dependence of OM on OS version.
# Making it possible for users to customize the OS and version,
# then when users use OM to install openGauss in some non-mainstream systems,
# they can do the relevant checksums smoothly and install successfully.
# -------------------how to configure-------------------------------
# 如果我们在script/osid.configure文件中配置了OS、version等信息,则OM
# 管理工具在gs_preintsallgs_install过程中,其中读取OS系统的项中,会
# 首先从该配置文件中读取。
# If we have configured OS, version information in the script/osid.conf file,
# the OM tool will read from this conf file during the gs_preintsall and gs_install process.
# 如果该文件用户没有配置,gs_preinstall预安装过程中,会提示用户该文件
# 没有配置,是否配置,用户可以根据自己的选择在此时是否需要配置。如果配置:
# 只需要配置OS、version、bit这三个选项。并且将配置内容写入该文件中。
# 如果用户在该文件中直接进行配置,在————define-platform————行下边也是配
# 置OS、version、bit这三个选项,如第29行所示,并且将行首的#号取消。
# If this file is not configured by the user, the gs_preinstall process will prompt the user
# whether to configure it or not. If configured:
# Only the 2 options OS, version need to be configured, write the configuration content into the file.
# If the user configures at ----define-platform ----- directly in that file,
# The next line is also to configure the 2 options OS, version, as shown in line 29,
# just remove the # sign at the beginning of the line.
# ---------------define-platform------------------------------
# centos 7.5