-
How do you access stdout from a shell command? In Ansible, I'd just register the result of the shell command, and in the next action reference stdout from the result variable. When I try this: result = server.shell(commands="/usr/local/bin/node_exporter --version")
installed_version = re.search('version ([\\d.]+)', result.stdout_lines[0]).group(1)
if installed_version != EXPECTED_VERSION:
# Install updated version. I get the exception for "result.stdout_lines":
Which I understand to mean |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @cpburnz - to access output during execution you’ll need to use a callback function: https://docs.pyinfra.com/en/next/using-operations.html#output-callbacks, has an example of it. |
Beta Was this translation helpful? Give feedback.
Hi @cpburnz - to access output during execution you’ll need to use a callback function: https://docs.pyinfra.com/en/next/using-operations.html#output-callbacks, has an example of it.