summaryrefslogtreecommitdiff
path: root/pkg/bindings
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2020-09-18 14:10:14 -0700
committerJhon Honce <jhonce@redhat.com>2020-09-18 15:13:58 -0700
commitc4b49afad37b4e64a1aa2b90f4d3b04626fabd44 (patch)
tree12ea0c158c3d51c3ed571706f22668ba48474d1d /pkg/bindings
parent5b7509c562e040ab8ed17990299c0b6eb52cecee (diff)
downloadpodman-c4b49afad37b4e64a1aa2b90f4d3b04626fabd44.tar.gz
podman-c4b49afad37b4e64a1aa2b90f4d3b04626fabd44.tar.bz2
podman-c4b49afad37b4e64a1aa2b90f4d3b04626fabd44.zip
Refactor version handling in cmd tree
* Move from simple string to semver objects * Change client API Version from '1' to 2.0.0 Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'pkg/bindings')
-rw-r--r--pkg/bindings/bindings.go2
-rw-r--r--pkg/bindings/system/system.go10
2 files changed, 9 insertions, 3 deletions
diff --git a/pkg/bindings/bindings.go b/pkg/bindings/bindings.go
index ae5610b0f..14f306910 100644
--- a/pkg/bindings/bindings.go
+++ b/pkg/bindings/bindings.go
@@ -22,5 +22,5 @@ var (
PFalse = &pFalse
// APIVersion - podman will fail to run if this value is wrong
- APIVersion = semver.MustParse("1.0.0")
+ APIVersion = semver.MustParse("2.0.0")
)
diff --git a/pkg/bindings/system/system.go b/pkg/bindings/system/system.go
index e995770ba..1203f5c3c 100644
--- a/pkg/bindings/system/system.go
+++ b/pkg/bindings/system/system.go
@@ -118,10 +118,10 @@ func Version(ctx context.Context) (*entities.SystemVersionReport, error) {
if err = response.Process(&component); err != nil {
return nil, err
}
- f, _ := strconv.ParseFloat(component.APIVersion, 64)
+
b, _ := time.Parse(time.RFC3339, component.BuildTime)
report.Server = &define.Version{
- APIVersion: int64(f),
+ APIVersion: component.APIVersion,
Version: component.Version.Version,
GoVersion: component.GoVersion,
GitCommit: component.GitCommit,
@@ -129,6 +129,12 @@ func Version(ctx context.Context) (*entities.SystemVersionReport, error) {
Built: b.Unix(),
OsArch: fmt.Sprintf("%s/%s", component.Os, component.Arch),
}
+
+ for _, c := range component.Components {
+ if c.Name == "Podman Engine" {
+ report.Server.APIVersion = c.Details["APIVersion"]
+ }
+ }
return &report, err
}