Provide options for legacy add-ons (#814)

* Provide options for legacy add-ons

* Remove whitespace from blank line

* Only provide primitive data types as Docker environment variable

* Fix linting issues

* Update addon.py
This commit is contained in:
Christian
2018-11-19 12:05:12 +01:00
committed by Pascal Vizeli
parent b8818788c9
commit ec366d8112

View File

@@ -81,12 +81,14 @@ class DockerAddon(DockerInterface):
"""Return environment for Docker add-on."""
addon_env = self.addon.environment or {}
# Need audio settings
if self.addon.with_audio:
addon_env.update({
'ALSA_OUTPUT': self.addon.audio_output,
'ALSA_INPUT': self.addon.audio_input,
})
# Provide options for legacy add-ons
if self.addon.legacy:
for key, value in self.addon.options.items():
if isinstance(value, (int, str)):
addon_env[key] = value
else:
_LOGGER.warning(
"Can not set nested option %s as Docker env", key)
return {
**addon_env,