diff --git a/supervisor/api/__init__.py b/supervisor/api/__init__.py index 3b2938482a3..f71e028f9d3 100644 --- a/supervisor/api/__init__.py +++ b/supervisor/api/__init__.py @@ -413,6 +413,7 @@ async def get_supervisor_logs(*args, **kwargs): # No need to capture HostNotSupportedError to Sentry, the cause # is known and reported to the user using the resolution center. capture_exception(err) + kwargs.pop("follow", None) # Follow is not supported for Docker logs return await api_supervisor.logs(*args, **kwargs) self.webapp.add_routes( diff --git a/tests/api/test_supervisor.py b/tests/api/test_supervisor.py index 4ec22470842..06735137c26 100644 --- a/tests/api/test_supervisor.py +++ b/tests/api/test_supervisor.py @@ -183,6 +183,17 @@ async def test_api_supervisor_fallback( b"\x1b[36m22-10-11 14:04:23 DEBUG (MainThread) [supervisor.utils.dbus] D-Bus call - org.freedesktop.DBus.Properties.call_get_all on /io/hass/os/AppArmor\x1b[0m", ] + # check fallback also works for the follow endpoint (no mock reset needed) + + with patch("supervisor.api._LOGGER.exception") as logger: + resp = await api_client.get("/supervisor/logs/follow") + logger.assert_called_once_with( + "Failed to get supervisor logs using advanced_logs API" + ) + + assert resp.status == 200 + assert resp.content_type == "text/plain" + journald_logs.reset_mock() # also check generic Python error