mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Oops! All backups are gone... but not anymore!
While loop automatically removed all old backups greater than the max backups threshold... including if it was set to 0. Set a test for the while loop to make sure max backups is greater than 0 before deletey delete
This commit is contained in:
parent
5b8764cb45
commit
689e4abb51
@ -369,7 +369,7 @@ class Server:
|
||||
backup_filename = "{}/{}".format(self.settings['backup_path'], datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S'))
|
||||
logger.info("Creating backup of server '{}' (ID#{}) at '{}'".format(self.settings['server_name'], self.server_id, backup_filename))
|
||||
shutil.make_archive(backup_filename, 'zip', self.server_path)
|
||||
while len(self.list_backups()) > conf["max_backups"]:
|
||||
while len(self.list_backups()) > conf["max_backups"] and conf["max_backups"] > 0:
|
||||
backup_list = self.list_backups()
|
||||
oldfile = backup_list[0]
|
||||
oldfile_path = "{}/{}".format(conf['backup_path'], oldfile['path'])
|
||||
|
Loading…
Reference in New Issue
Block a user