Saving stdout/stderr from base.command fails in jobs
Closed this issue · 2 comments
This is probably related to #48.
I am having some problems to get the output from external commands in nested tasks. For example, this example taken from the readthedocs documentation works fine:
(ECE4) [spk@aa6-100 se]$ cat test1.yml
- base.command:
name: 'echo'
args: [ Hello, World! ]
stdout: "message"
- base.echo:
msg: "Command returned: {{message}}"
(ECE4) [spk@aa6-100 se]$ se test1.yml
2022-10-26 08:30:26 INFO [se.cli] Logging configured and started
2022-10-26 08:30:26 INFO [se.task:command <12ddecea88>] echo args=['Hello', 'World!'] cwd=None
2022-10-26 08:30:26 INFO [se.task:echo <d6333d4717>] Command returne...
{'Command returned': ['Hello World!', '']}
but the stdout
contents are missing after this modification:
(ECE4) [spk@aa6-100 se]$ cat test2.yml
- when: 1 is defined
do:
- base.command:
name: 'echo'
args: [ Hello, World! ]
stdout: "message"
- base.echo:
msg: "Command returned: {{message}}"
(ECE4) [spk@aa6-100 se]$ se test2.yml
2022-10-26 08:32:41 INFO [se.cli] Logging configured and started
2022-10-26 08:32:41 INFO [se.task:command <53e883fb63>] echo args=['Hello', 'World!'] cwd=None
2022-10-26 08:32:41 INFO [se.task:echo <af6a6da249>] Command returne...
{'Command returned': None}
I can confirm the bug. Slightly reduced test script (the conditional is not needed to trigger the bug):
- do:
- base.command:
name: echo
args: [ Hello, world! ]
stdout: message
- base.echo:
msg: "stdout is '{{message}}'"
which yields:
> se command-stdout-in-jobs.yml
2022-10-26 15:19:03 INFO [se.cli] Logging configured and started
2022-10-26 15:19:03 INFO [se.task:command <712f94adc5>] echo args=['Hello', 'world!'] cwd=None
2022-10-26 15:19:03 INFO [se.task:echo <be558eeab0>] stdout is {{mes...
stdout is ''
and that is definitely wrong.
I am not sure it is connected to #48, I rather suspect it has to do with the context update from jobs (in contrast to tasks). But I am not sure yet, will work on it!
@jmrgonza , you were actually right, it had to do with the base.command
task implementation as such, not with the SE infrastructure (luckily). Fixed in SE v0.12.7!