mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Improve backup exclude filters (#141311)
* Improve backup exclude filters * Add comment
This commit is contained in:
parent
4f6daa227a
commit
36d32eaabc
@ -16,8 +16,8 @@ DATA_MANAGER: HassKey[BackupManager] = HassKey(DOMAIN)
|
||||
LOGGER = getLogger(__package__)
|
||||
|
||||
EXCLUDE_FROM_BACKUP = [
|
||||
"__pycache__/*",
|
||||
".DS_Store",
|
||||
"**/__pycache__/*",
|
||||
"**/.DS_Store",
|
||||
".HA_RESTORE",
|
||||
"*.db-shm",
|
||||
"*.log.*",
|
||||
|
@ -1726,7 +1726,9 @@ class CoreBackupReaderWriter(BackupReaderWriter):
|
||||
"""Filter to filter excludes."""
|
||||
|
||||
for exclude in excludes:
|
||||
if not path.match(exclude):
|
||||
# The home assistant core configuration directory is added as "data"
|
||||
# in the tar file, so we need to prefix that path to the filters.
|
||||
if not path.full_match(f"data/{exclude}"):
|
||||
continue
|
||||
LOGGER.debug("Ignoring %s because of %s", path, exclude)
|
||||
return True
|
||||
|
@ -76,6 +76,7 @@ CONFIG_DIR = {
|
||||
Path("backups/not_backup"),
|
||||
],
|
||||
"/another_subdir": [
|
||||
Path("another_subdir/.DS_Store"),
|
||||
Path("another_subdir/backups"),
|
||||
Path("another_subdir/tts"),
|
||||
],
|
||||
|
@ -70,8 +70,10 @@ _EXPECTED_FILES = [
|
||||
".storage",
|
||||
"another_subdir",
|
||||
"another_subdir/backups",
|
||||
"another_subdir/backups/backup.tar",
|
||||
"another_subdir/backups/not_backup",
|
||||
"another_subdir/tts",
|
||||
"another_subdir/tts/voice.mp3",
|
||||
"backups",
|
||||
"backups/not_backup",
|
||||
"tmp_backups",
|
||||
|
Loading…
x
Reference in New Issue
Block a user