mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-22 16:46:29 +00:00
Only get stats for running containers (#3268)
This commit is contained in:
parent
5d4ce94155
commit
8458d9e0f6
@ -528,6 +528,10 @@ class DockerInterface(CoreSysAttributes):
|
|||||||
except (docker.errors.DockerException, requests.RequestException) as err:
|
except (docker.errors.DockerException, requests.RequestException) as err:
|
||||||
raise DockerError() from err
|
raise DockerError() from err
|
||||||
|
|
||||||
|
# container is not running
|
||||||
|
if docker_container.status != "running":
|
||||||
|
raise DockerError(f"Container {self.name} is not running", _LOGGER.error)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
stats = docker_container.stats(stream=False)
|
stats = docker_container.stats(stream=False)
|
||||||
return DockerStats(stats)
|
return DockerStats(stats)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user