remove old backup files locally prior to generation of new backup file

This commit is contained in:
avollkopf 2024-05-10 22:16:18 +02:00
parent 9d928cd58f
commit f3a8fdf1a2
3 changed files with 10 additions and 3 deletions

View file

@ -1,3 +1,3 @@
__version__ = "4.4.1.a9"
__version__ = "4.4.1.a10"
__codename__ = "Yeast Starter"

View file

@ -16,6 +16,7 @@ import socket
import importlib
from tabulate import tabulate
from datetime import datetime, timedelta, date
import glob
try:
from systemd import journal
@ -48,6 +49,13 @@ class SystemController:
pass
async def backupConfig(self):
files=glob.glob('*cbpi4_config*.zip')
for f in files:
try:
os.remove(f)
except Exception as e:
logging.error("Cannot remove old config backup: {}".format(e))
try:
current_date = date.today()
current_date=str(current_date).replace("-","_")

View file

@ -143,8 +143,7 @@ class SystemHttpEndpoints:
filename = await self.controller.backupConfig()
#filename = "cbpi4_config.zip"
file_name = pathlib.Path(os.path.join(".", filename))
logging.error(file_name)
response = web.StreamResponse(
status=200,
reason='OK',