From 303490168fb53af2528375ca9ec818c7a179a044 Mon Sep 17 00:00:00 2001 From: Nan Monnand Deng Date: Mon, 22 Jul 2013 14:42:31 -0400 Subject: [PATCH] Added index address into APIInfo. --- api_params.go | 21 +++++++++++---------- commands.go | 10 ++++++---- server.go | 21 +++++++++++---------- 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/api_params.go b/api_params.go index 1ae26072e7..ca4c5503ec 100644 --- a/api_params.go +++ b/api_params.go @@ -17,16 +17,17 @@ type APIImages struct { } type APIInfo struct { - Debug bool - Containers int - Images int - NFd int `json:",omitempty"` - NGoroutines int `json:",omitempty"` - MemoryLimit bool `json:",omitempty"` - SwapLimit bool `json:",omitempty"` - LXCVersion string `json:",omitempty"` - NEventsListener int `json:",omitempty"` - KernelVersion string `json:",omitempty"` + Debug bool + Containers int + Images int + NFd int `json:",omitempty"` + NGoroutines int `json:",omitempty"` + MemoryLimit bool `json:",omitempty"` + SwapLimit bool `json:",omitempty"` + LXCVersion string `json:",omitempty"` + NEventsListener int `json:",omitempty"` + KernelVersion string `json:",omitempty"` + IndexServerAddress string `json:",omitempty"` } type APITop struct { diff --git a/commands.go b/commands.go index 9c59857ae1..167d33ce1d 100644 --- a/commands.go +++ b/commands.go @@ -495,10 +495,12 @@ func (cli *DockerCli) CmdInfo(args ...string) error { fmt.Fprintf(cli.out, "EventsListeners: %d\n", out.NEventsListener) fmt.Fprintf(cli.out, "Kernel Version: %s\n", out.KernelVersion) } - if cli.authConfig != nil { - fmt.Fprintf(cli.out, "Username: %v\n", cli.authConfig.Username) - // XXX Should we print registry address even if the user was not logged in? - fmt.Fprintf(cli.out, "Registry: %v\n", auth.IndexServerAddress()) + if len(out.IndexServerAddress) != 0 { + u := cli.configFile.Configs[out.IndexServerAddress].Username + if len(u) > 0 { + fmt.Fprintf(cli.out, "Username: %v\n", u) + fmt.Fprintf(cli.out, "Registry: %v\n", out.IndexServerAddress) + } } if !out.MemoryLimit { fmt.Fprintf(cli.err, "WARNING: No memory limit support\n") diff --git a/server.go b/server.go index 7607851f49..85e0c255cd 100644 --- a/server.go +++ b/server.go @@ -265,16 +265,17 @@ func (srv *Server) DockerInfo() *APIInfo { } return &APIInfo{ - Containers: len(srv.runtime.List()), - Images: imgcount, - MemoryLimit: srv.runtime.capabilities.MemoryLimit, - SwapLimit: srv.runtime.capabilities.SwapLimit, - Debug: os.Getenv("DEBUG") != "", - NFd: utils.GetTotalUsedFds(), - NGoroutines: runtime.NumGoroutine(), - LXCVersion: lxcVersion, - NEventsListener: len(srv.events), - KernelVersion: kernelVersion, + Containers: len(srv.runtime.List()), + Images: imgcount, + MemoryLimit: srv.runtime.capabilities.MemoryLimit, + SwapLimit: srv.runtime.capabilities.SwapLimit, + Debug: os.Getenv("DEBUG") != "", + NFd: utils.GetTotalUsedFds(), + NGoroutines: runtime.NumGoroutine(), + LXCVersion: lxcVersion, + NEventsListener: len(srv.events), + KernelVersion: kernelVersion, + IndexServerAddress: auth.IndexServerAddress(), } }