Added index address into APIInfo.

This commit is contained in:
Nan Monnand Deng 2013-07-22 14:42:31 -04:00
parent 4179f25286
commit 303490168f
3 changed files with 28 additions and 24 deletions

View file

@ -17,16 +17,17 @@ type APIImages struct {
} }
type APIInfo struct { type APIInfo struct {
Debug bool Debug bool
Containers int Containers int
Images int Images int
NFd int `json:",omitempty"` NFd int `json:",omitempty"`
NGoroutines int `json:",omitempty"` NGoroutines int `json:",omitempty"`
MemoryLimit bool `json:",omitempty"` MemoryLimit bool `json:",omitempty"`
SwapLimit bool `json:",omitempty"` SwapLimit bool `json:",omitempty"`
LXCVersion string `json:",omitempty"` LXCVersion string `json:",omitempty"`
NEventsListener int `json:",omitempty"` NEventsListener int `json:",omitempty"`
KernelVersion string `json:",omitempty"` KernelVersion string `json:",omitempty"`
IndexServerAddress string `json:",omitempty"`
} }
type APITop struct { type APITop struct {

View file

@ -495,10 +495,12 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
fmt.Fprintf(cli.out, "EventsListeners: %d\n", out.NEventsListener) fmt.Fprintf(cli.out, "EventsListeners: %d\n", out.NEventsListener)
fmt.Fprintf(cli.out, "Kernel Version: %s\n", out.KernelVersion) fmt.Fprintf(cli.out, "Kernel Version: %s\n", out.KernelVersion)
} }
if cli.authConfig != nil { if len(out.IndexServerAddress) != 0 {
fmt.Fprintf(cli.out, "Username: %v\n", cli.authConfig.Username) u := cli.configFile.Configs[out.IndexServerAddress].Username
// XXX Should we print registry address even if the user was not logged in? if len(u) > 0 {
fmt.Fprintf(cli.out, "Registry: %v\n", auth.IndexServerAddress()) fmt.Fprintf(cli.out, "Username: %v\n", u)
fmt.Fprintf(cli.out, "Registry: %v\n", out.IndexServerAddress)
}
} }
if !out.MemoryLimit { if !out.MemoryLimit {
fmt.Fprintf(cli.err, "WARNING: No memory limit support\n") fmt.Fprintf(cli.err, "WARNING: No memory limit support\n")

View file

@ -265,16 +265,17 @@ func (srv *Server) DockerInfo() *APIInfo {
} }
return &APIInfo{ return &APIInfo{
Containers: len(srv.runtime.List()), Containers: len(srv.runtime.List()),
Images: imgcount, Images: imgcount,
MemoryLimit: srv.runtime.capabilities.MemoryLimit, MemoryLimit: srv.runtime.capabilities.MemoryLimit,
SwapLimit: srv.runtime.capabilities.SwapLimit, SwapLimit: srv.runtime.capabilities.SwapLimit,
Debug: os.Getenv("DEBUG") != "", Debug: os.Getenv("DEBUG") != "",
NFd: utils.GetTotalUsedFds(), NFd: utils.GetTotalUsedFds(),
NGoroutines: runtime.NumGoroutine(), NGoroutines: runtime.NumGoroutine(),
LXCVersion: lxcVersion, LXCVersion: lxcVersion,
NEventsListener: len(srv.events), NEventsListener: len(srv.events),
KernelVersion: kernelVersion, KernelVersion: kernelVersion,
IndexServerAddress: auth.IndexServerAddress(),
} }
} }