mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-08-25 08:59:21 +00:00
Compare commits
22 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6e74e4c008 | ||
![]() |
5ebc58851b | ||
![]() |
16b09bbfc5 | ||
![]() |
d4b5fc79f4 | ||
![]() |
e51c044ccd | ||
![]() |
d3b1ba81f7 | ||
![]() |
26f55f02c0 | ||
![]() |
8050707ff9 | ||
![]() |
46252030cf | ||
![]() |
681fa835ef | ||
![]() |
d6560eb976 | ||
![]() |
3770b307af | ||
![]() |
0dacbb31be | ||
![]() |
bbdbd756a7 | ||
![]() |
508e38e622 | ||
![]() |
ffe45d0d02 | ||
![]() |
9206d1acf8 | ||
![]() |
da867ef8ef | ||
![]() |
4826201e51 | ||
![]() |
463c97f9e7 | ||
![]() |
3983928c6c | ||
![]() |
15e626027f |
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"local": {
|
"local": {
|
||||||
"name": "Local Add-Ons",
|
"name": "Local add-ons",
|
||||||
"url": "https://home-assistant.io/hassio",
|
"url": "https://home-assistant.io/hassio",
|
||||||
"maintainer": "you"
|
"maintainer": "you"
|
||||||
},
|
},
|
||||||
"core": {
|
"core": {
|
||||||
"name": "Built-in Add-Ons",
|
"name": "Official add-ons",
|
||||||
"url": "https://home-assistant.io/addons",
|
"url": "https://home-assistant.io/addons",
|
||||||
"maintainer": "Home Assistant authors"
|
"maintainer": "Home Assistant"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -8,8 +8,9 @@ import shutil
|
|||||||
import git
|
import git
|
||||||
|
|
||||||
from .utils import get_hash_from_repository
|
from .utils import get_hash_from_repository
|
||||||
from ..const import URL_HASSIO_ADDONS
|
from ..const import URL_HASSIO_ADDONS, ATTR_URL, ATTR_BRANCH
|
||||||
from ..coresys import CoreSysAttributes
|
from ..coresys import CoreSysAttributes
|
||||||
|
from ..validate import RE_REPOSITORY
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -22,9 +23,20 @@ class GitRepo(CoreSysAttributes):
|
|||||||
self.coresys = coresys
|
self.coresys = coresys
|
||||||
self.repo = None
|
self.repo = None
|
||||||
self.path = path
|
self.path = path
|
||||||
self.url = url
|
|
||||||
self.lock = asyncio.Lock(loop=coresys.loop)
|
self.lock = asyncio.Lock(loop=coresys.loop)
|
||||||
|
|
||||||
|
self._data = RE_REPOSITORY.match(url).groupdict()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def url(self):
|
||||||
|
"""Return repository URL."""
|
||||||
|
return self._data[ATTR_URL]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def branch(self):
|
||||||
|
"""Return repository branch."""
|
||||||
|
return self._data[ATTR_BRANCH]
|
||||||
|
|
||||||
async def load(self):
|
async def load(self):
|
||||||
"""Init git addon repo."""
|
"""Init git addon repo."""
|
||||||
if not self.path.is_dir():
|
if not self.path.is_dir():
|
||||||
@@ -46,12 +58,20 @@ class GitRepo(CoreSysAttributes):
|
|||||||
async def clone(self):
|
async def clone(self):
|
||||||
"""Clone git addon repo."""
|
"""Clone git addon repo."""
|
||||||
async with self.lock:
|
async with self.lock:
|
||||||
|
git_args = {
|
||||||
|
attribute: value
|
||||||
|
for attribute, value in (
|
||||||
|
('recursive', True),
|
||||||
|
('branch', self.branch)
|
||||||
|
) if value is not None
|
||||||
|
}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
_LOGGER.info("Clone addon %s repository", self.url)
|
_LOGGER.info("Clone addon %s repository", self.url)
|
||||||
self.repo = await self._loop.run_in_executor(
|
self.repo = await self._loop.run_in_executor(None, ft.partial(
|
||||||
None, ft.partial(
|
git.Repo.clone_from, self.url, str(self.path),
|
||||||
git.Repo.clone_from, self.url, str(self.path),
|
**git_args
|
||||||
recursive=True))
|
))
|
||||||
|
|
||||||
except (git.InvalidGitRepositoryError, git.NoSuchPathError,
|
except (git.InvalidGitRepositoryError, git.NoSuchPathError,
|
||||||
git.GitCommandError) as err:
|
git.GitCommandError) as err:
|
||||||
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
@@ -2,7 +2,7 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from ipaddress import ip_network
|
from ipaddress import ip_network
|
||||||
|
|
||||||
HASSIO_VERSION = '0.93'
|
HASSIO_VERSION = '0.96'
|
||||||
|
|
||||||
URL_HASSIO_VERSION = ('https://raw.githubusercontent.com/home-assistant/'
|
URL_HASSIO_VERSION = ('https://raw.githubusercontent.com/home-assistant/'
|
||||||
'hassio/{}/version.json')
|
'hassio/{}/version.json')
|
||||||
@@ -158,6 +158,7 @@ ATTR_SERVICES = 'services'
|
|||||||
ATTR_DISCOVERY = 'discovery'
|
ATTR_DISCOVERY = 'discovery'
|
||||||
ATTR_PROTECTED = 'protected'
|
ATTR_PROTECTED = 'protected'
|
||||||
ATTR_CRYPTO = 'crypto'
|
ATTR_CRYPTO = 'crypto'
|
||||||
|
ATTR_BRANCH = 'branch'
|
||||||
|
|
||||||
SERVICE_MQTT = 'mqtt'
|
SERVICE_MQTT = 'mqtt'
|
||||||
|
|
||||||
|
@@ -173,14 +173,17 @@ class SnapshotManager(CoreSysAttributes):
|
|||||||
if addon and addon.is_installed:
|
if addon and addon.is_installed:
|
||||||
addon_list.append(addon)
|
addon_list.append(addon)
|
||||||
continue
|
continue
|
||||||
_LOGGER.warning("Add-on %s not found", addon_slug)
|
_LOGGER.warning(
|
||||||
|
"Add-on %s not found/installed", addon_slug)
|
||||||
|
|
||||||
_LOGGER.info("Snapshot %s store Add-ons", snapshot.slug)
|
if addon_list:
|
||||||
await snapshot.store_addons(addon_list)
|
_LOGGER.info("Snapshot %s store Add-ons", snapshot.slug)
|
||||||
|
await snapshot.store_addons(addon_list)
|
||||||
|
|
||||||
# snapshot folders
|
# Snapshot folders
|
||||||
_LOGGER.info("Snapshot %s store folders", snapshot.slug)
|
if folders:
|
||||||
await snapshot.store_folders(folders)
|
_LOGGER.info("Snapshot %s store folders", snapshot.slug)
|
||||||
|
await snapshot.store_folders(folders)
|
||||||
|
|
||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
_LOGGER.exception("Snapshot %s error", snapshot.slug)
|
_LOGGER.exception("Snapshot %s error", snapshot.slug)
|
||||||
|
@@ -151,7 +151,7 @@ class Snapshot(CoreSysAttributes):
|
|||||||
|
|
||||||
def _encrypt_data(self, data):
|
def _encrypt_data(self, data):
|
||||||
"""Make data secure."""
|
"""Make data secure."""
|
||||||
if not self._key:
|
if not self._key or data is None:
|
||||||
return data
|
return data
|
||||||
|
|
||||||
return b64encode(
|
return b64encode(
|
||||||
@@ -159,7 +159,7 @@ class Snapshot(CoreSysAttributes):
|
|||||||
|
|
||||||
def _decrypt_data(self, data):
|
def _decrypt_data(self, data):
|
||||||
"""Make data readable."""
|
"""Make data readable."""
|
||||||
if not self._key:
|
if not self._key or data is None:
|
||||||
return data
|
return data
|
||||||
|
|
||||||
return Padding.unpad(
|
return Padding.unpad(
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
"""Validate functions."""
|
"""Validate functions."""
|
||||||
import uuid
|
import uuid
|
||||||
|
import re
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
import pytz
|
import pytz
|
||||||
@@ -11,13 +12,29 @@ from .const import (
|
|||||||
ATTR_SSL, ATTR_PORT, ATTR_WATCHDOG, ATTR_WAIT_BOOT, ATTR_UUID)
|
ATTR_SSL, ATTR_PORT, ATTR_WATCHDOG, ATTR_WAIT_BOOT, ATTR_UUID)
|
||||||
|
|
||||||
|
|
||||||
|
RE_REPOSITORY = re.compile(r"^(?P<url>[^#]+)(?:#(?P<branch>[\w\-]+))?$")
|
||||||
|
|
||||||
NETWORK_PORT = vol.All(vol.Coerce(int), vol.Range(min=1, max=65535))
|
NETWORK_PORT = vol.All(vol.Coerce(int), vol.Range(min=1, max=65535))
|
||||||
ALSA_CHANNEL = vol.Match(r"\d+,\d+")
|
ALSA_CHANNEL = vol.Match(r"\d+,\d+")
|
||||||
WAIT_BOOT = vol.All(vol.Coerce(int), vol.Range(min=1, max=60))
|
WAIT_BOOT = vol.All(vol.Coerce(int), vol.Range(min=1, max=60))
|
||||||
DOCKER_IMAGE = vol.Match(r"^[\w{}]+/[\-\w{}]+$")
|
DOCKER_IMAGE = vol.Match(r"^[\w{}]+/[\-\w{}]+$")
|
||||||
|
|
||||||
|
|
||||||
|
def validate_repository(repository):
|
||||||
|
"""Validate a valide repository."""
|
||||||
|
data = RE_REPOSITORY.match(repository)
|
||||||
|
if not data:
|
||||||
|
raise vol.Invalid("No valid repository format!")
|
||||||
|
|
||||||
|
# Validate URL
|
||||||
|
# pylint: disable=no-value-for-parameter
|
||||||
|
vol.Url()(data.group('url'))
|
||||||
|
|
||||||
|
return repository
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=no-value-for-parameter
|
# pylint: disable=no-value-for-parameter
|
||||||
REPOSITORIES = vol.All([vol.Url()], vol.Unique())
|
REPOSITORIES = vol.All([validate_repository], vol.Unique())
|
||||||
|
|
||||||
|
|
||||||
def validate_timezone(timezone):
|
def validate_timezone(timezone):
|
||||||
|
Submodule home-assistant-polymer updated: 5f5ac3834d...39172f8c49
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"hassio": "0.93",
|
"hassio": "0.96",
|
||||||
"homeassistant": "0.63.3",
|
"homeassistant": "0.64.3",
|
||||||
"resinos": "1.1",
|
"resinos": "1.1",
|
||||||
"resinhup": "0.3",
|
"resinhup": "0.3",
|
||||||
"generic": "0.3",
|
"generic": "0.3",
|
||||||
|
Reference in New Issue
Block a user