Skip to content

Commit d2f5f3f

Browse files
committed
refactor: pass verify_ssl to remaining direct-Supervisor httpx callers
Closes homeassistant-ai#1127. Mirrors the verify=self.verify_ssl propagation pattern established in homeassistant-ai#1126 (rest_client.py:_get_addon_logs_via_supervisor) at the two other direct-Supervisor httpx call sites: - tools_bug_report.py:_fetch_addon_logs uses get_global_settings().verify_ssl (module-level helper, no self/closure context). - settings_ui.py:_restart_addon uses server.client.verify_ssl (closure has access to server: HomeAssistantSmartMCPServer). Both paths effectively propagate Settings.verify_ssl via the access route appropriate to each call site's scope. The http://supervisor URL is plain HTTP and TLS-irrelevant in practice — the parameter keeps all three constructor sites consistent with the established HomeAssistantClient pattern.
1 parent 6751d08 commit d2f5f3f

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/ha_mcp/settings_ui.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,9 @@ async def _restart_addon(_: Request) -> JSONResponse:
790790
# Short timeout — the supervisor kills our process during restart so
791791
# the connection will drop. A connection drop is actually success.
792792
try:
793-
async with httpx.AsyncClient(timeout=5.0) as client:
793+
async with httpx.AsyncClient(
794+
timeout=5.0, verify=server.client.verify_ssl
795+
) as client:
794796
resp = await client.post(
795797
"http://supervisor/addons/self/restart",
796798
headers={"Authorization": f"Bearer {token}"},

src/ha_mcp/tools/tools_bug_report.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
from ha_mcp import __version__
2121

22+
from ..config import get_global_settings
2223
from ..utils.usage_logger import (
2324
AVG_LOG_ENTRIES_PER_TOOL,
2425
get_recent_logs,
@@ -181,7 +182,9 @@ async def _fetch_addon_logs() -> str:
181182
return ""
182183

183184
try:
184-
async with httpx.AsyncClient(timeout=10.0) as http_client:
185+
async with httpx.AsyncClient(
186+
timeout=10.0, verify=get_global_settings().verify_ssl
187+
) as http_client:
185188
resp = await http_client.get(
186189
"http://supervisor/addons/self/logs",
187190
headers={"Authorization": f"Bearer {token}"},

0 commit comments

Comments
 (0)