From 2dab39bf90fd91dc3a51c147353e812d510c2833 Mon Sep 17 00:00:00 2001 From: Marco Trevisan Date: Fri, 2 Sep 2022 09:21:33 +0200 Subject: [PATCH] supervisor/backup: Ensure compressed flag is respected by homeassistant (#3839) As per commit 80e67b3 we're supporting a compressed flag on backups to define whether a tar archive should be fully compressed or not, but while we respect this for all the addons and folders we don't do it for the actual homeassistant archive, that is always compressed despite the passed flag. Fix this by applying the same logic to the homeassistant archive too. --- supervisor/backups/backup.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/supervisor/backups/backup.py b/supervisor/backups/backup.py index 219451438..91dcdd0e8 100644 --- a/supervisor/backups/backup.py +++ b/supervisor/backups/backup.py @@ -465,8 +465,11 @@ class Backup(CoreSysAttributes): self._data[ATTR_HOMEASSISTANT] = {ATTR_VERSION: self.sys_homeassistant.version} # Backup Home Assistant Core config directory + tar_name = Path( + self._tmp.name, f"homeassistant.tar{'.gz' if self.compressed else ''}" + ) homeassistant_file = SecureTarFile( - Path(self._tmp.name, "homeassistant.tar.gz"), "w", key=self._key + tar_name, "w", key=self._key, gzip=self.compressed ) await self.sys_homeassistant.backup(homeassistant_file) @@ -479,8 +482,11 @@ class Backup(CoreSysAttributes): await self.sys_homeassistant.core.stop() # Restore Home Assistant Core config directory + tar_name = Path( + self._tmp.name, f"homeassistant.tar{'.gz' if self.compressed else ''}" + ) homeassistant_file = SecureTarFile( - Path(self._tmp.name, "homeassistant.tar.gz"), "r", key=self._key + tar_name, "r", key=self._key, gzip=self.compressed ) await self.sys_homeassistant.restore(homeassistant_file)