Skip to content

Commit

Permalink
Make weaveutil container-addrs observe $PROCFS
Browse files Browse the repository at this point in the history
  • Loading branch information
awh committed Feb 9, 2016
1 parent 1bb1108 commit ac1dc31
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions prog/weaveutil/addrs.go
Expand Up @@ -4,22 +4,27 @@ import (
"fmt"
"github.com/fsouza/go-dockerclient"
"github.com/weaveworks/weave/common"
"os"
)

func containerAddrs(args []string) error {
if len(args) < 2 {
cmdUsage("container-addrs", "<procPath> <bridgeName> [containerID ...]")
cmdUsage("container-addrs", "<bridgeName> [containerID ...]")
}

procPath := args[0]
bridgeName := args[1]
procPath := os.Getenv("PROCFS")
if procPath == "" {
procPath = "/proc"
}

bridgeName := args[0]

c, err := docker.NewVersionedClientFromEnv("1.18")
if err != nil {
return err
}

for _, containerID := range args[2:] {
for _, containerID := range args[1:] {
netDevs, err := getNetDevs(procPath, bridgeName, c, containerID)
if err != nil {
if _, ok := err.(*docker.NoSuchContainer); ok {
Expand Down
2 changes: 1 addition & 1 deletion weave
Expand Up @@ -1024,7 +1024,7 @@ with_container_addresses() {
COMMAND=$1
shift 1

util_op container-addrs $PROCFS $BRIDGE "$@" | while read CONTAINER_ID CONTAINER_MAC CONTAINER_IPS; do
util_op container-addrs $BRIDGE "$@" | while read CONTAINER_ID CONTAINER_MAC CONTAINER_IPS; do
$COMMAND "$CONTAINER_ID" "$CONTAINER_MAC" "$CONTAINER_IPS"
done
}
Expand Down

0 comments on commit ac1dc31

Please sign in to comment.