Resolve race condition in powerview when discovered by zeroconf and dhcp (#50908)
Set the host in the context before checking to ensure that the second discovery aborts. Seen when testing on a very fast system only
This commit is contained in:
parent
d9769900bb
commit
19aee19efd
3 changed files with 4 additions and 1 deletions
|
@ -113,6 +113,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
"""Confirm dhcp or homekit discovery."""
|
||||
# If we already have the host configured do
|
||||
# not open connections to it if we can avoid it.
|
||||
self.context[CONF_HOST] = self.discovered_ip
|
||||
for progress in self._async_in_progress():
|
||||
if progress.get("context", {}).get(CONF_HOST) == self.discovered_ip:
|
||||
return self.async_abort(reason="already_in_progress")
|
||||
|
@ -140,8 +141,8 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
data={CONF_HOST: self.powerview_config[CONF_HOST]},
|
||||
)
|
||||
|
||||
self.context[CONF_HOST] = self.discovered_ip
|
||||
self._set_confirm_only()
|
||||
self.context["title_placeholders"] = self.powerview_config
|
||||
return self.async_show_form(
|
||||
step_id="link", description_placeholders=self.powerview_config
|
||||
)
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
"description": "Do you want to setup {name} ({host})?"
|
||||
}
|
||||
},
|
||||
"flow_title": "{name} ({host})",
|
||||
"error": {
|
||||
"cannot_connect": "[%key:common::config_flow::error::cannot_connect%]",
|
||||
"unknown": "[%key:common::config_flow::error::unknown%]"
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
"cannot_connect": "Failed to connect",
|
||||
"unknown": "Unexpected error"
|
||||
},
|
||||
"flow_title": "{name} ({host})",
|
||||
"step": {
|
||||
"link": {
|
||||
"description": "Do you want to setup {name} ({host})?",
|
||||
|
|
Loading…
Add table
Reference in a new issue