Conversation
…ker containers Agent-Logs-Url: https://github.com/gensyn/ssh_docker/sessions/ab4a1a96-bbbd-402b-a462-774112b3f842 Co-authored-by: gensyn <36128035+gensyn@users.noreply.github.com>
execute_command service for running arbitrary commands inside Docker containers
|
@copilot Please also update README.md to include the new service. |
…refresh/get_logs entries Agent-Logs-Url: https://github.com/gensyn/ssh_docker/sessions/f5bf918a-0a29-47ae-a9f6-656b36210ba4 Co-authored-by: gensyn <36128035+gensyn@users.noreply.github.com>
Done in ac70e7e. Added |
|
@copilot Add an optional timeout parameter. |
Agent-Logs-Url: https://github.com/gensyn/ssh_docker/sessions/526d5e74-a501-4728-ae10-169c19119f1d Co-authored-by: gensyn <36128035+gensyn@users.noreply.github.com>
Done in 3d2fc0c. Added an optional
|
|
@copilot Please add a Playwright test to test the new service. Is any other functionality untested by Playwright? |
… in mock-docker Agent-Logs-Url: https://github.com/gensyn/ssh_docker/sessions/34b7549e-f491-443e-923c-90550663d87d Co-authored-by: gensyn <36128035+gensyn@users.noreply.github.com>
Done in 2a6490b. Added a
Also added Other functionality currently untested by Playwright:
|
|
@copilot What about unit and integration tests? |
…chanics Agent-Logs-Url: https://github.com/gensyn/ssh_docker/sessions/0cb15be7-640e-4504-a6f2-faff7bf24c07 Co-authored-by: gensyn <36128035+gensyn@users.noreply.github.com>
Done in a54e734. Here's the full picture: Unit tests — already had Integration tests (added in a54e734):
All 75 unit tests and 72 integration tests pass. |
Adds a new HA service that executes an arbitrary command inside a Docker container on the remote host, identified by sensor entity ID, and returns the output.
Changes
const.py— newSERVICE_EXECUTE_COMMAND = "execute_command"constantcoordinator.py—execute_command(command: str, timeout: int = DEFAULT_TIMEOUT) -> tuple[str, int]method usingdocker exec <container> sh -c <cmd> 2>&1; both container name and command areshlex.quote()-escaped;timeoutis forwarded to_ssh_run__init__.py— registers the service withentity_id+command+ optionaltimeoutschema; returns{"output": ..., "exit_status": ...}(SupportsResponse.ONLY)services.yaml/strings.json/translations/en.json/translations/de.json— service metadata and translations, including the newtimeoutfieldREADME.md— documents theexecute_commandservice (and previously undocumentedrefresh/get_logsservices)tests/playwright/mock-docker.sh— newexeccase handles flags, validates the container is running, and executes the command with correct exit code propagationtests/playwright/test_services.py— newTestExecuteCommandclass with four Playwright E2E tests covering successful output, non-zero exit codes, thetimeoutparameter, and missing-field validation;test_services_registeredupdated to expectexecute_commandtests/unit_tests/test_init.py—TestExecuteCommandTimeoutclass with unit tests covering default and custom timeout forwarding to_ssh_runtests/integration_tests/test_integration.py—TestServicesRegisteredextended withtest_get_logs_service_registeredandtest_execute_command_service_registered;TestServiceMechanicsextended with three integration tests covering successful output/exit_status, timeout forwarding, and non-zero exit code captureUsage
Response:
{ "output": "NAME=\"Alpine Linux\"\n...", "exit_status": 0 }⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.