Add support for using credstash as a secret store (#8494)
This commit is contained in:
1 parent
9d9ca64f26
commit
98568b5eb7
5 files changed
+104
No files matched your search
@@ -12,6 +12,11 @@ try:
|
||||
except ImportError:
|
||||
keyring = None
|
||||
|
||||
try:
|
||||
import credstash
|
||||
except ImportError:
|
||||
credstash = None
|
||||
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@@ -257,6 +262,15 @@ def _secret_yaml(loader: SafeLineLoader,
|
||||
_LOGGER.debug("Secret %s retrieved from keyring", node.value)
|
||||
return pwd
|
||||
|
||||
if credstash:
|
||||
try:
|
||||
pwd = credstash.getSecret(node.value, table=_SECRET_NAMESPACE)
|
||||
if pwd:
|
||||
_LOGGER.debug("Secret %s retrieved from credstash", node.value)
|
||||
return pwd
|
||||
except credstash.ItemNotFound:
|
||||
pass
|
||||
|
||||
_LOGGER.error("Secret %s not defined", node.value)
|
||||
raise HomeAssistantError(node.value)
|
||||
|
||||
|
||||
Reference in new issue
Block a user