CLI env parameter value can't be read from file
Open
Nobody has claimed this yet.
CLI
enhancement
feature
- Dominant language
- Python
- Stars
- 6.5k
- Forks
- 787
- PR merge metrics
- No merged PRs in 30d
Description
According to documentation there is an option to read parameter value from file with @.
It doesn't work for env parameter.
From string (OK):
# st2 run core.local env='a=1' cmd='echo "ponies ${a} ${b}"'
# st2 run core.local env='a=1,b=2' cmd='echo "ponies ${a} ${b}"'
# st2 run core.local env='{"a": "1", "b": "2"}' cmd='echo "ponies ${a} ${b}"'
.
id: 56327b893ee8aa60bee3c2a5
status: succeeded
parameters:
cmd: echo "ponies ${a} ${b}"
env:
a: '1'
b: '2'
result:
failed: false
return_code: 0
stderr: ''
stdout: ponies 1 2
succeeded: true
Same from file (ERROR):
# echo '{"a": "1", "b": "2"}' > env.json
# st2 run core.local @env=env.json cmd='echo "ponies ${a} ${b}"'
ERROR: 400 Client Error: Bad Request
MESSAGE: '{"a": "1", "b": "2"}\n' is not of type 'object' for url: https://172.30.0.119:9101/executions
and
# echo 'a=1' > var.conf
# st2 run core.local @env=var.conf cmd='echo "ponies ${a} ${b}"'
ERROR: 400 Client Error: Bad Request
MESSAGE: 'a=1\n' is not of type 'object' for url: https://172.30.0.119:9101/executions
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the documented @file behavior with the st2 run CLI and compare it with inline env values. Trace how file-loaded parameters are parsed before the execution request; done means JSON and key-value environment files are accepted as an object and the documented command succeeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100