Merge pull request #734 from vmarmol/validate2

Add managed containers to debug output
This commit is contained in:
Rohit Jnagal 2015-05-21 16:54:43 -06:00
commit a96f2f9325

View File

@ -1136,5 +1136,36 @@ func (m *manager) DockerInfo() (DockerStatus, error) {
}
func (m *manager) DebugInfo() map[string][]string {
return container.DebugInfo()
debugInfo := container.DebugInfo()
// Get unique containers.
var conts map[*containerData]struct{}
func() {
m.containersLock.RLock()
defer m.containersLock.RUnlock()
conts = make(map[*containerData]struct{}, len(m.containers))
for _, c := range m.containers {
conts[c] = struct{}{}
}
}()
// List containers.
lines := make([]string, 0, len(conts))
for cont := range conts {
lines = append(lines, cont.info.Name)
if cont.info.Namespace != "" {
lines = append(lines, fmt.Sprintf("\tNamespace: %s", cont.info.Namespace))
}
if len(cont.info.Aliases) != 0 {
lines = append(lines, "\tAliases:")
for _, alias := range cont.info.Aliases {
lines = append(lines, fmt.Sprintf("\t\t%s", alias))
}
}
}
debugInfo["Managed containers"] = lines
return debugInfo
}