mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-12-24 12:29:08 +00:00
Allow to set a option als optional (#218)
* Update validate.py * Update validate.py * Update validate.py * Update validate.py * Update validate.py * fix bug * Extend schema * Update validate.py * fix lint * Update validate.py * Update validate.py * Fix deepmerge * Update setup.py * Update validate.py
This commit is contained in:
@@ -8,7 +8,6 @@ import shutil
|
||||
import tarfile
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
from deepmerge import Merger
|
||||
import voluptuous as vol
|
||||
from voluptuous.humanize import humanize_error
|
||||
|
||||
@@ -33,8 +32,6 @@ RE_WEBUI = re.compile(
|
||||
r"^(?:(?P<s_prefix>https?)|\[PROTO:(?P<t_proto>\w+)\])"
|
||||
r":\/\/\[HOST\]:\[PORT:(?P<t_port>\d+)\](?P<s_suffix>.*)$")
|
||||
|
||||
MERGE_OPT = Merger([(dict, ['merge'])], ['override'], ['override'])
|
||||
|
||||
|
||||
class Addon(object):
|
||||
"""Hold data for addon inside HassIO."""
|
||||
@@ -109,10 +106,10 @@ class Addon(object):
|
||||
def options(self):
|
||||
"""Return options with local changes."""
|
||||
if self.is_installed:
|
||||
return MERGE_OPT.merge(
|
||||
self.data.system[self._id][ATTR_OPTIONS],
|
||||
self.data.user[self._id][ATTR_OPTIONS],
|
||||
)
|
||||
return {
|
||||
**self.data.system[self._id][ATTR_OPTIONS],
|
||||
**self.data.user[self._id][ATTR_OPTIONS]
|
||||
}
|
||||
return self.data.cache[self._id][ATTR_OPTIONS]
|
||||
|
||||
@options.setter
|
||||
|
||||
Reference in New Issue
Block a user