Import
Functions
| Function | Description |
|---|---|
run_custom_binary() | Execute a custom binary with arguments |
get_binary_path() | Get the full filesystem path to a binary |
list_binaries() | List all available custom binaries |
Exception Classes
| Exception | Description |
|---|---|
BinaryNotFoundError | Binary does not exist or is not executable |
Function Reference
run_custom_binary(binary_name, *args, **kwargs)
Execute a custom binary that was uploaded via lager binaries add.
| Parameter | Type | Default | Description |
|---|---|---|---|
binary_name | str | - | Name of the binary to run (e.g., ‘rt_newtmgr’) |
*args | str | - | Arguments to pass to the binary |
timeout | int | 30 | Maximum time in seconds to wait (None for no timeout) |
capture_output | bool | True | Capture stdout/stderr |
text | bool | True | Return stdout/stderr as strings instead of bytes |
check | bool | False | Raise CalledProcessError if return code is non-zero |
cwd | str | None | Working directory for the process |
env | dict | None | Environment variables (inherits from parent if None) |
input | str or bytes | None | Input to send to stdin |
subprocess.CompletedProcess with attributes:
returncode- Exit code of the processstdout- Captured standard output (ifcapture_output=True)stderr- Captured standard error (ifcapture_output=True)
BinaryNotFoundError- If the binary doesn’t exist or isn’t executablesubprocess.TimeoutExpired- If the process times outsubprocess.CalledProcessError- Ifcheck=Trueand return code is non-zero
get_binary_path(binary_name)
Get the full filesystem path to a custom binary.
| Parameter | Type | Description |
|---|---|---|
binary_name | str | Name of the binary (without path) |
str - Full path to the binary
Raises: BinaryNotFoundError - If the binary doesn’t exist or isn’t executable
list_binaries()
List all available custom binaries on the Lager Box.
list[str] - Sorted list of binary names
Examples
Run Device Interaction Tool
Run with Custom Environment
Check Available Binaries
Error Handling
Integration with Test Script
Uploading Binaries
Custom binaries are uploaded to the gateway using the CLI:Binary Location
On the gateway, custom binaries are stored at:- Host path:
/home/lagerdata/third_party/customer-binaries/ - Container path:
/home/www-data/customer-binaries/
Notes
- Binaries must be Linux x86_64 compatible (matching gateway architecture)
- Binary names cannot contain path separators (
/,\) or.. - Binaries must be executable (set automatically during upload)
- Default timeout is 30 seconds; use
timeout=Nonefor no limit - Use
capture_output=Falsefor interactive or streaming output - Environment variables are inherited from parent process unless
envis specified

