From 995300260ee55f1586d5b8ac63edf0f049df7157 Mon Sep 17 00:00:00 2001 From: Bo Chen Date: Fri, 3 Dec 2021 08:42:39 -0800 Subject: [PATCH] virtcontainers: clh: Upgrade to openapi-generator v5.3.0 The latest release of openapi-generator v5.3.0 contains the fix for `dropping err` bug [1]. This patch also re-generated the client code of Cloud Hypervisor to have the bug fixed. [1] https://github.com/OpenAPITools/openapi-generator/pull/10275 Fixes: #3201 Signed-off-by: Bo Chen --- src/runtime/virtcontainers/pkg/cloud-hypervisor/Makefile | 2 +- .../pkg/cloud-hypervisor/client/.openapi-generator/VERSION | 2 +- .../virtcontainers/pkg/cloud-hypervisor/client/README.md | 2 +- .../virtcontainers/pkg/cloud-hypervisor/client/client.go | 3 +++ .../virtcontainers/pkg/cloud-hypervisor/client/git_push.sh | 7 +++---- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/Makefile b/src/runtime/virtcontainers/pkg/cloud-hypervisor/Makefile index 49dce1820..ed8cca60d 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/Makefile +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/Makefile @@ -13,7 +13,7 @@ YQ := $(shell command -v yq 2> /dev/null) generate-client-code: clean-generated-code docker run --rm \ --user $$(id -u):$$(id -g) \ - -v $${PWD}:/local openapitools/openapi-generator-cli:v5.2.1 generate \ + -v $${PWD}:/local openapitools/openapi-generator-cli:v5.3.0 generate \ -i /local/cloud-hypervisor.yaml \ -g go \ -o /local/client diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/VERSION b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/VERSION index 804440660..e230c8396 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/VERSION +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/VERSION @@ -1 +1 @@ -5.2.1 \ No newline at end of file +5.3.0 \ No newline at end of file diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md index ffc0caaee..f29bcf958 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md @@ -58,7 +58,7 @@ Note, enum values are always validated and all unused variables are silently ign ### URLs Configuration per Operation Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. -An operation is uniquely identifield by `"{classname}Service.{nickname}"` string. +An operation is uniquely identified by `"{classname}Service.{nickname}"` string. Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps. ``` diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/client.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/client.go index f8eddfcbe..757d7a35a 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/client.go +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/client.go @@ -366,6 +366,9 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err return } _, err = (*f).Write(b) + if err != nil { + return + } _, err = (*f).Seek(0, io.SeekStart) return } diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/git_push.sh b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/git_push.sh index ced3be2b0..f53a75d4f 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/git_push.sh +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/git_push.sh @@ -1,7 +1,7 @@ #!/bin/sh # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ # -# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" git_user_id=$1 git_repo_id=$2 @@ -38,14 +38,14 @@ git add . git commit -m "$release_note" # Sets the new remote -git_remote=`git remote` +git_remote=$(git remote) if [ "$git_remote" = "" ]; then # git remote not defined if [ "$GIT_TOKEN" = "" ]; then echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git else - git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git fi fi @@ -55,4 +55,3 @@ git pull origin master # Pushes (Forces) the changes in the local repository up to the remote repository echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" git push origin master 2>&1 | grep -v 'To https' -