Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix with_strategy_settings info not sent over websocket #132939

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions homeassistant/components/backup/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class ManagerBackup(AgentBackup):

agent_ids: list[str]
failed_agent_ids: list[str]
with_strategy_settings: bool


@dataclass(frozen=True, kw_only=True, slots=True)
Expand Down Expand Up @@ -417,8 +418,10 @@ async def async_get_backups(
if (backup_id := agent_backup.backup_id) not in backups:
if known_backup := self.known_backups.get(backup_id):
failed_agent_ids = known_backup.failed_agent_ids
with_strategy_settings = known_backup.with_strategy_settings
else:
failed_agent_ids = []
with_strategy_settings = False
backups[backup_id] = ManagerBackup(
agent_ids=[],
addons=agent_backup.addons,
Expand All @@ -432,6 +435,7 @@ async def async_get_backups(
name=agent_backup.name,
protected=agent_backup.protected,
size=agent_backup.size,
with_strategy_settings=with_strategy_settings,
)
backups[backup_id].agent_ids.append(agent_ids[idx])

Expand Down Expand Up @@ -463,8 +467,10 @@ async def async_get_backup(
if backup is None:
if known_backup := self.known_backups.get(backup_id):
failed_agent_ids = known_backup.failed_agent_ids
with_strategy_settings = known_backup.with_strategy_settings
else:
failed_agent_ids = []
with_strategy_settings = False
backup = ManagerBackup(
agent_ids=[],
addons=result.addons,
Expand All @@ -478,6 +484,7 @@ async def async_get_backup(
name=result.name,
protected=result.protected,
size=result.size,
with_strategy_settings=with_strategy_settings,
)
backup.agent_ids.append(agent_ids[idx])

Expand Down
1 change: 1 addition & 0 deletions tests/components/backup/snapshots/test_backup.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down
23 changes: 23 additions & 0 deletions tests/components/backup/snapshots/test_websocket.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -1539,6 +1539,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -1606,6 +1607,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -1658,6 +1660,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -1694,6 +1697,7 @@
'name': 'Test 2',
'protected': False,
'size': 1,
'with_strategy_settings': False,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -1741,6 +1745,7 @@
'name': 'Test 2',
'protected': False,
'size': 1,
'with_strategy_settings': False,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -1783,6 +1788,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -1835,6 +1841,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -1888,6 +1895,7 @@
'name': 'Test',
'protected': False,
'size': 13,
'with_strategy_settings': False,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -1942,6 +1950,7 @@
'name': 'Test',
'protected': False,
'size': 13,
'with_strategy_settings': False,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -1994,6 +2003,7 @@
'name': 'Test',
'protected': False,
'size': 13,
'with_strategy_settings': False,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -2046,6 +2056,7 @@
'name': 'Test',
'protected': False,
'size': 13,
'with_strategy_settings': False,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -2098,6 +2109,7 @@
'name': 'Test',
'protected': False,
'size': 13,
'with_strategy_settings': False,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -2151,6 +2163,7 @@
'name': 'Test',
'protected': False,
'size': 13,
'with_strategy_settings': False,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -2203,6 +2216,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
}),
}),
'success': True,
Expand Down Expand Up @@ -2240,6 +2254,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
}),
}),
'success': True,
Expand Down Expand Up @@ -2290,6 +2305,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
}),
}),
'success': True,
Expand Down Expand Up @@ -2328,6 +2344,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
}),
}),
'success': True,
Expand Down Expand Up @@ -2590,6 +2607,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -2631,6 +2649,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -2673,6 +2692,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -2709,6 +2729,7 @@
'name': 'Test 2',
'protected': False,
'size': 1,
'with_strategy_settings': False,
}),
dict({
'addons': list([
Expand All @@ -2735,6 +2756,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -2777,6 +2799,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down
1 change: 1 addition & 0 deletions tests/components/backup/test_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ async def test_async_initiate_backup_with_agent_error(
"name": "Core 2025.1.0",
"protected": False,
"size": 123,
"with_strategy_settings": False,
}

await ws_client.send_json_auto_id(
Expand Down
2 changes: 2 additions & 0 deletions tests/components/cloud/test_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ async def test_agents_list_backups(
"size": 34519040,
"agent_ids": ["cloud.cloud"],
"failed_agent_ids": [],
"with_strategy_settings": False,
}
]

Expand Down Expand Up @@ -214,6 +215,7 @@ async def test_agents_list_backups_fail_cloud(
"size": 34519040,
"agent_ids": ["cloud.cloud"],
"failed_agent_ids": [],
"with_strategy_settings": False,
},
),
(
Expand Down
1 change: 1 addition & 0 deletions tests/components/hassio/test_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ async def test_agent_list_backups(
"name": "Test",
"protected": False,
"size": 1048576,
"with_strategy_settings": False,
}
]

Expand Down
2 changes: 2 additions & 0 deletions tests/components/kitchen_sink/test_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ async def test_agents_list_backups(
"name": "Kitchen sink syncer",
"protected": False,
"size": 1234,
"with_strategy_settings": False,
}
]

Expand Down Expand Up @@ -161,6 +162,7 @@ async def test_agents_upload(
"name": "Test",
"protected": False,
"size": 0.0,
"with_strategy_settings": False,
}


Expand Down
Loading