mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-12-04 12:38:19 +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"
|
__codename__ = "Yeast Starter"
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ import socket
|
||||||
import importlib
|
import importlib
|
||||||
from tabulate import tabulate
|
from tabulate import tabulate
|
||||||
from datetime import datetime, timedelta, date
|
from datetime import datetime, timedelta, date
|
||||||
|
import glob
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from systemd import journal
|
from systemd import journal
|
||||||
|
@ -48,6 +49,13 @@ class SystemController:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
async def backupConfig(self):
|
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:
|
try:
|
||||||
current_date = date.today()
|
current_date = date.today()
|
||||||
current_date=str(current_date).replace("-","_")
|
current_date=str(current_date).replace("-","_")
|
||||||
|
|
|
@ -143,7 +143,6 @@ class SystemHttpEndpoints:
|
||||||
filename = await self.controller.backupConfig()
|
filename = await self.controller.backupConfig()
|
||||||
#filename = "cbpi4_config.zip"
|
#filename = "cbpi4_config.zip"
|
||||||
file_name = pathlib.Path(os.path.join(".", filename))
|
file_name = pathlib.Path(os.path.join(".", filename))
|
||||||
logging.error(file_name)
|
|
||||||
|
|
||||||
response = web.StreamResponse(
|
response = web.StreamResponse(
|
||||||
status=200,
|
status=200,
|
||||||
|
|
Loading…
Reference in a new issue