mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-15 21:26:29 +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,
|
||||
init=True,
|
||||
entrypoint=[],
|
||||
detach=True,
|
||||
stdout=True,
|
||||
stderr=True,
|
||||
mounts=[
|
||||
Mount(
|
||||
type=MountType.BIND.value,
|
||||
|
@ -313,6 +313,7 @@ class DockerAPI:
|
||||
container = self.docker.containers.run(
|
||||
image_with_tag,
|
||||
command=command,
|
||||
detach=True,
|
||||
network=self.network.name,
|
||||
use_config_proxy=False,
|
||||
**kwargs,
|
||||
@ -331,7 +332,7 @@ class DockerAPI:
|
||||
with suppress(docker_errors.DockerException, requests.RequestException):
|
||||
container.remove(force=True, v=True)
|
||||
|
||||
return CommandReturn(result.get("StatusCode"), output)
|
||||
return CommandReturn(result["StatusCode"], output)
|
||||
|
||||
def repair(self) -> None:
|
||||
"""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(
|
||||
"alpine:3.18",
|
||||
command="echo hello",
|
||||
detach=True,
|
||||
network=docker.network.name,
|
||||
use_config_proxy=False,
|
||||
stdout=True,
|
||||
@ -66,6 +67,7 @@ async def test_run_command_with_defaults(docker: DockerAPI):
|
||||
docker.docker.containers.run.assert_called_once_with(
|
||||
"ubuntu:latest", # default tag
|
||||
command=None, # default command
|
||||
detach=True,
|
||||
network=docker.network.name,
|
||||
use_config_proxy=False,
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user