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 /cmd/podman | |
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
Diffstat (limited to 'cmd/podman')
-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 |
5 files changed, 26 insertions, 14 deletions
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 } |