cluster-env variables are prefixed, which may trigger safety problems
This commit is contained in:
parent
cb28877b0e
commit
ebcfeae3f8
@ -428,8 +428,15 @@ class PostUninstallImpl:
|
||||
|
||||
# clean local node environment variable
|
||||
cmd = "(if [ -s '%s' ]; then " % PROFILE_FILE
|
||||
cmd += "sed -i -e '/^export PATH=\/root\/gauss_om\/%s\/script:" \
|
||||
"\$PATH$/d' %s; fi)" % (self.user, PROFILE_FILE)
|
||||
cmd += "sed -i -e '/^export PATH=\$PATH:\/root\/gauss_om\/%s\/" \
|
||||
"script$/d' %s " % (self.user, PROFILE_FILE)
|
||||
cmd += "-e '/^export PATH=\$PATH:\$GPHOME\/script\/gspylib\/pssh\/bin:" \
|
||||
"\$GPHOME\/script$/d' %s " % PROFILE_FILE
|
||||
cmd += "-e '/^export LD_LIBRARY_PATH=\$GPHOME\/script\/gspylib\/clib:" \
|
||||
"\$LD_LIBRARY_PATH$/d' %s " % PROFILE_FILE
|
||||
cmd += "-e '/^export LD_LIBRARY_PATH=\$GPHOME\/lib:" \
|
||||
"\$LD_LIBRARY_PATH$/d' %s " % PROFILE_FILE
|
||||
cmd +="-e '/^export PYTHONPATH=\$GPHOME\/lib$/d' %s; fi) " % PROFILE_FILE
|
||||
self.logger.debug(
|
||||
"Command for deleting environment variable: %s" % cmd)
|
||||
(status, output) = subprocess.getstatusoutput(cmd)
|
||||
|
@ -1447,6 +1447,16 @@ Common options:
|
||||
"Deleting crash LD_LIBRARY_PATH in user environment variables.")
|
||||
|
||||
# clean PATH
|
||||
if userProfile is ClusterConstants.ETC_PROFILE:
|
||||
FileUtil.deleteLine(userProfile,
|
||||
"^\\s*export\\s*PATH=\\$PATH:\\$GPHOME\\/pssh-2.3.1\\/bin:"
|
||||
"\\$GPHOME\\/script$")
|
||||
FileUtil.deleteLine(userProfile,
|
||||
"^\\s*export\\s*PATH=\\$PATH:\\$GPHOME\\/script\\/gspylib\\"
|
||||
"/pssh\\/bin:\\$GPHOME\\/script$")
|
||||
FileUtil.deleteLine(userProfile,
|
||||
"^\\s*export\\s*PATH=\\$PATH:\\/root\\/gauss_om\\/%s\\"
|
||||
"/script$" % self.user)
|
||||
FileUtil.deleteLine(userProfile,
|
||||
"^\\s*export\\s*PATH=\\$GPHOME\\/pssh-2.3.1\\/bin:"
|
||||
"\\$GPHOME\\/script:\\$PATH$")
|
||||
@ -1480,9 +1490,14 @@ Common options:
|
||||
FileUtil.writeFile(userProfile,
|
||||
["export GPHOME=%s" % self.clusterToolPath])
|
||||
# set PATH
|
||||
FileUtil.writeFile(userProfile, [
|
||||
"export PATH=$GPHOME/script/gspylib/pssh/bin:"
|
||||
"$GPHOME/script:$PATH"])
|
||||
if userProfile is ClusterConstants.ETC_PROFILE:
|
||||
FileUtil.writeFile(userProfile, [
|
||||
"export PATH=$PATH:$GPHOME/script/gspylib/pssh/bin:"
|
||||
"$GPHOME/script"])
|
||||
else:
|
||||
FileUtil.writeFile(userProfile, [
|
||||
"export PATH=$GPHOME/script/gspylib/pssh/bin:"
|
||||
"$GPHOME/script:$PATH"])
|
||||
# set LD_LIBRARY_PATH
|
||||
FileUtil.writeFile(userProfile, [
|
||||
"export LD_LIBRARY_PATH="
|
||||
@ -2455,7 +2470,10 @@ Common options:
|
||||
|
||||
# set om root script path
|
||||
userProfile = self.getUserProfile()
|
||||
FileUtil.writeFile(userProfile, ["export PATH=%s:$PATH" % om_root_path])
|
||||
if userProfile is ClusterConstants.ETC_PROFILE:
|
||||
FileUtil.writeFile(userProfile, ["export PATH=$PATH:%s" % om_root_path])
|
||||
else:
|
||||
FileUtil.writeFile(userProfile, ["export PATH=%s:$PATH" % om_root_path])
|
||||
# delete root scripts in GPHOME
|
||||
om_user_path = os.path.join(self.clusterToolPath, "script")
|
||||
user_om_files = os.listdir(om_user_path)
|
||||
|
@ -379,11 +379,14 @@ class Postuninstall(LocalBaseOM):
|
||||
cmd += "sed -i -e '/^export GPHOME=%s$/d' %s " % (
|
||||
self.clusterToolPath.replace('/', '\/'), PROFILE_FILE)
|
||||
cmd += \
|
||||
"-e '/^export PATH=\$GPHOME\/pssh-2.3.1\/bin:" \
|
||||
"\$GPHOME\/script:\$PATH$/d' %s " % PROFILE_FILE
|
||||
"-e '/^export PATH=\$PATH:\$GPHOME\/pssh-2.3.1\/bin:" \
|
||||
"\$GPHOME\/script$/d' %s " % PROFILE_FILE
|
||||
cmd += \
|
||||
"-e '/^export PATH=\$GPHOME\/script\/gspylib\/pssh\/bin:" \
|
||||
"\$GPHOME\/script:\$PATH$/d' %s " % PROFILE_FILE
|
||||
"-e '/^export PATH=\$PATH:\$GPHOME\/script\/gspylib\/pssh\/bin:" \
|
||||
"\$GPHOME\/script$/d' %s " % PROFILE_FILE
|
||||
cmd += \
|
||||
"-e '/^export LD_LIBRARY_PATH=\$GPHOME\/script\/gspylib\/clib:" \
|
||||
"\$LD_LIBRARY_PATH$/d' %s " % PROFILE_FILE
|
||||
cmd += \
|
||||
"-e '/^export LD_LIBRARY_PATH=\$GPHOME\/lib:" \
|
||||
"\$LD_LIBRARY_PATH$/d' %s " % PROFILE_FILE
|
||||
|
Loading…
x
Reference in New Issue
Block a user