diff options
author | Jhon Honce <jhonce@redhat.com> | 2021-03-03 10:47:02 -0700 |
---|---|---|
committer | Jhon Honce <jhonce@redhat.com> | 2021-03-03 17:03:19 -0700 |
commit | f86d64130838fbeb75ea2776a2f2b6c4a49e58b3 (patch) | |
tree | 232fa1410600b9ed11f66d81d6d13f97e16c35c4 /pkg/bindings/connection.go | |
parent | 87e20560ac885c541784af1341098ce8e1e7a940 (diff) | |
download | podman-f86d64130838fbeb75ea2776a2f2b6c4a49e58b3.tar.gz podman-f86d64130838fbeb75ea2776a2f2b6c4a49e58b3.tar.bz2 podman-f86d64130838fbeb75ea2776a2f2b6c4a49e58b3.zip |
Use version package to track all versions
* Server, bindings, and CLI all now pull version information from version
package.
* Current /libpod API version slaved to podman/libpod Version
* Bindings validate against libpod API Minimal version
* Remove pkg/bindings/bindings.go and updated tests
Fixes: #9207
Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'pkg/bindings/connection.go')
-rw-r--r-- | pkg/bindings/connection.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/pkg/bindings/connection.go b/pkg/bindings/connection.go index ad16498d5..21a8e7a8b 100644 --- a/pkg/bindings/connection.go +++ b/pkg/bindings/connection.go @@ -14,6 +14,7 @@ import ( "github.com/blang/semver" "github.com/containers/podman/v3/pkg/terminal" + "github.com/containers/podman/v3/version" jsoniter "github.com/json-iterator/go" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -25,7 +26,7 @@ var ( BasePath = &url.URL{ Scheme: "http", Host: "d", - Path: "/v" + APIVersion.String() + "/libpod", + Path: "/v" + version.APIVersion[version.Libpod][version.CurrentAPI].String() + "/libpod", } ) @@ -168,15 +169,16 @@ func pingNewConnection(ctx context.Context) error { return err } - switch APIVersion.Compare(versionSrv) { + switch version.APIVersion[version.Libpod][version.MinimalAPI].Compare(versionSrv) { case -1, 0: // Server's job when Client version is equal or older return nil case 1: - return errors.Errorf("server API version is too old. Client %q server %q", APIVersion.String(), versionSrv.String()) + return errors.Errorf("server API version is too old. Client %q server %q", + version.APIVersion[version.Libpod][version.MinimalAPI].String(), versionSrv.String()) } } - return errors.Errorf("ping response was %q", response.StatusCode) + return errors.Errorf("ping response was %d", response.StatusCode) } func sshClient(_url *url.URL, secure bool, passPhrase string, identity string) (Connection, error) { |