mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 01:08:12 +00:00
Abort rtsp_to_webrtc config flow on error during add-on discovery (#64500)
This commit is contained in:
parent
a1ed2a57e9
commit
86dbe068e7
@ -90,7 +90,7 @@ class RTSPToWebRTCConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
port = self._hassio_discovery[CONF_PORT]
|
||||
url = f"http://{host}:{port}"
|
||||
if error_code := await self._test_connection(url):
|
||||
errors = {"base": error_code}
|
||||
return self.async_abort(reason=error_code)
|
||||
|
||||
if user_input is None or errors:
|
||||
# Show initial confirmation or errors from server validation
|
||||
|
@ -19,7 +19,9 @@
|
||||
"server_unreachable": "Unable to communicate with RTSPtoWebRTC server. Check logs for more information."
|
||||
},
|
||||
"abort": {
|
||||
"single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]"
|
||||
"single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]",
|
||||
"server_failure": "RTSPtoWebRTC server returned an error. Check logs for more information.",
|
||||
"server_unreachable": "Unable to communicate with RTSPtoWebRTC server. Check logs for more information."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -210,6 +210,5 @@ async def test_hassio_discovery_server_failure(hass: HomeAssistant) -> None:
|
||||
side_effect=rtsp_to_webrtc.exceptions.ResponseError(),
|
||||
):
|
||||
result = await hass.config_entries.flow.async_configure(result["flow_id"], {})
|
||||
assert result.get("type") == "form"
|
||||
assert result.get("step_id") == "hassio_confirm"
|
||||
assert result.get("errors") == {"base": "server_failure"}
|
||||
assert result.get("type") == "abort"
|
||||
assert result.get("reason") == "server_failure"
|
||||
|
Loading…
x
Reference in New Issue
Block a user