Ver código fonte

Merge pull request #1093 from monnand/910-login-info

* Runtime: fixed #910. print user name to docker info output
Guillaume J. Charmes 12 anos atrás
pai
commit
65a4e30825
3 arquivos alterados com 30 adições e 20 exclusões
  1. 11 10
      api_params.go
  2. 8 0
      commands.go
  3. 11 10
      server.go

+ 11 - 10
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 {

+ 8 - 0
commands.go

@@ -496,6 +496,14 @@ 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 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")
 	}

+ 11 - 10
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(),
 	}
 }