修复check-sshagent定时任务在环境变量分类模式下无法正常执行

This commit is contained in:
hangjin2020
2022-03-11 14:27:45 +08:00
parent 988df89354
commit dc8881c746
2 changed files with 10 additions and 0 deletions

View File

@ -1205,6 +1205,13 @@ Common options:
DefaultValue.cleanUserEnvVariable(userProfile,
cleanGS_CLUSTER_NAME=False)
self.logger.debug("Successfully delete user's environmental variable.")
if self.mpprcFile:
#import environment variable separation scene to bashrc
FileUtil.deleteLine(ClusterConstants.HOME_USER_BASHRC % self.user,
"^\\s*export\\s*%s=.*$" % DefaultValue.MPPRC_FILE_ENV)
context = "export %s=%s" %(DefaultValue.MPPRC_FILE_ENV, self.mpprcFile)
FileUtil.writeFile(ClusterConstants.HOME_USER_BASHRC % self.user, [context])
self.logger.debug("Successfully flush 'export MPPRC' in bashrc")
# user's environmental variable
self.logger.debug("Seting user's environmental variable.")