mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-14 20:56:30 +00:00
Fix docker_home_assistant_execute_command
not honoring HA version (#5978)
* Fix `docker_home_assistant_execute_command` not honoring HA version * Change variable name to image_with_tag * Fix test
This commit is contained in:
parent
b8852872fe
commit
cf32f036c0
@ -294,7 +294,7 @@ class DockerAPI:
|
|||||||
def run_command(
|
def run_command(
|
||||||
self,
|
self,
|
||||||
image: str,
|
image: str,
|
||||||
tag: str = "latest",
|
version: str = "latest",
|
||||||
command: str | None = None,
|
command: str | None = None,
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
) -> CommandReturn:
|
) -> CommandReturn:
|
||||||
@ -305,11 +305,13 @@ class DockerAPI:
|
|||||||
stdout = kwargs.get("stdout", True)
|
stdout = kwargs.get("stdout", True)
|
||||||
stderr = kwargs.get("stderr", True)
|
stderr = kwargs.get("stderr", True)
|
||||||
|
|
||||||
_LOGGER.info("Runing command '%s' on %s", command, image)
|
image_with_tag = f"{image}:{version}"
|
||||||
|
|
||||||
|
_LOGGER.info("Runing command '%s' on %s", command, image_with_tag)
|
||||||
container = None
|
container = None
|
||||||
try:
|
try:
|
||||||
container = self.docker.containers.run(
|
container = self.docker.containers.run(
|
||||||
f"{image}:{tag}",
|
image_with_tag,
|
||||||
command=command,
|
command=command,
|
||||||
network=self.network.name,
|
network=self.network.name,
|
||||||
use_config_proxy=False,
|
use_config_proxy=False,
|
||||||
|
@ -22,7 +22,7 @@ async def test_run_command_success(docker: DockerAPI):
|
|||||||
|
|
||||||
# Execute the command
|
# Execute the command
|
||||||
result = docker.run_command(
|
result = docker.run_command(
|
||||||
image="alpine", tag="3.18", command="echo hello", stdout=True, stderr=True
|
image="alpine", version="3.18", command="echo hello", stdout=True, stderr=True
|
||||||
)
|
)
|
||||||
|
|
||||||
# Verify the result
|
# Verify the result
|
||||||
|
Loading…
x
Reference in New Issue
Block a user