Модифицировал комманду удаления бэкапа
This commit is contained in:
parent
b736419957
commit
2cf1510af9
|
|
@ -18,7 +18,7 @@ class DeleteBackupCommandBuilder:
|
|||
assert line is not None
|
||||
|
||||
parser = DeleteBackupParser()
|
||||
folderPath = parser.parseLine(line)
|
||||
parser.parseLine(line)
|
||||
|
||||
command = DeleteBackupCommand(folderPath)
|
||||
command = DeleteBackupCommand()
|
||||
return command
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from CommandBuilders.DeleteBackupCommandBuilder import DeleteBackupCommandBuilder
|
||||
|
||||
line = "delete backup 'BuildSample'"
|
||||
line = "delete backup"
|
||||
|
||||
cmdBuilder = DeleteBackupCommandBuilder()
|
||||
command = cmdBuilder.getCommandFor(line)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import os
|
||||
import shutil
|
||||
from commands.BaseBackupCommand.BaseBackupCommand import BaseBackupCommand
|
||||
|
||||
|
|
@ -7,4 +8,7 @@ class DeleteBackupCommand(BaseBackupCommand):
|
|||
BaseBackupCommand.__init__(self)
|
||||
|
||||
def execute(self):
|
||||
if not os.path.exists(self.backupDirAbsPath):
|
||||
raise Exception('backup folder: {0} not exists'.format(self.backupDirAbsPath))
|
||||
|
||||
shutil.rmtree(self.backupDirAbsPath, ignore_errors=True)
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@ class DeleteBackupParser(ParserBackupBase):
|
|||
def getMatchInfo(self, line):
|
||||
assert line is not None
|
||||
|
||||
folderNameRegexp = r"'(?P<folder>[^']+)'$"
|
||||
regexpSource = self.startsWith('delete') + self.than('backup') + folderNameRegexp
|
||||
regexpSource = self.startsWith('delete') + self.endsWith('backup')
|
||||
regexp = re.compile(regexpSource, re.UNICODE)
|
||||
|
||||
match = regexp.match(line)
|
||||
|
|
|
|||
Loading…
Reference in New Issue