1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Add debug to iptables

This commit is contained in:
Guillaume J. Charmes 2013-11-06 07:37:43 -08:00
parent ff8a4ba0aa
commit 00f1398f7a
No known key found for this signature in database
GPG key ID: B33E4642CB6E3FF3

View file

@ -4,6 +4,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"net" "net"
"os"
"os/exec" "os/exec"
"strconv" "strconv"
"strings" "strings"
@ -122,10 +123,12 @@ func Raw(args ...string) ([]byte, error) {
if err != nil { if err != nil {
return nil, ErrIptablesNotFound return nil, ErrIptablesNotFound
} }
if os.Getenv("DEBUG") != "" {
fmt.Printf("[DEBUG] [iptables]: %s, %v\n", path, args)
}
output, err := exec.Command(path, args...).CombinedOutput() output, err := exec.Command(path, args...).CombinedOutput()
if err != nil { if err != nil {
return nil, fmt.Errorf("iptables failed: iptables %v: %s (%s)", strings.Join(args, " "), output, err) return nil, fmt.Errorf("iptables failed: iptables %v: %s (%s)", strings.Join(args, " "), output, err)
} }
return output, err return output, err
} }