updating github.com/mistifyio/go-zfs to v2.1.1+incompatible

This commit is contained in:
Davanum Srinivas
2019-06-14 11:14:12 -04:00
parent a7c552be86
commit 68e3e2eb5c
6 changed files with 12 additions and 24 deletions

View File

@@ -11,7 +11,6 @@ go_library(
importmap = "k8s.io/kubernetes/vendor/github.com/mistifyio/go-zfs",
importpath = "github.com/mistifyio/go-zfs",
visibility = ["//visibility:public"],
deps = ["//vendor/github.com/pborman/uuid:go_default_library"],
)
filegroup(

View File

@@ -8,8 +8,6 @@ import (
"regexp"
"strconv"
"strings"
"github.com/pborman/uuid"
)
type command struct {
@@ -36,17 +34,16 @@ func (c *command) Run(arg ...string) ([][]string, error) {
}
cmd.Stderr = &stderr
id := uuid.New()
joinedArgs := strings.Join(cmd.Args, " ")
logger.Log([]string{"ID:" + id, "START", joinedArgs})
debug := strings.Join([]string{cmd.Path, strings.Join(cmd.Args, " ")}, " ")
if logger != nil {
logger.Log(cmd.Args)
}
err := cmd.Run()
logger.Log([]string{"ID:" + id, "FINISH"})
if err != nil {
return nil, &Error{
Err: err,
Debug: strings.Join([]string{cmd.Path, joinedArgs}, " "),
Debug: debug,
Stderr: stderr.String(),
}
}

View File

@@ -92,20 +92,12 @@ type Logger interface {
Log(cmd []string)
}
type defaultLogger struct{}
func (*defaultLogger) Log(cmd []string) {
return
}
var logger Logger = &defaultLogger{}
var logger Logger
// SetLogger set a log handler to log all commands including arguments before
// they are executed
func SetLogger(l Logger) {
if l != nil {
logger = l
}
logger = l
}
// zfs is a helper function to wrap typical calls to zfs.