Remove unnecessary instance attribute in Plex reauth config flow (#41000)
* Avoid unnecessary instance attribute * Don't need to enrich existing entry data
This commit is contained in:
parent
c7ebfdb403
commit
b3464c5087
2 changed files with 2 additions and 5 deletions
|
@ -114,7 +114,7 @@ async def async_setup_entry(hass, entry):
|
||||||
hass.config_entries.flow.async_init(
|
hass.config_entries.flow.async_init(
|
||||||
PLEX_DOMAIN,
|
PLEX_DOMAIN,
|
||||||
context={CONF_SOURCE: SOURCE_REAUTH},
|
context={CONF_SOURCE: SOURCE_REAUTH},
|
||||||
data={**entry.data, "config_entry_id": entry.entry_id},
|
data=entry.data,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
|
|
|
@ -96,7 +96,6 @@ class PlexFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
self.token = None
|
self.token = None
|
||||||
self.client_id = None
|
self.client_id = None
|
||||||
self._manual = False
|
self._manual = False
|
||||||
self._entry_id = None
|
|
||||||
|
|
||||||
async def async_step_user(
|
async def async_step_user(
|
||||||
self, user_input=None, errors=None
|
self, user_input=None, errors=None
|
||||||
|
@ -230,12 +229,11 @@ class PlexFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
PLEX_SERVER_CONFIG: entry_config,
|
PLEX_SERVER_CONFIG: entry_config,
|
||||||
}
|
}
|
||||||
|
|
||||||
await self.async_set_unique_id(server_id)
|
entry = await self.async_set_unique_id(server_id)
|
||||||
if (
|
if (
|
||||||
self.context[CONF_SOURCE] # pylint: disable=no-member
|
self.context[CONF_SOURCE] # pylint: disable=no-member
|
||||||
== config_entries.SOURCE_REAUTH
|
== config_entries.SOURCE_REAUTH
|
||||||
):
|
):
|
||||||
entry = self.hass.config_entries.async_get_entry(self._entry_id)
|
|
||||||
self.hass.config_entries.async_update_entry(entry, data=data)
|
self.hass.config_entries.async_update_entry(entry, data=data)
|
||||||
_LOGGER.debug("Updated config entry for %s", plex_server.friendly_name)
|
_LOGGER.debug("Updated config entry for %s", plex_server.friendly_name)
|
||||||
await self.hass.config_entries.async_reload(entry.entry_id)
|
await self.hass.config_entries.async_reload(entry.entry_id)
|
||||||
|
@ -329,7 +327,6 @@ class PlexFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
async def async_step_reauth(self, data):
|
async def async_step_reauth(self, data):
|
||||||
"""Handle a reauthorization flow request."""
|
"""Handle a reauthorization flow request."""
|
||||||
self.current_login = dict(data)
|
self.current_login = dict(data)
|
||||||
self._entry_id = self.current_login.pop("config_entry_id")
|
|
||||||
return await self.async_step_user()
|
return await self.async_step_user()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue