1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2025-12-24 12:29:08 +00:00

Allow rebuild for local build addons (#158)

* Allow rebuild for local build addons

* fix lint
This commit is contained in:
Pascal Vizeli
2017-08-19 22:44:39 +02:00
committed by GitHub
parent 6a7617faad
commit f9b12a2eb2
4 changed files with 33 additions and 0 deletions

View File

@@ -518,6 +518,27 @@ class Addon(object):
"""
return self.docker.logs()
@check_installed
async def rebuild(self):
"""Performe a rebuild of local build addon."""
last_state = await self.state()
if not self.need_build:
_LOGGER.error("Can't rebuild a none local build addon!")
return False
# remove docker container but not addon config
if not await self.docker.remove():
return False
if not await self.docker.install(self.version_installed):
return False
# restore state
if last_state == STATE_STARTED:
await self.docker.run()
return True
@check_installed
async def snapshot(self, tar_file):
"""Snapshot a state of a addon."""