Skip to content

Commit

Permalink
Set the with_strategy_settings to None for unknown backups (#133466)
Browse files Browse the repository at this point in the history
  • Loading branch information
emontnemery authored Dec 18, 2024
1 parent 7730f42 commit 992afc4
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 30 deletions.
6 changes: 3 additions & 3 deletions homeassistant/components/backup/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ManagerBackup(AgentBackup):

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


@dataclass(frozen=True, kw_only=True, slots=True)
Expand Down Expand Up @@ -448,7 +448,7 @@ async def async_get_backups(
with_strategy_settings = known_backup.with_strategy_settings
else:
failed_agent_ids = []
with_strategy_settings = False
with_strategy_settings = None
backups[backup_id] = ManagerBackup(
agent_ids=[],
addons=agent_backup.addons,
Expand Down Expand Up @@ -497,7 +497,7 @@ async def async_get_backup(
with_strategy_settings = known_backup.with_strategy_settings
else:
failed_agent_ids = []
with_strategy_settings = False
with_strategy_settings = None
backup = ManagerBackup(
agent_ids=[],
addons=result.addons,
Expand Down
2 changes: 1 addition & 1 deletion tests/components/backup/snapshots/test_backup.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
'with_strategy_settings': None,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down
42 changes: 21 additions & 21 deletions tests/components/backup/snapshots/test_websocket.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
'with_strategy_settings': None,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -1607,7 +1607,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
'with_strategy_settings': None,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -1660,7 +1660,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
'with_strategy_settings': None,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -1697,7 +1697,7 @@
'name': 'Test 2',
'protected': False,
'size': 1,
'with_strategy_settings': False,
'with_strategy_settings': None,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -1745,7 +1745,7 @@
'name': 'Test 2',
'protected': False,
'size': 1,
'with_strategy_settings': False,
'with_strategy_settings': None,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -1788,7 +1788,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
'with_strategy_settings': None,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -1841,7 +1841,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
'with_strategy_settings': None,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -1895,7 +1895,7 @@
'name': 'Test',
'protected': False,
'size': 13,
'with_strategy_settings': False,
'with_strategy_settings': None,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -2003,7 +2003,7 @@
'name': 'Test',
'protected': False,
'size': 13,
'with_strategy_settings': False,
'with_strategy_settings': None,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -2056,7 +2056,7 @@
'name': 'Test',
'protected': False,
'size': 13,
'with_strategy_settings': False,
'with_strategy_settings': None,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -2109,7 +2109,7 @@
'name': 'Test',
'protected': False,
'size': 13,
'with_strategy_settings': False,
'with_strategy_settings': None,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -2216,7 +2216,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
'with_strategy_settings': None,
}),
}),
'success': True,
Expand Down Expand Up @@ -2254,7 +2254,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
'with_strategy_settings': None,
}),
}),
'success': True,
Expand Down Expand Up @@ -2305,7 +2305,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
'with_strategy_settings': None,
}),
}),
'success': True,
Expand Down Expand Up @@ -2344,7 +2344,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
'with_strategy_settings': None,
}),
}),
'success': True,
Expand Down Expand Up @@ -2607,7 +2607,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
'with_strategy_settings': None,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -2649,7 +2649,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
'with_strategy_settings': None,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -2692,7 +2692,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
'with_strategy_settings': None,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -2729,7 +2729,7 @@
'name': 'Test 2',
'protected': False,
'size': 1,
'with_strategy_settings': False,
'with_strategy_settings': None,
}),
dict({
'addons': list([
Expand All @@ -2756,7 +2756,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
'with_strategy_settings': None,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down Expand Up @@ -2799,7 +2799,7 @@
'name': 'Test',
'protected': False,
'size': 0,
'with_strategy_settings': False,
'with_strategy_settings': None,
}),
]),
'last_attempted_strategy_backup': None,
Expand Down
4 changes: 2 additions & 2 deletions tests/components/cloud/test_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ async def test_agents_list_backups(
"size": 34519040,
"agent_ids": ["cloud.cloud"],
"failed_agent_ids": [],
"with_strategy_settings": False,
"with_strategy_settings": None,
}
]

Expand Down Expand Up @@ -218,7 +218,7 @@ async def test_agents_list_backups_fail_cloud(
"size": 34519040,
"agent_ids": ["cloud.cloud"],
"failed_agent_ids": [],
"with_strategy_settings": False,
"with_strategy_settings": None,
},
),
(
Expand Down
4 changes: 2 additions & 2 deletions tests/components/hassio/test_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ async def test_agent_info(
"name": "Test",
"protected": False,
"size": 1048576,
"with_strategy_settings": False,
"with_strategy_settings": None,
},
),
(
Expand All @@ -362,7 +362,7 @@ async def test_agent_info(
"name": "Test",
"protected": False,
"size": 1048576,
"with_strategy_settings": False,
"with_strategy_settings": None,
},
),
],
Expand Down
2 changes: 1 addition & 1 deletion tests/components/kitchen_sink/test_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ async def test_agents_list_backups(
"name": "Kitchen sink syncer",
"protected": False,
"size": 1234,
"with_strategy_settings": False,
"with_strategy_settings": None,
}
]

Expand Down

0 comments on commit 992afc4

Please sign in to comment.