Only set require_restart on config entry reload if its not recoverable (#66994)
This commit is contained in:
parent
cb877adb6a
commit
9a5eec561a
2 changed files with 38 additions and 5 deletions
|
@ -88,15 +88,17 @@ class ConfigManagerEntryResourceReloadView(HomeAssistantView):
|
|||
raise Unauthorized(config_entry_id=entry_id, permission="remove")
|
||||
|
||||
hass = request.app["hass"]
|
||||
entry = hass.config_entries.async_get_entry(entry_id)
|
||||
if not entry:
|
||||
return self.json_message("Invalid entry specified", HTTPStatus.NOT_FOUND)
|
||||
assert isinstance(entry, config_entries.ConfigEntry)
|
||||
|
||||
try:
|
||||
result = await hass.config_entries.async_reload(entry_id)
|
||||
await hass.config_entries.async_reload(entry_id)
|
||||
except config_entries.OperationNotAllowed:
|
||||
return self.json_message("Entry cannot be reloaded", HTTPStatus.FORBIDDEN)
|
||||
except config_entries.UnknownEntry:
|
||||
return self.json_message("Invalid entry specified", HTTPStatus.NOT_FOUND)
|
||||
|
||||
return self.json({"require_restart": not result})
|
||||
return self.json({"require_restart": not entry.state.recoverable})
|
||||
|
||||
|
||||
def _prepare_config_flow_result_json(result, prepare_result_json):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue