fix getcap not found
This commit is contained in:
@ -405,7 +405,8 @@ class FileUtil(object):
|
||||
Add the read and write permissions of some root users.
|
||||
'''
|
||||
|
||||
cmd = 'setcap {}+ep {}'.format(cap_mode, path)
|
||||
cmd = 'export PATH=$PATH:/usr/sbin:/usr/bin:/sbin:/bin; '
|
||||
cmd = cmd + 'setcap {}+ep {}'.format(cap_mode, path)
|
||||
status, output = subprocess.getstatusoutput(cmd)
|
||||
if status != 0:
|
||||
raise Exception(ErrorCode.GAUSS_501["GAUSS_50107"] % path +
|
||||
@ -416,10 +417,11 @@ class FileUtil(object):
|
||||
'''
|
||||
Get the permissions of some root users.
|
||||
'''
|
||||
cmd = f'getcap {path}'
|
||||
cmd = 'export PATH=$PATH:/usr/sbin:/usr/bin:/sbin:/bin; '
|
||||
cmd = cmd + f'getcap {path}'
|
||||
status, output = subprocess.getstatusoutput(cmd)
|
||||
if status != 0:
|
||||
raise Exception(ErrorCode.GAUSS_501["GAUSS_50107"] % path +
|
||||
raise Exception(ErrorCode.GAUSS_501["GAUSS_50112"] % path +
|
||||
" Error:\n%s." % output + "The cmd is %s" % cmd)
|
||||
return output.strip()
|
||||
|
||||
|
@ -131,7 +131,8 @@ class ErrorCode():
|
||||
'GAUSS_50109': "[GAUSS-50109] : Only a user with the root permission "
|
||||
"can check SSD information.",
|
||||
'GAUSS_50110': "[GAUSS-50110] : Cannot execute this script on %s.",
|
||||
'GAUSS_50111': "[GAUSS-50111] : The %s directory has no permission."
|
||||
'GAUSS_50111': "[GAUSS-50111] : The %s directory has no permission.",
|
||||
'GAUSS_50112': "[GAUSS-50112] : Failed to get the permission of %s.",
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
|
@ -108,7 +108,6 @@ class Uninstall(LocalBaseOM):
|
||||
'''
|
||||
Deregistering a Disk in dss-mode
|
||||
'''
|
||||
self.logger.log("Start to unregist the lun.")
|
||||
gausshome = ClusterDir.getInstallDir(self.user)
|
||||
dsscmd = os.path.realpath(os.path.join(gausshome, 'bin', 'dsscmd'))
|
||||
perctrl = os.path.realpath(os.path.join(gausshome, 'bin', 'perctrl'))
|
||||
@ -119,6 +118,7 @@ class Uninstall(LocalBaseOM):
|
||||
dss_home = EnvUtil.get_dss_home(self.user)
|
||||
cfg = os.path.join(dss_home, 'cfg', 'dss_inst.ini')
|
||||
if os.path.isfile(cfg):
|
||||
self.logger.log("Start to unregist the lun.")
|
||||
Dss.unreg_disk(dss_home, logger=self.logger)
|
||||
self.logger.log("Successfully unregist the lun.")
|
||||
else:
|
||||
@ -306,6 +306,18 @@ class Uninstall(LocalBaseOM):
|
||||
|
||||
self.logger.log("Removing the installation directory.")
|
||||
try:
|
||||
|
||||
dss_app = os.path.realpath(
|
||||
os.path.join(
|
||||
os.path.dirname(self.installPath),
|
||||
f'dss_app_{os.path.realpath(self.installPath)[-8:]}'))
|
||||
if os.path.isdir(dss_app):
|
||||
for fn in os.listdir(dss_app):
|
||||
fp = os.path.realpath(os.path.join(dss_app, fn))
|
||||
if os.path.isfile(fp):
|
||||
os.remove(fp)
|
||||
self.logger.debug("Remove path:%s." % fp)
|
||||
|
||||
fileList = os.listdir(self.installPath)
|
||||
for fileName in fileList:
|
||||
fileName = fileName.replace("/", "").replace("..", "")
|
||||
|
Reference in New Issue
Block a user