修改backup,目录没权限扔可以备份

This commit is contained in:
liuheng
2022-12-16 20:59:52 +08:00
parent bfd25ea6fc
commit 3bae57d21e
2 changed files with 6 additions and 1 deletions

View File

@ -130,7 +130,8 @@ class ErrorCode():
"permission of %s.",
'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_50110': "[GAUSS-50110] : Cannot execute this script on %s.",
'GAUSS_50111': "[GAUSS-50111] : The %s directory has no permission."
}
###########################################################################

View File

@ -223,6 +223,10 @@ class LocalBackup(LocalBaseOM):
ErrorCode.GAUSS_502["GAUSS_50208"] % self.backupDir
+ " Error:\n%s" % e)
if (not os.access(self.backupDir, os.R_OK | os.W_OK)):
raise Exception(
ErrorCode.GAUSS_501["GAUSS_50111"] % self.backupDir)
self.logger.log("Successfully checked backup directory.")
def doBackup(self):