Only create cloud user if cloud in use (#29150)
* Only create cloud user if cloud in use * Pass context to alexa * Update requirements * Fix handing & design pattern for 0.30 * fix tests * Fix lint & tests * rename internal user
This commit is contained in:
1 parent
5d5d053bce
commit
b847d55077
15 files changed
+221
-145
No files matched your search
@@ -4,7 +4,6 @@ import logging
|
||||
from hass_nabucasa import Cloud
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.auth.const import GROUP_ID_ADMIN
|
||||
from homeassistant.components.alexa import const as alexa_const
|
||||
from homeassistant.components.google_assistant import const as ga_c
|
||||
from homeassistant.const import (
|
||||
@@ -186,19 +185,6 @@ async def async_setup(hass, config):
|
||||
prefs = CloudPreferences(hass)
|
||||
await prefs.async_initialize()
|
||||
|
||||
# Cloud user
|
||||
user = None
|
||||
if prefs.cloud_user:
|
||||
# Fetch the user. It can happen that the user no longer exists if
|
||||
# an image was restored without restoring the cloud prefs.
|
||||
user = await hass.auth.async_get_user(prefs.cloud_user)
|
||||
|
||||
if user is None:
|
||||
user = await hass.auth.async_create_system_user(
|
||||
"Home Assistant Cloud", [GROUP_ID_ADMIN]
|
||||
)
|
||||
await prefs.async_update(cloud_user=user.id)
|
||||
|
||||
# Initialize Cloud
|
||||
websession = hass.helpers.aiohttp_client.async_get_clientsession()
|
||||
client = CloudClient(hass, prefs, websession, alexa_conf, google_conf)
|
||||
|
||||
Reference in new issue
Block a user