diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-01-22 15:28:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-22 15:28:19 +0100 |
commit | 7838a13b61ee893a6dad5cf4cc4e36c5ab74b855 (patch) | |
tree | 84f0df8442d5fd412c9b2838260e9d5cc16c989b | |
parent | ec969875fa13e90f4ce696e9d24b86a02f79f54a (diff) | |
parent | 5c8e7ed0dee117c9d423849f09f82d15957893a8 (diff) | |
download | podman-7838a13b61ee893a6dad5cf4cc4e36c5ab74b855.tar.gz podman-7838a13b61ee893a6dad5cf4cc4e36c5ab74b855.tar.bz2 podman-7838a13b61ee893a6dad5cf4cc4e36c5ab74b855.zip |
Merge pull request #2199 from baude/remoteversion
enable podman-remote version
-rwxr-xr-x | API.md | 2 | ||||
-rw-r--r-- | cmd/podman/commands.go | 1 | ||||
-rw-r--r-- | cmd/podman/info.go | 17 | ||||
-rw-r--r-- | cmd/podman/main.go | 1 | ||||
-rw-r--r-- | cmd/podman/varlink/io.podman.varlink | 3 | ||||
-rw-r--r-- | cmd/podman/version.go | 18 | ||||
-rw-r--r-- | libpod/version.go | 22 | ||||
-rw-r--r-- | pkg/varlinkapi/system.go | 11 | ||||
-rw-r--r-- | test/e2e/version_test.go | 2 | ||||
-rw-r--r-- | version/version.go | 5 |
10 files changed, 51 insertions, 31 deletions
@@ -1654,6 +1654,8 @@ git_commit [string](https://godoc.org/builtin#string) built [int](https://godoc.org/builtin#int) os_arch [string](https://godoc.org/builtin#string) + +remote_api_version [int](https://godoc.org/builtin#int) ## Errors ### <a name="ContainerNotFound"></a>type ContainerNotFound diff --git a/cmd/podman/commands.go b/cmd/podman/commands.go index 98eb92bab..718717009 100644 --- a/cmd/podman/commands.go +++ b/cmd/podman/commands.go @@ -38,7 +38,6 @@ func getAppCommands() []cli.Command { topCommand, umountCommand, unpauseCommand, - versionCommand, volumeCommand, waitCommand, } diff --git a/cmd/podman/info.go b/cmd/podman/info.go index c33ede548..3888829a3 100644 --- a/cmd/podman/info.go +++ b/cmd/podman/info.go @@ -1,11 +1,13 @@ package main import ( - "runtime" + "fmt" + rt "runtime" "github.com/containers/libpod/cmd/podman/formats" "github.com/containers/libpod/libpod" "github.com/containers/libpod/libpod/adapter" + "github.com/containers/libpod/version" "github.com/pkg/errors" "github.com/urfave/cli" ) @@ -38,6 +40,7 @@ func infoCmd(c *cli.Context) error { return err } info := map[string]interface{}{} + remoteClientInfo := map[string]interface{}{} runtime, err := adapter.GetRuntime(c) if err != nil { @@ -49,9 +52,13 @@ func infoCmd(c *cli.Context) error { if err != nil { return errors.Wrapf(err, "error getting info") } + if runtime.Remote { + remoteClientInfo["RemoteAPI Version"] = version.RemoteAPIVersion + remoteClientInfo["Podman Version"] = version.Version + remoteClientInfo["OS Arch"] = fmt.Sprintf("%s/%s", rt.GOOS, rt.GOARCH) + infoArr = append(infoArr, libpod.InfoData{Type: "client", Data: remoteClientInfo}) + } - // TODO This is no a problem child because we don't know if we should add information - // TODO about the client or the backend. Only do for traditional podman for now. if !runtime.Remote && c.Bool("debug") { debugInfo := debugInfo(c) infoArr = append(infoArr, libpod.InfoData{Type: "debug", Data: debugInfo}) @@ -80,8 +87,8 @@ func infoCmd(c *cli.Context) error { // top-level "debug" info func debugInfo(c *cli.Context) map[string]interface{} { info := map[string]interface{}{} - info["compiler"] = runtime.Compiler - info["go version"] = runtime.Version() + info["compiler"] = rt.Compiler + info["go version"] = rt.Version() info["podman version"] = c.App.Version version, _ := libpod.GetVersion() info["git commit"] = version.GitCommit diff --git a/cmd/podman/main.go b/cmd/podman/main.go index 20486e80d..c10590006 100644 --- a/cmd/podman/main.go +++ b/cmd/podman/main.go @@ -96,6 +96,7 @@ func main() { pullCommand, rmiCommand, tagCommand, + versionCommand, } app.Commands = append(app.Commands, getAppCommands()...) diff --git a/cmd/podman/varlink/io.podman.varlink b/cmd/podman/varlink/io.podman.varlink index 79300f9bc..86c3eb7ff 100644 --- a/cmd/podman/varlink/io.podman.varlink +++ b/cmd/podman/varlink/io.podman.varlink @@ -9,7 +9,8 @@ type Version ( go_version: string, git_commit: string, built: int, - os_arch: string + os_arch: string, + remote_api_version: int ) type NotImplemented ( diff --git a/cmd/podman/version.go b/cmd/podman/version.go index d81deb696..fd7f06b7c 100644 --- a/cmd/podman/version.go +++ b/cmd/podman/version.go @@ -2,6 +2,8 @@ package main import ( "fmt" + "os" + "text/tabwriter" "time" "github.com/containers/libpod/cmd/podman/formats" @@ -26,20 +28,22 @@ func versionCmd(c *cli.Context) error { default: out = formats.StdoutTemplate{Output: output, Template: versionOutputFormat} } - formats.Writer(out).Out() - return nil + return formats.Writer(out).Out() } - fmt.Println("Version: ", output.Version) - fmt.Println("Go Version: ", output.GoVersion) + w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0) + defer w.Flush() + fmt.Fprintf(w, "Version:\t%s\n", output.Version) + fmt.Fprintf(w, "RemoteAPI Version:\t%d\n", output.RemoteAPIVersion) + fmt.Fprintf(w, "Go Version:\t%s\n", output.GoVersion) if output.GitCommit != "" { - fmt.Println("Git Commit: ", output.GitCommit) + fmt.Fprintf(w, "Git Commit:\t%s\n", output.GitCommit) } // Prints out the build time in readable format if output.Built != 0 { - fmt.Println("Built: ", time.Unix(output.Built, 0).Format(time.ANSIC)) + fmt.Fprintf(w, "Built:\t%s\n", time.Unix(output.Built, 0).Format(time.ANSIC)) } - fmt.Println("OS/Arch: ", output.OsArch) + fmt.Fprintf(w, "OS/Arch:\t%s\n", output.OsArch) return nil } diff --git a/libpod/version.go b/libpod/version.go index 966588ae9..d2b99a275 100644 --- a/libpod/version.go +++ b/libpod/version.go @@ -19,11 +19,12 @@ var ( //Version is an output struct for varlink type Version struct { - Version string - GoVersion string - GitCommit string - Built int64 - OsArch string + RemoteAPIVersion int64 + Version string + GoVersion string + GitCommit string + Built int64 + OsArch string } // GetVersion returns a VersionOutput struct for varlink and podman @@ -39,10 +40,11 @@ func GetVersion() (Version, error) { } } return Version{ - Version: podmanVersion.Version, - GoVersion: runtime.Version(), - GitCommit: gitCommit, - Built: buildTime, - OsArch: runtime.GOOS + "/" + runtime.GOARCH, + RemoteAPIVersion: podmanVersion.RemoteAPIVersion, + Version: podmanVersion.Version, + GoVersion: runtime.Version(), + GitCommit: gitCommit, + Built: buildTime, + OsArch: runtime.GOOS + "/" + runtime.GOARCH, }, nil } diff --git a/pkg/varlinkapi/system.go b/pkg/varlinkapi/system.go index e50643dd0..376502f21 100644 --- a/pkg/varlinkapi/system.go +++ b/pkg/varlinkapi/system.go @@ -16,11 +16,12 @@ func (i *LibpodAPI) GetVersion(call iopodman.VarlinkCall) error { } return call.ReplyGetVersion(iopodman.Version{ - Version: versionInfo.Version, - Go_version: versionInfo.GoVersion, - Git_commit: versionInfo.GitCommit, - Built: versionInfo.Built, - Os_arch: versionInfo.OsArch, + Remote_api_version: versionInfo.RemoteAPIVersion, + Version: versionInfo.Version, + Go_version: versionInfo.GoVersion, + Git_commit: versionInfo.GitCommit, + Built: versionInfo.Built, + Os_arch: versionInfo.OsArch, }) } diff --git a/test/e2e/version_test.go b/test/e2e/version_test.go index 8ae2eb9ca..68a462bdb 100644 --- a/test/e2e/version_test.go +++ b/test/e2e/version_test.go @@ -1,5 +1,3 @@ -// +build !remoteclient - package integration import ( diff --git a/version/version.go b/version/version.go index ea5a92286..24daf707c 100644 --- a/version/version.go +++ b/version/version.go @@ -5,3 +5,8 @@ package version // of the top-level README.md file when this is // bumped. const Version = "1.0.1-dev" + +// RemoteAPIVersion 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 |