check the enable_dss environment before gs_install
This commit is contained in:
@ -998,8 +998,9 @@ class ErrorCode():
|
|||||||
'GAUSS_53031': "[GAUSS-53031] : The cluster is None.",
|
'GAUSS_53031': "[GAUSS-53031] : The cluster is None.",
|
||||||
'GAUSS_53032': "[GAUSS-53032] : The speed limit must "
|
'GAUSS_53032': "[GAUSS-53032] : The speed limit must "
|
||||||
"be a nonnegative integer.",
|
"be a nonnegative integer.",
|
||||||
'GAUSS_53033': "[GAUSS-53033] : Invalid User : %s."
|
'GAUSS_53033': "[GAUSS-53033] : Invalid User : %s.",
|
||||||
|
'GAUSS_53034': "[GAUSS-53034] : In the resource pooling environment, do not run "
|
||||||
|
"gs_install after gs_uninstall. please gs_preinstall first."
|
||||||
}
|
}
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
@ -89,6 +89,8 @@ class InstallImpl:
|
|||||||
function: run method
|
function: run method
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
|
# check enable_dss
|
||||||
|
self.check_enable_dss()
|
||||||
# check timeout time.
|
# check timeout time.
|
||||||
# Notice: time_out is not supported under TP branch
|
# Notice: time_out is not supported under TP branch
|
||||||
self.checkTimeout()
|
self.checkTimeout()
|
||||||
@ -113,6 +115,22 @@ class InstallImpl:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
GaussLog.exitWithError(str(e))
|
GaussLog.exitWithError(str(e))
|
||||||
|
|
||||||
|
def check_enable_dss(self):
|
||||||
|
"""
|
||||||
|
function: Check enable_dss
|
||||||
|
input : NA
|
||||||
|
output: NA
|
||||||
|
"""
|
||||||
|
is_enabledssset = EnvUtil.getEnv("ENABLE_DSS")
|
||||||
|
cluster_info = dbClusterInfo()
|
||||||
|
cluster_info.initFromXml(self.context.xmlFile)
|
||||||
|
|
||||||
|
if is_enabledssset and cluster_info.enable_dss == 'on':
|
||||||
|
raise Exception(ErrorCode.GAUSS_530["GAUSS_53034"])
|
||||||
|
else:
|
||||||
|
self.context.logger.log(
|
||||||
|
"Successfully checked gs_uninstall on every node.")
|
||||||
|
|
||||||
def checkSyncNode(self):
|
def checkSyncNode(self):
|
||||||
"""
|
"""
|
||||||
function: check syncNode
|
function: check syncNode
|
||||||
|
@ -1338,6 +1338,29 @@ class PreinstallImpl:
|
|||||||
output : NA
|
output : NA
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def check_enabledssinenv(self, source_file):
|
||||||
|
"""
|
||||||
|
function: check enabledss in env
|
||||||
|
input : NA
|
||||||
|
output : NA
|
||||||
|
"""
|
||||||
|
if self.context.clusterInfo.enable_dss == 'on':
|
||||||
|
file_lines = []
|
||||||
|
found_enabledss = False
|
||||||
|
is_enabledssset = "export ENABLE_DSS="
|
||||||
|
with open(source_file, "r") as file:
|
||||||
|
for line in file:
|
||||||
|
if is_enabledssset in line:
|
||||||
|
found_enabledss = True
|
||||||
|
else:
|
||||||
|
file_lines.append(line)
|
||||||
|
|
||||||
|
if found_enabledss:
|
||||||
|
with open(source_file, "w") as file:
|
||||||
|
file.writelines(file_lines)
|
||||||
|
else:
|
||||||
|
return
|
||||||
|
|
||||||
def checkRepeat(self):
|
def checkRepeat(self):
|
||||||
"""
|
"""
|
||||||
@ -1358,6 +1381,7 @@ class PreinstallImpl:
|
|||||||
self.context.logger.debug(
|
self.context.logger.debug(
|
||||||
"There is no environment file, skip check repeat.")
|
"There is no environment file, skip check repeat.")
|
||||||
return []
|
return []
|
||||||
|
self.check_enabledssinenv(source_file)
|
||||||
with open(source_file, 'r') as f:
|
with open(source_file, 'r') as f:
|
||||||
env_list = f.readlines()
|
env_list = f.readlines()
|
||||||
new_env_list = []
|
new_env_list = []
|
||||||
|
@ -30,6 +30,9 @@ from domain_utils.cluster_file.cluster_dir import ClusterDir
|
|||||||
from base_utils.os.env_util import EnvUtil
|
from base_utils.os.env_util import EnvUtil
|
||||||
from base_utils.os.file_util import FileUtil
|
from base_utils.os.file_util import FileUtil
|
||||||
from base_utils.os.net_util import NetUtil
|
from base_utils.os.net_util import NetUtil
|
||||||
|
from gspylib.common.DbClusterInfo import dbNodeInfo, \
|
||||||
|
dbClusterInfo, compareObject
|
||||||
|
from domain_utils.cluster_file.profile_file import ProfileFile
|
||||||
|
|
||||||
|
|
||||||
class UninstallImpl:
|
class UninstallImpl:
|
||||||
@ -440,6 +443,25 @@ class UninstallImpl:
|
|||||||
"Uninstall a single node instead of the gs_dropnode command.")
|
"Uninstall a single node instead of the gs_dropnode command.")
|
||||||
self.localMode = True
|
self.localMode = True
|
||||||
|
|
||||||
|
def check_dss(self):
|
||||||
|
"""
|
||||||
|
function: make sure the etcd process is clean.
|
||||||
|
input : NA
|
||||||
|
output: NA
|
||||||
|
"""
|
||||||
|
enable_dssLine = 'export ENABLE_DSS=ON\n'
|
||||||
|
is_enabledssset = EnvUtil.getEnv("ENABLE_DSS")
|
||||||
|
is_dsshome = EnvUtil.getEnv("DSS_HOME")
|
||||||
|
|
||||||
|
if self.mpprcFile and os.path.isfile(self.mpprcFile):
|
||||||
|
source_file = self.mpprcFile
|
||||||
|
else:
|
||||||
|
source_file = os.path.join("/etc", "profile")
|
||||||
|
|
||||||
|
if is_dsshome and not is_enabledssset:
|
||||||
|
with open(source_file, 'a') as file:
|
||||||
|
file.write(enable_dssLine)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""
|
"""
|
||||||
function: Uninstall database cluster
|
function: Uninstall database cluster
|
||||||
@ -463,6 +485,7 @@ class UninstallImpl:
|
|||||||
self.CleanRackFile()
|
self.CleanRackFile()
|
||||||
self.clean_dss_home()
|
self.clean_dss_home()
|
||||||
self.CleanLog()
|
self.CleanLog()
|
||||||
|
self.check_dss()
|
||||||
self.logger.log("Uninstallation succeeded.")
|
self.logger.log("Uninstallation succeeded.")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.logExit(str(e))
|
self.logger.logExit(str(e))
|
||||||
|
Reference in New Issue
Block a user