aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/system/version.go14
-rw-r--r--docs/source/markdown/podman-info.1.md4
-rw-r--r--docs/source/markdown/podman-version.1.md13
-rw-r--r--libpod/define/version.go28
-rw-r--r--pkg/bindings/system/system.go12
-rw-r--r--pkg/varlinkapi/system.go2
-rw-r--r--test/system/001-basic.bats2
-rw-r--r--version/version.go4
8 files changed, 46 insertions, 33 deletions
diff --git a/cmd/podman/system/version.go b/cmd/podman/system/version.go
index b7fa289a5..92a3225b6 100644
--- a/cmd/podman/system/version.go
+++ b/cmd/podman/system/version.go
@@ -7,6 +7,7 @@ import (
"strings"
"text/tabwriter"
+ "github.com/containers/buildah/pkg/formats"
"github.com/containers/libpod/cmd/podman/registry"
"github.com/containers/libpod/cmd/podman/validate"
"github.com/containers/libpod/libpod/define"
@@ -51,6 +52,17 @@ func version(cmd *cobra.Command, args []string) error {
if !strings.HasSuffix(versionFormat, "\n") {
versionFormat += "\n"
}
+ out := formats.StdoutTemplate{Output: versions, Template: versionFormat}
+ err := out.Out()
+ if err != nil {
+ // On Failure, assume user is using older version of podman version --format and check client
+ versionFormat = strings.Replace(versionFormat, ".Server.", ".", 1)
+ out = formats.StdoutTemplate{Output: versions.Client, Template: versionFormat}
+ if err1 := out.Out(); err1 != nil {
+ return err
+ }
+ }
+ return nil
}
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
@@ -73,7 +85,7 @@ func version(cmd *cobra.Command, args []string) error {
func formatVersion(writer io.Writer, version *define.Version) {
fmt.Fprintf(writer, "Version:\t%s\n", version.Version)
- fmt.Fprintf(writer, "RemoteAPI Version:\t%d\n", version.RemoteAPIVersion)
+ fmt.Fprintf(writer, "API Version:\t%d\n", version.APIVersion)
fmt.Fprintf(writer, "Go Version:\t%s\n", version.GoVersion)
if version.GitCommit != "" {
fmt.Fprintf(writer, "Git Commit:\t%s\n", version.GitCommit)
diff --git a/docs/source/markdown/podman-info.1.md b/docs/source/markdown/podman-info.1.md
index a3f311ce4..24ab97c91 100644
--- a/docs/source/markdown/podman-info.1.md
+++ b/docs/source/markdown/podman-info.1.md
@@ -121,7 +121,7 @@ version:
GitCommit: c3678ce3289f4195f3f16802411e795c6a587c9f-dirty
GoVersion: go1.14.2
OsArch: linux/amd64
- RemoteAPIVersion: 1
+ APIVersion: 1
Version: 2.0.0
```
Run podman info with JSON formatted response:
@@ -228,7 +228,7 @@ Run podman info with JSON formatted response:
]
},
"version": {
- "RemoteAPIVersion": 1,
+ "APIVersion": 1,
"Version": "2.0.0",
"GoVersion": "go1.14.2",
"GitCommit": "c3678ce3289f4195f3f16802411e795c6a587c9f-dirty",
diff --git a/docs/source/markdown/podman-version.1.md b/docs/source/markdown/podman-version.1.md
index 86c270e02..185e8e296 100644
--- a/docs/source/markdown/podman-version.1.md
+++ b/docs/source/markdown/podman-version.1.md
@@ -25,17 +25,18 @@ Change output format to "json" or a Go template.
A sample output of the `version` command:
```
$ podman version
-Version: 0.11.1
-Go Version: go1.11
-Git Commit: "8967a1d691ed44896b81ad48c863033f23c65eb0-dirty"
-Built: Thu Nov 8 22:35:40 2018
-OS/Arch: linux/amd64
+Version: 2.0.0
+API Version: 1
+Go Version: go1.14.2
+Git Commit: 4520664f63c3a7f9a80227715359e20069d95542
+Built: Tue May 19 10:48:59 2020
+OS/Arch: linux/amd64
```
Filtering out only the version:
```
$ podman version --format '{{.Client.Version}}'
-1.6.3
+2.0.0
```
## SEE ALSO
diff --git a/libpod/define/version.go b/libpod/define/version.go
index f37b9df41..3eb016264 100644
--- a/libpod/define/version.go
+++ b/libpod/define/version.go
@@ -20,13 +20,13 @@ var (
// Version is an output struct for varlink
type Version struct {
- RemoteAPIVersion int64
- Version string
- GoVersion string
- GitCommit string
- BuiltTime string
- Built int64
- OsArch string
+ APIVersion int64
+ Version string
+ GoVersion string
+ GitCommit string
+ BuiltTime string
+ Built int64
+ OsArch string
}
// GetVersion returns a VersionOutput struct for varlink and podman
@@ -42,12 +42,12 @@ func GetVersion() (Version, error) {
}
}
return Version{
- RemoteAPIVersion: podmanVersion.RemoteAPIVersion,
- Version: podmanVersion.Version,
- GoVersion: runtime.Version(),
- GitCommit: gitCommit,
- BuiltTime: time.Unix(buildTime, 0).Format(time.ANSIC),
- Built: buildTime,
- OsArch: runtime.GOOS + "/" + runtime.GOARCH,
+ APIVersion: podmanVersion.APIVersion,
+ Version: podmanVersion.Version,
+ GoVersion: runtime.Version(),
+ GitCommit: gitCommit,
+ BuiltTime: time.Unix(buildTime, 0).Format(time.ANSIC),
+ Built: buildTime,
+ OsArch: runtime.GOOS + "/" + runtime.GOARCH,
}, nil
}
diff --git a/pkg/bindings/system/system.go b/pkg/bindings/system/system.go
index e567e7a86..ed960b8e0 100644
--- a/pkg/bindings/system/system.go
+++ b/pkg/bindings/system/system.go
@@ -112,12 +112,12 @@ func Version(ctx context.Context) (*entities.SystemVersionReport, error) {
f, _ := strconv.ParseFloat(component.APIVersion, 64)
b, _ := time.Parse(time.RFC3339, component.BuildTime)
report.Server = &define.Version{
- RemoteAPIVersion: int64(f),
- Version: component.Version.Version,
- GoVersion: component.GoVersion,
- GitCommit: component.GitCommit,
- Built: b.Unix(),
- OsArch: fmt.Sprintf("%s/%s", component.Os, component.Arch),
+ APIVersion: int64(f),
+ Version: component.Version.Version,
+ GoVersion: component.GoVersion,
+ GitCommit: component.GitCommit,
+ Built: b.Unix(),
+ OsArch: fmt.Sprintf("%s/%s", component.Os, component.Arch),
}
return &report, err
}
diff --git a/pkg/varlinkapi/system.go b/pkg/varlinkapi/system.go
index 82efe9b5d..308f02274 100644
--- a/pkg/varlinkapi/system.go
+++ b/pkg/varlinkapi/system.go
@@ -28,7 +28,7 @@ func (i *VarlinkAPI) GetVersion(call iopodman.VarlinkCall) error {
versionInfo.GitCommit,
time.Unix(versionInfo.Built, 0).Format(time.RFC3339),
versionInfo.OsArch,
- versionInfo.RemoteAPIVersion,
+ versionInfo.APIVersion,
)
}
diff --git a/test/system/001-basic.bats b/test/system/001-basic.bats
index 5fc07acfb..71595f419 100644
--- a/test/system/001-basic.bats
+++ b/test/system/001-basic.bats
@@ -23,7 +23,7 @@ function setup() {
is "${lines[0]}" "Version:[ ]\+[1-9][0-9.]\+" "Version line 1"
is "$output" ".*Go Version: \+" "'Go Version' in output"
- is "$output" ".*RemoteAPI Version: \+" "API version in output"
+ is "$output" ".*API Version: \+" "API version in output"
}
diff --git a/version/version.go b/version/version.go
index fe602d8e1..4c7202e77 100644
--- a/version/version.go
+++ b/version/version.go
@@ -6,7 +6,7 @@ package version
// bumped.
const Version = "2.0.0-dev"
-// RemoteAPIVersion is the version for the remote
+// APIVersion is the version for the remote
// client API. It is used to determine compatibility
// between a remote podman client and its backend
-const RemoteAPIVersion = 1
+const APIVersion = 1