diff --git a/build-docs.sh b/build-docs.sh index 6c378580afa7f53e96def3313228d4f5f91ca009..7f50cd17d269d117e327707174395833ee4af4ac 100755 --- a/build-docs.sh +++ b/build-docs.sh @@ -1,3 +1,7 @@ +pip install -r requirements.txt +pip install -e . + +export SETTINGS_FILENAME=./config.json.example python docs/dump-openapi-spec.py rm -r ./docs/build/* @@ -5,3 +9,5 @@ sphinx-apidoc lso lso/app.py -o docs/source -d 2 -f vale --config=docs/vale/.vale.ini sync vale --config=docs/vale/.vale.ini docs/source/*.rst lso/*.py sphinx-build -b html docs/source docs/build + +unset SETTINGS_FILENAME diff --git a/lso/playbook.py b/lso/playbook.py index 7bbfaeb7eb552724c813d373b4b4852f065cc9c5..3ee51a0baa625e319f159954cb0c34010ae3a65b 100644 --- a/lso/playbook.py +++ b/lso/playbook.py @@ -6,7 +6,7 @@ import uuid import ansible_runner import requests -from pydantic import BaseModel +from pydantic import BaseModel, HttpUrl logger = logging.getLogger(__name__) @@ -84,14 +84,14 @@ def _run_playbook_proc(job_id: str, playbook_path: str, extra_vars: dict, invent assert request_result.status_code == 204 -def run_playbook(playbook_path: str, extra_vars: dict, inventory: str, callback: str) -> PlaybookLaunchResponse: +def run_playbook(playbook_path: str, extra_vars: dict, inventory: str, callback: HttpUrl) -> PlaybookLaunchResponse: """Run an Ansible playbook against a specified inventory. :param str playbook_path: playbook to be executed. :param dict extra_vars: Any extra vars needed for the playbook to run. :param [str] inventory: The inventory that the playbook is executed against. - :param str callback: Callback URL where the playbook should send a status + :param :class:`HttpUrl` callback: Callback URL where the playbook should send a status update when execution is completed. This is used for workflow-orchestrator to continue with the next step in a workflow. :return: Result of playbook launch, this could either be successful or diff --git a/lso/routes/default.py b/lso/routes/default.py index fa3af428f348965f79196d3b657dc3c284e2176c..e79bf0251230ebc041599bd38411499c2359ab80 100644 --- a/lso/routes/default.py +++ b/lso/routes/default.py @@ -2,12 +2,13 @@ For now only includes a single endpoint that responds with the current version of the API and LSO. """ -import pkg_resources +from importlib import metadata + from fastapi import APIRouter from pydantic import BaseModel, constr API_VERSION = "0.1" -VERSION_STRING = constr(regex=r"\d+\.\d+") +VERSION_STRING = constr(pattern=r"\d+\.\d+") router = APIRouter() @@ -25,4 +26,4 @@ def version() -> Version: :return: Version object with both API and `goat-lso` versions numbers. """ - return Version(api=API_VERSION, module=pkg_resources.get_distribution("goat-lso").version) + return Version(api=API_VERSION, module=metadata.version("goat-lso"))