aoh

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

commit 25215b3ce88a695b88da280feba8270c060d0b6e
parent f4abb0d0b9f41a87df81b8d97f119e3969b23252
Author: Asher Morgan <asher@ashermorgan.net>
Date:   Tue,  8 Sep 2026 08:52:08 -0700

Rename API_URL flask variable to AOH_ORIGIN

Diffstat:
Maoh/client.py | 9+++++----
Maoh/server.py | 2+-
Maoh/templates/home.html | 2+-
3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/aoh/client.py b/aoh/client.py @@ -13,7 +13,7 @@ import typing from urllib.error import HTTPError from urllib.request import Request, urlopen -API = '{{ API_URL }}' #{# Substitution performed by Flask #} +AOH_ORIGIN = '{{ AOH_ORIGIN }}' #{# Substitution performed by Flask #} PASSWORD_PROMPTS = { 'aoh_password': 'AoH password: ', @@ -263,7 +263,7 @@ def runner_loop(runner_url, cookies): def create_runner(playbook, args): """Create a runner and enter the runner loop.""" - url = f'{API}/runners/{playbook}' + url = f'{AOH_ORIGIN}/runners/{playbook}' req = { 'host': platform.node(), @@ -287,7 +287,7 @@ def create_runner(playbook, args): # We assume that only one cookie will be set session_token = headers['Set-Cookie'].split(';')[0] - runner_loop(f"{API}{headers['Location']}", session_token) + runner_loop(f"{AOH_ORIGIN}{headers['Location']}", session_token) def cli(args): @@ -297,7 +297,8 @@ def cli(args): if len(args) >= 1 and args[0] != '-': prog = args[0] else: - prog = f'curl {API}/run | {os.path.basename(sys.executable)} -' + prog = f'curl {AOH_ORIGIN}/run | ' \ + f'{os.path.basename(sys.executable)} -' print(f'Usage: {prog} [-h] [<playbook>] [<opts>...]') print() diff --git a/aoh/server.py b/aoh/server.py @@ -34,7 +34,7 @@ def gc(): @app.context_processor def inject_stage_and_region(): return { - 'API_URL': os.getenv('AOH_ORIGIN', request.host_url[:-1]) + 'AOH_ORIGIN': os.getenv('AOH_ORIGIN', request.host_url[:-1]) } diff --git a/aoh/templates/home.html b/aoh/templates/home.html @@ -18,7 +18,7 @@ <h1>{{ description }}</h1> {% endif %} - {% set cmd = 'curl %s/run | python3' % API_URL %} + {% set cmd = 'curl %s/run | python3' % AOH_ORIGIN %} {% if playbook != 'main.yml' %} {% set cmd = cmd + ' - %s' % playbook %} {% endif %}