Fetch list of container IDs inside weaveutil, for 'weave ps'

This commit is contained in:
Bryan Boreham committed 2017-04-12 09:36:21 +00:00
1 parent 5e290aa11f
commit b307b9872a
2 files changed
+18 -3

No files matched your search

+16 -1
View File
@@ -27,10 +27,25 @@ func containerAddrs(args []string) error {
return err
}
containerArgs := []string{}
for _, cid := range args[1:] {
if cid == "weave:allids" { // expand to all container IDs
all, err := client.ListContainers(docker.ListContainersOptions{All: true})
if err != nil {
return err
}
for _, c := range all {
containerArgs = append(containerArgs, c.ID)
}
} else {
containerArgs = append(containerArgs, cid)
}
}
var containerIDs []string
containers := make(map[string]*docker.Container)
for _, cid := range args[1:] {
for _, cid := range containerArgs {
if cid == "weave:expose" {
netDev, err := weavenet.GetBridgeNetDev(bridgeName)
if err != nil {