diff options
author | baude <bbaude@redhat.com> | 2019-01-21 15:18:13 -0600 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2019-01-21 15:23:30 -0600 |
commit | 5c8e7ed0dee117c9d423849f09f82d15957893a8 (patch) | |
tree | f5244f8cabf513a409a69b72f2c97d0d0e5d996c /cmd | |
parent | ba3509665c16365870ae2c50c6798c0e8489cb78 (diff) | |
download | podman-5c8e7ed0dee117c9d423849f09f82d15957893a8.tar.gz podman-5c8e7ed0dee117c9d423849f09f82d15957893a8.tar.bz2 podman-5c8e7ed0dee117c9d423849f09f82d15957893a8.zip |
enable podman-remote version
initial enablement of podman-remote version. includes add a APIVersion const
that will allow us to check compatibility between host/client when connections
are made.
also added client related information to podman info.
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'cmd')
-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 } |