From 615ba2e91d3056d22dde1c94d9dcda5123e3dfa0 Mon Sep 17 00:00:00 2001 From: Dennis Kliban Date: Tue, 23 Jul 2019 11:34:03 -0400 Subject: [PATCH] Problem: ruby client can't form-encode PUT requests Solution: switch ruby client to use Faraday This patch relies on a forked version of the openapi-generator-cli. Once the PR that introduces this functionality is merged into openapi-generator, the ruby client generation should be switched back to using the docker container for openapi-generator. https://github.com/OpenAPITools/openapi-generator/pull/3405 Required PR: https://github.com/pulp/pulpcore/pull/226 re: #4896 https://pulp.plan.io/issues/4896 --- .travis/install.sh | 3 ++- .travis/script.sh | 19 ++++++++++++++++--- generate.sh | 10 ++++++---- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/.travis/install.sh b/.travis/install.sh index 90ab754..40806a3 100644 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -18,7 +18,8 @@ if [ -n "$PULP_PR_NUMBER" ]; then fi pip install -e ./pulpcore[postgres] -cp ./pulpcore/.travis/test_bindings.py $TRAVIS_BUILD_DIR/ +cp ./pulpcore/.travis/test_bindings.py $TRAVIS_BUILD_DIR/.travis/ +cp ./pulpcore/.travis/test_bindings.rb $TRAVIS_BUILD_DIR/.travis/ git clone https://github.com/pulp/pulpcore-plugin.git diff --git a/.travis/script.sh b/.travis/script.sh index ea55325..e547be5 100644 --- a/.travis/script.sh +++ b/.travis/script.sh @@ -18,13 +18,26 @@ rq worker -n 'reserved-resource-worker_1@%h' -w 'pulpcore.tasking.worker.PulpWor sleep 8 sudo ./generate.sh pulpcore python - sudo ./generate.sh pulp_file python - pip install ./pulpcore-client pip install ./pulp_file-client -python test_bindings.py +python .travis/test_bindings.py + +rm -rf ./pulpcore-client +rm -rf ./pulp_file-client + +./generate.sh pulpcore ruby +cd pulpcore-client +gem build pulpcore_client +gem install --local ./pulpcore_client-.gem +cd .. +./generate.sh pulp_file ruby +cd pulp_file-client +gem build pulp_file_client +gem install --local ./pulp_file_client-.gem + +ruby .travis/test_bindings.rb # Travis' scripts use unbound variables. This is problematic, because the # changes made to this script's environment appear to persist when Travis' diff --git a/generate.sh b/generate.sh index d1c10b1..1492b45 100755 --- a/generate.sh +++ b/generate.sh @@ -30,13 +30,15 @@ then fi if [ $2 = 'ruby' ] then - docker run -u $(id -u) --rm -v ${PWD}:/local openapitools/openapi-generator-cli:v4.0.0 generate \ - -i /local/api.json \ + curl -o openapi-generator-cli.jar https://repos.fedorapeople.org/pulp/pulp/openapi/openapi-generator-cli.jar + java -jar openapi-generator-cli.jar generate \ + -i api.json \ -g ruby \ - -o /local/$1-client \ + -o $1-client \ -DgemName=$1_client \ - -DgemLicense="GPLv2" \ + -DgemLicense="GPL-2.0" \ -DgemVersion=${VERSION} \ + -Dlibrary=faraday \ --skip-validate-spec \ --strict-spec=false fi