mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-16 13:46:31 +00:00
Fix docker.run_command()
needing detach
but not enforcing it (#5979)
* Fix `docker.run_command()` needing `detach` but not enforcing it * Fix test
This commit is contained in:
parent
cf32f036c0
commit
d1c1a2d418
@ -213,9 +213,6 @@ class DockerHomeAssistant(DockerInterface):
|
|||||||
privileged=True,
|
privileged=True,
|
||||||
init=True,
|
init=True,
|
||||||
entrypoint=[],
|
entrypoint=[],
|
||||||
detach=True,
|
|
||||||
stdout=True,
|
|
||||||
stderr=True,
|
|
||||||
mounts=[
|
mounts=[
|
||||||
Mount(
|
Mount(
|
||||||
type=MountType.BIND.value,
|
type=MountType.BIND.value,
|
||||||
|
@ -313,6 +313,7 @@ class DockerAPI:
|
|||||||
container = self.docker.containers.run(
|
container = self.docker.containers.run(
|
||||||
image_with_tag,
|
image_with_tag,
|
||||||
command=command,
|
command=command,
|
||||||
|
detach=True,
|
||||||
network=self.network.name,
|
network=self.network.name,
|
||||||
use_config_proxy=False,
|
use_config_proxy=False,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
@ -331,7 +332,7 @@ class DockerAPI:
|
|||||||
with suppress(docker_errors.DockerException, requests.RequestException):
|
with suppress(docker_errors.DockerException, requests.RequestException):
|
||||||
container.remove(force=True, v=True)
|
container.remove(force=True, v=True)
|
||||||
|
|
||||||
return CommandReturn(result.get("StatusCode"), output)
|
return CommandReturn(result["StatusCode"], output)
|
||||||
|
|
||||||
def repair(self) -> None:
|
def repair(self) -> None:
|
||||||
"""Repair local docker overlayfs2 issues."""
|
"""Repair local docker overlayfs2 issues."""
|
||||||
|
@ -34,6 +34,7 @@ async def test_run_command_success(docker: DockerAPI):
|
|||||||
docker.docker.containers.run.assert_called_once_with(
|
docker.docker.containers.run.assert_called_once_with(
|
||||||
"alpine:3.18",
|
"alpine:3.18",
|
||||||
command="echo hello",
|
command="echo hello",
|
||||||
|
detach=True,
|
||||||
network=docker.network.name,
|
network=docker.network.name,
|
||||||
use_config_proxy=False,
|
use_config_proxy=False,
|
||||||
stdout=True,
|
stdout=True,
|
||||||
@ -66,6 +67,7 @@ async def test_run_command_with_defaults(docker: DockerAPI):
|
|||||||
docker.docker.containers.run.assert_called_once_with(
|
docker.docker.containers.run.assert_called_once_with(
|
||||||
"ubuntu:latest", # default tag
|
"ubuntu:latest", # default tag
|
||||||
command=None, # default command
|
command=None, # default command
|
||||||
|
detach=True,
|
||||||
network=docker.network.name,
|
network=docker.network.name,
|
||||||
use_config_proxy=False,
|
use_config_proxy=False,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user