Add data_manager.instance_name() public API (#6146)

This commit is contained in:
Jakub Kuczys
2023-05-12 12:53:53 +02:00
committed by GitHub
parent 91f19c7410
commit 2369017f6a
4 changed files with 23 additions and 10 deletions

View File

@@ -217,7 +217,7 @@ async def create_backup(dest: Path = Path.home()) -> Optional[Path]:
dest.mkdir(parents=True, exist_ok=True)
timestr = datetime.utcnow().strftime("%Y-%m-%dT%H-%M-%S")
backup_fpath = dest / f"redv3_{data_manager.instance_name}_{timestr}.tar.gz"
backup_fpath = dest / f"redv3_{data_manager.instance_name()}_{timestr}.tar.gz"
to_backup = []
exclusions = [
@@ -242,7 +242,7 @@ async def create_backup(dest: Path = Path.home()) -> Optional[Path]:
json.dump(repo_output, fs, indent=4)
instance_file = data_path / "instance.json"
with instance_file.open("w") as fs:
json.dump({data_manager.instance_name: data_manager.basic_config}, fs, indent=4)
json.dump({data_manager.instance_name(): data_manager.basic_config}, fs, indent=4)
for f in data_path.glob("**/*"):
if not any(ex in str(f) for ex in exclusions) and f.is_file():
to_backup.append(f)