Add mac address to weave ps output

This commit is contained in:
Bryan Boreham committed 2014-10-29 11:39:12 +00:00
1 parent aed3fec3e4
commit 52a4fe545e
1 file changed
+6 -6
+6 -6
View File
@@ -262,16 +262,16 @@ detach() {
ip link del $LOCAL_IFNAME type veth
}
# send to stdout any IPv4 addresses configured on the interface 'ethwe', one per line
container_weave_ips() {
ip netns exec $NETNS ip addr show dev ethwe 2>&1 | grep -o 'inet .*' | cut -d ' ' -f 2 || true
container_weave_addrs() {
ip netns exec $NETNS ip addr show dev ethwe
}
weave_ps() {
for CONTAINER_ID in $(docker ps -q) ; do
CONTAINER_IPS=$(with_container_netns $CONTAINER_ID container_weave_ips)
if [ -n "$CONTAINER_IPS" ] ; then
echo $CONTAINER_ID $CONTAINER_IPS
if CONTAINER_ADDRS=$(with_container_netns $CONTAINER_ID container_weave_addrs 2>&1) ; then
CONTAINER_IPS=$(echo "$CONTAINER_ADDRS" | grep -o 'inet .*' | cut -d ' ' -f 2)
CONTAINER_MAC=$(echo "$CONTAINER_ADDRS" | grep -o 'link/ether .*' | cut -d ' ' -f 2)
echo $CONTAINER_ID $CONTAINER_MAC $CONTAINER_IPS
fi
done
}