mirror of
https://github.com/frappe/frappe_docker.git
synced 2025-02-04 04:58:27 +00:00
Update file keys in push-backups: from abs path to <site>/<file>
This commit is contained in:
parent
b74038ca63
commit
f6751483fd
@ -3,6 +3,7 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
from typing import Any, List, cast
|
from typing import Any, List, cast
|
||||||
|
|
||||||
import boto3
|
import boto3
|
||||||
@ -43,7 +44,7 @@ def get_files(site_name: str):
|
|||||||
)
|
)
|
||||||
|
|
||||||
recent_backup_files = backup_generator.get_recent_backup(24)
|
recent_backup_files = backup_generator.get_recent_backup(24)
|
||||||
return [f for f in recent_backup_files if f]
|
return [Path(f) for f in recent_backup_files if f]
|
||||||
|
|
||||||
|
|
||||||
def upload(arguments: Arguments):
|
def upload(arguments: Arguments):
|
||||||
@ -54,12 +55,15 @@ def upload(arguments: Arguments):
|
|||||||
return
|
return
|
||||||
|
|
||||||
bucket = get_bucket(arguments)
|
bucket = get_bucket(arguments)
|
||||||
print(f"Uploading files: {str(files)}")
|
|
||||||
|
|
||||||
for file_name in files:
|
for path in files:
|
||||||
abs_file_path = os.path.abspath(file_name)
|
print(f"Uploading {path}")
|
||||||
bucket.upload_file(Filename=abs_file_path, Key=abs_file_path)
|
filename = str(path.absolute())
|
||||||
os.remove(file_name)
|
key = str(Path(arguments.site) / path.name)
|
||||||
|
bucket.upload_file(Filename=filename, Key=key)
|
||||||
|
os.remove(path)
|
||||||
|
|
||||||
|
print("Done!")
|
||||||
|
|
||||||
|
|
||||||
def _parse_args(args: List[str]):
|
def _parse_args(args: List[str]):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user