From 03a7b998d9580951f3d24b7145b3830d2e564aa3 Mon Sep 17 00:00:00 2001 From: Grant Gainey Date: Sat, 15 Aug 2026 23:20:49 -0400 Subject: [PATCH] Taught generate.sh to accept an option api-version parameter. api.json will be fetched from ../api/$3 (defaulting to v3) See https://redhat.atlassian.net/browse/PULP-2219 --- .github/workflows/scripts/install.sh | 2 +- generate.sh | 6 +++++- tests/test_python.py | 4 ++-- tests/test_ruby.rb | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/scripts/install.sh b/.github/workflows/scripts/install.sh index ec8d4bc..dd9d083 100755 --- a/.github/workflows/scripts/install.sh +++ b/.github/workflows/scripts/install.sh @@ -27,7 +27,7 @@ services: VARSYAML cat >> vars/main.yaml << VARSYAML -pulp_settings: {"allowed_content_checksums": ["sha1", "sha224", "sha256", "sha384", "sha512"], "allowed_export_paths": ["/tmp"], "allowed_import_paths": ["/tmp"]} +pulp_settings: {"allowed_content_checksums": ["sha1", "sha224", "sha256", "sha384", "sha512"], "allowed_export_paths": ["/tmp"], "allowed_import_paths": ["/tmp"], "secret_key": "$(python3 -c 'import secrets; print(secrets.token_urlsafe(50))')"} VARSYAML # ansible-playbook build_container.yaml diff --git a/generate.sh b/generate.sh index f108927..68d1e16 100755 --- a/generate.sh +++ b/generate.sh @@ -7,6 +7,7 @@ echo "DEPRECATED: use ./gen-client.sh instead." if [ $# -eq 0 ] then echo "No arguments provided" + echo "Expected \$1=PROJECT (eg pulpcore, pulp_rpm, pulp_container) \$2=LANGUAGE (eg python, ruby) [\$3=API-VERSION] (v3, v4 (optional))" exit 1 fi @@ -21,9 +22,11 @@ fi # Skip downloading the api.json if `USE_LOCAL_API_JSON` is set. if [[ -z "${USE_LOCAL_API_JSON:-}" ]] then + API_VERSION="${3:-v3}" PULP_URL="${PULP_URL:-http://localhost:24817}" PULP_API_ROOT="${PULP_API_ROOT:-/pulp/}" - PULP_URL="${PULP_URL}${PULP_API_ROOT}api/v3/" + PULP_URL="${PULP_URL}${PULP_API_ROOT}api/${API_VERSION}/" + echo "retrieving api.json for version ${API_VERSION}" # Download the schema RETRY_COUNT=0 @@ -41,6 +44,7 @@ fi echo ::group::BINDINGS +# COMPONENT is 'massaged' project-name, project-name is used as 'package' to gen-client ./gen-client.sh "${USE_LOCAL_API_JSON:-api.json}" "${COMPONENT}" "${2:-python}" "${1}" echo ::endgroup:: diff --git a/tests/test_python.py b/tests/test_python.py index 2bb0697..ac6442e 100644 --- a/tests/test_python.py +++ b/tests/test_python.py @@ -15,7 +15,7 @@ PublicationsFileApi, RemotesFileApi, FileFileRemote, - RepositorySyncURL, + FileRepositorySyncURL, FileFilePublication, FileFileRepository, RepositoriesFileApi, @@ -140,7 +140,7 @@ def upload_file_in_chunks(file_path): pprint(repository) # Sync a Repository -repository_sync_data = RepositorySyncURL(remote=file_remote.pulp_href) +repository_sync_data = FileRepositorySyncURL(remote=file_remote.pulp_href) sync_response = filerepositories.sync(repository.pulp_href, repository_sync_data) pprint(sync_response) diff --git a/tests/test_ruby.rb b/tests/test_ruby.rb index 5424b78..9a398b9 100644 --- a/tests/test_ruby.rb +++ b/tests/test_ruby.rb @@ -112,7 +112,7 @@ def upload_file_in_chunks(file_path) file_repository = @filerepositories_api.create(repository_data) # Sync a Repository -repository_sync_data = PulpFileClient::RepositorySyncURL.new({remote: file_remote.pulp_href}) +repository_sync_data = PulpFileClient::FileRepositorySyncURL.new({remote: file_remote.pulp_href}) sync_response = @filerepositories_api.sync(file_repository.pulp_href, repository_sync_data) # Monitor the sync task