diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-09-21 13:23:20 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-21 13:23:20 +0000 |
commit | 0a46b9c9e6aab2a5255914b285ae5b3cddb2aa5b (patch) | |
tree | 41f8c9bb5802aff0b6482f67477a255308e7bc8b /pkg | |
parent | 84c87fc7d3315ffcc44dde2469a613cb9b5c4190 (diff) | |
parent | c4b49afad37b4e64a1aa2b90f4d3b04626fabd44 (diff) | |
download | podman-0a46b9c9e6aab2a5255914b285ae5b3cddb2aa5b.tar.gz podman-0a46b9c9e6aab2a5255914b285ae5b3cddb2aa5b.tar.bz2 podman-0a46b9c9e6aab2a5255914b285ae5b3cddb2aa5b.zip |
Merge pull request #7696 from jwhonce/wip/version
Refactor version handling in cmd tree
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/bindings/bindings.go | 2 | ||||
-rw-r--r-- | pkg/bindings/system/system.go | 10 | ||||
-rw-r--r-- | pkg/domain/infra/abi/system_varlink.go | 2 | ||||
-rw-r--r-- | pkg/systemd/generate/containers.go | 2 | ||||
-rw-r--r-- | pkg/systemd/generate/pods.go | 2 |
5 files changed, 12 insertions, 6 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 } diff --git a/pkg/domain/infra/abi/system_varlink.go b/pkg/domain/infra/abi/system_varlink.go index d0a5c5407..ead84fc84 100644 --- a/pkg/domain/infra/abi/system_varlink.go +++ b/pkg/domain/infra/abi/system_varlink.go @@ -22,7 +22,7 @@ func (ic *ContainerEngine) VarlinkService(_ context.Context, opts entities.Servi service, err := varlink.NewService( "Atomic", "podman", - version.Version, + version.Version.String(), "https://github.com/containers/podman", ) if err != nil { diff --git a/pkg/systemd/generate/containers.go b/pkg/systemd/generate/containers.go index a4fdae46e..8090bcd3d 100644 --- a/pkg/systemd/generate/containers.go +++ b/pkg/systemd/generate/containers.go @@ -256,7 +256,7 @@ func executeContainerTemplate(info *containerInfo, options entities.GenerateSyst } if info.PodmanVersion == "" { - info.PodmanVersion = version.Version + info.PodmanVersion = version.Version.String() } if info.GenerateTimestamp { info.TimeStamp = fmt.Sprintf("%v", time.Now().Format(time.UnixDate)) diff --git a/pkg/systemd/generate/pods.go b/pkg/systemd/generate/pods.go index c41eedd17..c0acba37d 100644 --- a/pkg/systemd/generate/pods.go +++ b/pkg/systemd/generate/pods.go @@ -299,7 +299,7 @@ func executePodTemplate(info *podInfo, options entities.GenerateSystemdOptions) info.ExecStopPost = "{{.Executable}} pod rm --ignore -f --pod-id-file {{.PodIDFile}}" } if info.PodmanVersion == "" { - info.PodmanVersion = version.Version + info.PodmanVersion = version.Version.String() } if info.GenerateTimestamp { info.TimeStamp = fmt.Sprintf("%v", time.Now().Format(time.UnixDate)) |