Add exclude DB option to backup service call (#101958)

pull/102058/head
Mike Degatano 2023-10-22 17:40:44 -04:00 committed by GitHub
parent 721c45b7a3
commit c8007b841b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 0 deletions

View File

@ -64,6 +64,7 @@ from .const import (
ATTR_COMPRESSED,
ATTR_FOLDERS,
ATTR_HOMEASSISTANT,
ATTR_HOMEASSISTANT_EXCLUDE_DATABASE,
ATTR_INPUT,
ATTR_LOCATION,
ATTR_PASSWORD,
@ -193,6 +194,7 @@ SCHEMA_BACKUP_FULL = vol.Schema(
vol.Optional(ATTR_LOCATION): vol.All(
cv.string, lambda v: None if v == "/backup" else v
),
vol.Optional(ATTR_HOMEASSISTANT_EXCLUDE_DATABASE): cv.boolean,
}
)

View File

@ -16,6 +16,7 @@ ATTR_ENDPOINT = "endpoint"
ATTR_FOLDERS = "folders"
ATTR_HEALTHY = "healthy"
ATTR_HOMEASSISTANT = "homeassistant"
ATTR_HOMEASSISTANT_EXCLUDE_DATABASE = "homeassistant_exclude_database"
ATTR_INPUT = "input"
ATTR_ISSUES = "issues"
ATTR_METHOD = "method"

View File

@ -58,12 +58,20 @@ backup_full:
example: my_backup_mount
selector:
backup_location:
homeassistant_exclude_database:
default: false
selector:
boolean:
backup_partial:
fields:
homeassistant:
selector:
boolean:
homeassistant_exclude_database:
default: false
selector:
boolean:
addons:
example: ["core_ssh", "core_samba", "core_mosquitto"]
selector:

View File

@ -296,6 +296,10 @@
"location": {
"name": "[%key:common::config_flow::data::location%]",
"description": "Name of a backup network storage to host backups."
},
"homeassistant_exclude_database": {
"name": "Home Assistant exclude database",
"description": "Exclude the Home Assistant database file from backup"
}
}
},
@ -330,6 +334,10 @@
"location": {
"name": "[%key:common::config_flow::data::location%]",
"description": "[%key:component::hassio::services::backup_full::fields::location::description%]"
},
"homeassistant_exclude_database": {
"name": "Home Assistant exclude database",
"description": "Exclude the Home Assistant database file from backup"
}
}
},

View File

@ -585,6 +585,7 @@ async def test_service_calls(
{
"name": "backup_name",
"location": "backup_share",
"homeassistant_exclude_database": True,
},
)
await hass.async_block_till_done()
@ -593,6 +594,7 @@ async def test_service_calls(
assert aioclient_mock.mock_calls[-1][2] == {
"name": "backup_name",
"location": "backup_share",
"homeassistant_exclude_database": True,
}
await hass.services.async_call(