Frends.Python.ExecuteScript / 1.2.0
Summary
Runs a Python script, inline or from a file, on the agent and returns its exit code with both output streams. A preparation step can run first, for instance to install dependencies. This executes arbitrary code with the agent's privileges.
Typical use — reaching for a Python library that has no Frends equivalent — keep the script in version control and never build one from untrusted input
Essential parameters.
| Name | Type | Default | Example | Description |
|---|---|---|---|---|
| IsPreparationNeeded | Boolean |
False |
false |
Defines whether the preparation script is needed to run before the main script. |
| PreparationScriptPath | String |
– | /path/to/script.sh |
Path to a script that should be run before a main script. Script can be .ps1 on Windows or .sh on Linux. You can install here any dependencies that your main script needs (e.g. pip install -r requirements.txt; pip install numpy), move to a specific directory to execute the main script from there (e.g. cd /home/user/scripts), setup virtual environment (e.g. python -m venv venv; source venv/bin/activate) etc. |
| ExecutionMode | ExecutionMode |
File |
File |
Defines how script is provided. Possible values:
|
| ScriptPath | String |
– | /path/to/script.py |
Path to the python script file. |
| Code | String |
– | import sys; print(f'Hello, {sys.argv[1]}!') |
Inline python script to execute. |
| Arguments | String[] |
– | ['MyName'] |
Arguments provided to the script. |