Skip to content

Commit 92cadb4

Browse files
authored
Fix /supervisor/reload after refactoring (#5791)
As discussed in [1], refactoring in #5759 changed signature of the reload method and CLI now gets unexpected schema when `ha su reload` is called. Change the method to return None as before and add a test for a proper body content. [1] https://github.com/home-assistant/supervisor/pull/5759/files#diff-1b4ed26f31e52ff5fe53efdc695eebacb1e46411f23cce58295591b2b20cd3faR238
1 parent 8b3bf54 commit 92cadb4

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

supervisor/api/supervisor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,9 @@ async def update(self, request: web.Request) -> None:
230230
await asyncio.shield(self.sys_supervisor.update(version))
231231

232232
@api_process
233-
def reload(self, request: web.Request) -> Awaitable:
233+
async def reload(self, request: web.Request) -> None:
234234
"""Reload add-ons, configuration, etc."""
235-
return asyncio.gather(
235+
await asyncio.gather(
236236
asyncio.shield(self.sys_updater.reload()),
237237
asyncio.shield(self.sys_homeassistant.secrets.reload()),
238238
asyncio.shield(self.sys_resolution.evaluate.evaluate_system()),

tests/api/test_supervisor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ async def test_api_supervisor_reload(api_client: TestClient):
235235
"""Test supervisor reload."""
236236
resp = await api_client.post("/supervisor/reload")
237237
assert resp.status == 200
238+
assert await resp.json() == {"result": "ok", "data": {}}
238239

239240

240241
async def test_api_supervisor_options_timezone(

0 commit comments

Comments
 (0)