mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-12-03 12:14:18 +01:00
remove old backup files locally prior to generation of new backup file
This commit is contained in:
parent
9d928cd58f
commit
f3a8fdf1a2
3 changed files with 10 additions and 3 deletions
|
@ -1,3 +1,3 @@
|
|||
__version__ = "4.4.1.a9"
|
||||
__version__ = "4.4.1.a10"
|
||||
__codename__ = "Yeast Starter"
|
||||
|
||||
|
|
|
@ -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("-","_")
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Reference in a new issue