mirror of
https://github.com/home-assistant/core.git
synced 2025-08-03 12:45:28 +02:00
Report backup size in bytes instead of MB (#131028)
Co-authored-by: Robert Resch <robert@resch.dev>
This commit is contained in:
@@ -56,7 +56,7 @@ class CoreLocalBackupAgent(LocalBackupAgent):
|
|||||||
backup_id=base_backup.backup_id,
|
backup_id=base_backup.backup_id,
|
||||||
name=base_backup.name,
|
name=base_backup.name,
|
||||||
date=base_backup.date,
|
date=base_backup.date,
|
||||||
size=round(backup_path.stat().st_size / 1_048_576, 2),
|
size=backup_path.stat().st_size,
|
||||||
protected=base_backup.protected,
|
protected=base_backup.protected,
|
||||||
)
|
)
|
||||||
backups[backup.backup_id] = backup
|
backups[backup.backup_id] = backup
|
||||||
|
@@ -613,7 +613,7 @@ class CoreBackupReaderWriter(BackupReaderWriter):
|
|||||||
date=date_str,
|
date=date_str,
|
||||||
name=backup_name,
|
name=backup_name,
|
||||||
protected=password is not None,
|
protected=password is not None,
|
||||||
size=round(size_in_bytes / 1_048_576, 2),
|
size=size_in_bytes,
|
||||||
)
|
)
|
||||||
success = True
|
success = True
|
||||||
return (backup, tar_file_path)
|
return (backup, tar_file_path)
|
||||||
|
@@ -11,7 +11,7 @@ class BaseBackup:
|
|||||||
date: str
|
date: str
|
||||||
name: str
|
name: str
|
||||||
protected: bool
|
protected: bool
|
||||||
size: float
|
size: int
|
||||||
|
|
||||||
def as_dict(self) -> dict:
|
def as_dict(self) -> dict:
|
||||||
"""Return a dict representation of this backup."""
|
"""Return a dict representation of this backup."""
|
||||||
|
@@ -24,5 +24,5 @@ def read_backup(backup_path: Path) -> BaseBackup:
|
|||||||
date=cast(str, data["date"]),
|
date=cast(str, data["date"]),
|
||||||
name=cast(str, data["name"]),
|
name=cast(str, data["name"]),
|
||||||
protected=cast(bool, data.get("protected", False)),
|
protected=cast(bool, data.get("protected", False)),
|
||||||
size=round(backup_path.stat().st_size / 1_048_576, 2),
|
size=backup_path.stat().st_size,
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user