mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 14:47:38 +00:00
Don't fail automatic backups after migration from HassOS/Supervised to Core/Container
This commit is contained in:
parent
fa4ebeb680
commit
14c8c54283
@ -1461,9 +1461,11 @@ class CoreBackupReaderWriter(BackupReaderWriter):
|
|||||||
backup_id = _generate_backup_id(date_str, backup_name)
|
backup_id = _generate_backup_id(date_str, backup_name)
|
||||||
|
|
||||||
if include_addons or include_all_addons or include_folders:
|
if include_addons or include_all_addons or include_folders:
|
||||||
raise BackupReaderWriterError(
|
if not extra_metadata.get("with_automatic_settings"):
|
||||||
"Addons and folders are not supported by core backup"
|
raise BackupReaderWriterError(
|
||||||
)
|
"Addons and folders are not supported by core backup"
|
||||||
|
)
|
||||||
|
LOGGER.debug("Ignoring addons and folders in automatic backup")
|
||||||
if not include_homeassistant:
|
if not include_homeassistant:
|
||||||
raise BackupReaderWriterError("Home Assistant must be included in backup")
|
raise BackupReaderWriterError("Home Assistant must be included in backup")
|
||||||
|
|
||||||
|
@ -422,6 +422,50 @@ async def test_generate_wrong_parameters(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
("parameters", "expected_error"),
|
||||||
|
[
|
||||||
|
(
|
||||||
|
{"include_addons": ["blah"]},
|
||||||
|
"Ignoring addons and folders in automatic backup",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
{"include_all_addons": True},
|
||||||
|
"Ignoring addons and folders in automatic backup",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
{"include_folders": ["ssl"]},
|
||||||
|
"Ignoring addons and folders in automatic backup",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
async def test_generate_wrong_parameters_automatic_settings(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
hass_ws_client: WebSocketGenerator,
|
||||||
|
parameters: dict[str, Any],
|
||||||
|
expected_error: str,
|
||||||
|
caplog: pytest.LogCaptureFixture,
|
||||||
|
) -> None:
|
||||||
|
"""Test generating a backup."""
|
||||||
|
await setup_backup_integration(hass, with_hassio=False)
|
||||||
|
|
||||||
|
client = await hass_ws_client(hass)
|
||||||
|
|
||||||
|
await client.send_json_auto_id(
|
||||||
|
{
|
||||||
|
"type": "backup/config/update",
|
||||||
|
"create_backup": {"agent_ids": ["backup.local"]} | parameters,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
response = await client.receive_json()
|
||||||
|
assert response["success"]
|
||||||
|
|
||||||
|
await client.send_json_auto_id({"type": "backup/generate_with_automatic_settings"})
|
||||||
|
response = await client.receive_json()
|
||||||
|
assert response["success"]
|
||||||
|
assert expected_error in caplog.text
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("mock_backup_generation")
|
@pytest.mark.usefixtures("mock_backup_generation")
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
("params", "expected_extra_call_params"),
|
("params", "expected_extra_call_params"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user