mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-12-04 12:38:19 +01:00
add date prefix to backup download name
This commit is contained in:
parent
2180cad285
commit
9d928cd58f
3 changed files with 12 additions and 5 deletions
|
@ -1,3 +1,3 @@
|
||||||
__version__ = "4.4.1.a8"
|
__version__ = "4.4.1.a9"
|
||||||
__codename__ = "Yeast Starter"
|
__codename__ = "Yeast Starter"
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ import zipfile
|
||||||
import socket
|
import socket
|
||||||
import importlib
|
import importlib
|
||||||
from tabulate import tabulate
|
from tabulate import tabulate
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta, date
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from systemd import journal
|
from systemd import journal
|
||||||
|
@ -48,9 +48,15 @@ class SystemController:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
async def backupConfig(self):
|
async def backupConfig(self):
|
||||||
|
try:
|
||||||
|
current_date = date.today()
|
||||||
|
current_date=str(current_date).replace("-","_")
|
||||||
|
output_filename = current_date+"_cbpi4_config"
|
||||||
|
except:
|
||||||
output_filename = "cbpi4_config"
|
output_filename = "cbpi4_config"
|
||||||
dir_name = pathlib.Path(self.cbpi.config_folder.get_file_path(''))
|
dir_name = pathlib.Path(self.cbpi.config_folder.get_file_path(''))
|
||||||
shutil.make_archive(output_filename, 'zip', dir_name)
|
shutil.make_archive(output_filename, 'zip', dir_name)
|
||||||
|
return output_filename+".zip"
|
||||||
|
|
||||||
async def plugins_list(self):
|
async def plugins_list(self):
|
||||||
result = []
|
result = []
|
||||||
|
|
|
@ -140,9 +140,10 @@ class SystemHttpEndpoints:
|
||||||
content: # Response body
|
content: # Response body
|
||||||
application/zip: # Media type
|
application/zip: # Media type
|
||||||
"""
|
"""
|
||||||
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