Merge pull request #2814 from weaveworks/weaveutil-allids

Fetch list of container IDs inside weaveutil
This commit is contained in:
Marc Carré authored and GitHub committed 2017-04-12 11:35:37 +01:00
commit 19a31a5b82
2 files changed
+27 -12

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 {