aoh

A tool for running Ansible playbooks with `curl <url> | python` commands
git clone https://git.ashermorgan.net/aoh/
Log | Files | Refs | README

commit c132a4c6d846ddd12a54c72bce101a046d8a4944
parent 61374e95bc4a0a563198d48215fedd3c337e4957
Author: Asher Morgan <asher@ashermorgan.net>
Date:   Sat, 29 Aug 2026 12:40:04 -0700

Open recv/send bufs on demand

This allows clients to receive real-time output even for playbooks that
start with non-AoH tasks.

Diffstat:
Maoh/runner.py | 14++++----------
1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/aoh/runner.py b/aoh/runner.py @@ -56,16 +56,6 @@ class Runner: while not os.path.exists(self._LOGS_PATH): time.sleep(0.1) self._logs = open(self._LOGS_PATH, 'r') # noqa: SIM115 - - # The FIFO buffers may not get created if Ansible crashes/exits - # before calling the AoH connection plugin - while not os.path.exists(self._SENDBUF_PATH) and \ - not self._runner_finished(): - time.sleep(0.1) - if os.path.exists(self._RECVBUF_PATH): - # Note that recvbuf is created first, so sendbuf will exist too - self._recvbuf = open(self._RECVBUF_PATH, 'w') # noqa: SIM115 - self._sendbuf = open(self._SENDBUF_PATH, 'r') # noqa: SIM115 except: self.teardown() raise @@ -162,6 +152,8 @@ class Runner: assert self._logs is not None res['logs'] = self._logs.read() + if not self._recvbuf and os.path.exists(self._RECVBUF_PATH): + self._recvbuf = open(self._RECVBUF_PATH, 'w') # noqa: SIM115 if req and self._recvbuf: try: self._recvbuf.write(json.dumps(req) + '\n') @@ -170,6 +162,8 @@ class Runner: # Ansible should exit soon on its own pass + if not self._sendbuf and os.path.exists(self._SENDBUF_PATH): + self._sendbuf = open(self._SENDBUF_PATH, 'r') # noqa: SIM115 if self._sendbuf: line = self._sendbuf.readline() for key, val in json.loads(line or '{}').items():