mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-17 06:06:29 +00:00
Add reload api call to supervisor (#8)
* Add reload api call to supervisor * Pump version
This commit is contained in:
parent
f056d175b7
commit
03c3c9b6a1
76
API.md
76
API.md
@ -1,41 +1,5 @@
|
||||
# HassIO Server
|
||||
|
||||
## Host Controll
|
||||
|
||||
Communicate over unix socket with a host daemon.
|
||||
|
||||
- commands
|
||||
```
|
||||
# info
|
||||
-> {'os', 'version', 'current', 'level', 'hostname'}
|
||||
# reboot
|
||||
# shutdown
|
||||
# host-update [v]
|
||||
|
||||
# network info
|
||||
# network hostname xy
|
||||
# network wlan ssd xy
|
||||
# network wlan password xy
|
||||
# network int ip xy
|
||||
# network int netmask xy
|
||||
# network int route xy
|
||||
```
|
||||
|
||||
level:
|
||||
- 1: power functions
|
||||
- 2: host update
|
||||
- 4: network functions
|
||||
|
||||
Answer:
|
||||
```
|
||||
{}|OK|ERROR|WRONG
|
||||
```
|
||||
|
||||
- {}: json
|
||||
- OK: call was successfully
|
||||
- ERROR: error on call
|
||||
- WRONG: not supported
|
||||
|
||||
## HassIO REST API
|
||||
|
||||
Interface for HomeAssistant to controll things from supervisor.
|
||||
@ -94,6 +58,10 @@ Optional:
|
||||
}
|
||||
```
|
||||
|
||||
- `/supervisor/reload`
|
||||
|
||||
Reload addons/version.
|
||||
|
||||
### Host
|
||||
|
||||
- `/host/shutdown`
|
||||
@ -194,3 +162,39 @@ Optional:
|
||||
"version": "VERSION"
|
||||
}
|
||||
```
|
||||
|
||||
## Host Controll
|
||||
|
||||
Communicate over unix socket with a host daemon.
|
||||
|
||||
- commands
|
||||
```
|
||||
# info
|
||||
-> {'os', 'version', 'current', 'level', 'hostname'}
|
||||
# reboot
|
||||
# shutdown
|
||||
# host-update [v]
|
||||
|
||||
# network info
|
||||
# network hostname xy
|
||||
# network wlan ssd xy
|
||||
# network wlan password xy
|
||||
# network int ip xy
|
||||
# network int netmask xy
|
||||
# network int route xy
|
||||
```
|
||||
|
||||
level:
|
||||
- 1: power functions
|
||||
- 2: host update
|
||||
- 4: network functions
|
||||
|
||||
Answer:
|
||||
```
|
||||
{}|OK|ERROR|WRONG
|
||||
```
|
||||
|
||||
- {}: json
|
||||
- OK: call was successfully
|
||||
- ERROR: error on call
|
||||
- WRONG: not supported
|
||||
|
@ -49,6 +49,7 @@ class RestAPI(object):
|
||||
self.webapp.router.add_get('/supervisor/ping', api_supervisor.ping)
|
||||
self.webapp.router.add_get('/supervisor/info', api_supervisor.info)
|
||||
self.webapp.router.add_get('/supervisor/update', api_supervisor.update)
|
||||
self.webapp.router.add_get('/supervisor/reload', api_supervisor.reload)
|
||||
self.webapp.router.add_get(
|
||||
'/supervisor/options', api_supervisor.options)
|
||||
|
||||
|
@ -65,4 +65,18 @@ class APISupervisor(object):
|
||||
if version == self.supervisor.version:
|
||||
raise RuntimeError("Version is already in use")
|
||||
|
||||
return await asyncio.shield(self.supervisor.update(version))
|
||||
return await asyncio.shield(
|
||||
self.supervisor.update(version), loop=self.loop)
|
||||
|
||||
@api_process
|
||||
async def reload(self, request):
|
||||
"""Reload addons, config ect."""
|
||||
tasks = [self.addons.reaload(), self.config.fetch_update_infos()]
|
||||
results, _ = await asyncio.shield(
|
||||
asyncio.wait(tasks, loop=self.loop), loop=self.loop)
|
||||
|
||||
for result in results:
|
||||
if result.exception() is not None:
|
||||
raise RuntimeError("Some reload task fails!")
|
||||
|
||||
return True
|
||||
|
@ -1,5 +1,5 @@
|
||||
"""Const file for HassIO."""
|
||||
HASSIO_VERSION = '0.9'
|
||||
HASSIO_VERSION = '0.10'
|
||||
|
||||
URL_HASSIO_VERSION = \
|
||||
'https://raw.githubusercontent.com/pvizeli/hassio/master/version.json'
|
||||
|
@ -165,7 +165,7 @@ class DockerBase(object):
|
||||
if not self.container:
|
||||
return
|
||||
|
||||
_LOGGER.info("Stop %s docker application.", self.image)
|
||||
_LOGGER.info("Stop %s docker application", self.image)
|
||||
|
||||
self.container.reload()
|
||||
if self.container.status == 'running':
|
||||
@ -230,7 +230,7 @@ class DockerBase(object):
|
||||
|
||||
# update docker image
|
||||
if self._install(tag):
|
||||
_LOGGER.info("Cleanup old %s docker.", old_image)
|
||||
_LOGGER.info("Cleanup old %s docker", old_image)
|
||||
self._stop()
|
||||
try:
|
||||
self.dock.images.remove(image=old_image, force=True)
|
||||
|
Loading…
x
Reference in New Issue
Block a user