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:
Felipe Santos 2025-06-30 11:08:05 -03:00 committed by GitHub
parent b8852872fe
commit cf32f036c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View File

@ -294,7 +294,7 @@ class DockerAPI:
def run_command(
self,
image: str,
tag: str = "latest",
version: str = "latest",
command: str | None = None,
**kwargs: Any,
) -> CommandReturn:
@ -305,11 +305,13 @@ class DockerAPI:
stdout = kwargs.get("stdout", 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
try:
container = self.docker.containers.run(
f"{image}:{tag}",
image_with_tag,
command=command,
network=self.network.name,
use_config_proxy=False,

View File

@ -22,7 +22,7 @@ async def test_run_command_success(docker: DockerAPI):
# Execute the 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