mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +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__)
|
LOGGER = getLogger(__package__)
|
||||||
|
|
||||||
EXCLUDE_FROM_BACKUP = [
|
EXCLUDE_FROM_BACKUP = [
|
||||||
"__pycache__/*",
|
"**/__pycache__/*",
|
||||||
".DS_Store",
|
"**/.DS_Store",
|
||||||
".HA_RESTORE",
|
".HA_RESTORE",
|
||||||
"*.db-shm",
|
"*.db-shm",
|
||||||
"*.log.*",
|
"*.log.*",
|
||||||
|
@ -1726,7 +1726,9 @@ class CoreBackupReaderWriter(BackupReaderWriter):
|
|||||||
"""Filter to filter excludes."""
|
"""Filter to filter excludes."""
|
||||||
|
|
||||||
for exclude in 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
|
continue
|
||||||
LOGGER.debug("Ignoring %s because of %s", path, exclude)
|
LOGGER.debug("Ignoring %s because of %s", path, exclude)
|
||||||
return True
|
return True
|
||||||
|
@ -76,6 +76,7 @@ CONFIG_DIR = {
|
|||||||
Path("backups/not_backup"),
|
Path("backups/not_backup"),
|
||||||
],
|
],
|
||||||
"/another_subdir": [
|
"/another_subdir": [
|
||||||
|
Path("another_subdir/.DS_Store"),
|
||||||
Path("another_subdir/backups"),
|
Path("another_subdir/backups"),
|
||||||
Path("another_subdir/tts"),
|
Path("another_subdir/tts"),
|
||||||
],
|
],
|
||||||
|
@ -70,8 +70,10 @@ _EXPECTED_FILES = [
|
|||||||
".storage",
|
".storage",
|
||||||
"another_subdir",
|
"another_subdir",
|
||||||
"another_subdir/backups",
|
"another_subdir/backups",
|
||||||
|
"another_subdir/backups/backup.tar",
|
||||||
"another_subdir/backups/not_backup",
|
"another_subdir/backups/not_backup",
|
||||||
"another_subdir/tts",
|
"another_subdir/tts",
|
||||||
|
"another_subdir/tts/voice.mp3",
|
||||||
"backups",
|
"backups",
|
||||||
"backups/not_backup",
|
"backups/not_backup",
|
||||||
"tmp_backups",
|
"tmp_backups",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user