mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-25 18:16:32 +00:00
Improve add-on rebuild (#1011)
* Check version * Use image instead next_image
This commit is contained in:
parent
812c46d82b
commit
d7bb9013d4
@ -977,8 +977,11 @@ class Addon(CoreSysAttributes):
|
|||||||
last_state = await self.state()
|
last_state = await self.state()
|
||||||
|
|
||||||
if not self.need_build:
|
if not self.need_build:
|
||||||
_LOGGER.error("Can't rebuild a none local build add-on!")
|
_LOGGER.error("Can't rebuild a image based add-on")
|
||||||
raise AddonsNotSupportedError()
|
raise AddonsNotSupportedError()
|
||||||
|
if self.version_installed != self.last_version:
|
||||||
|
_LOGGER.error("Version changed, use Update instead Rebuild")
|
||||||
|
raise AddonsError()
|
||||||
|
|
||||||
# remove docker container but not addon config
|
# remove docker container but not addon config
|
||||||
try:
|
try:
|
||||||
@ -986,6 +989,8 @@ class Addon(CoreSysAttributes):
|
|||||||
await self.instance.install(self.version_installed)
|
await self.instance.install(self.version_installed)
|
||||||
except DockerAPIError:
|
except DockerAPIError:
|
||||||
raise AddonsError() from None
|
raise AddonsError() from None
|
||||||
|
else:
|
||||||
|
self._set_update(self.image, self.version_installed)
|
||||||
|
|
||||||
# restore state
|
# restore state
|
||||||
if last_state == STATE_STARTED:
|
if last_state == STATE_STARTED:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user