mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Use logrus everywhere for logging
Fixed #8761 Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
This commit is contained in:
parent
6229a36432
commit
7c62cee51e
61 changed files with 111 additions and 79 deletions
|
@ -22,6 +22,7 @@ import (
|
|||
"text/template"
|
||||
"time"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api"
|
||||
"github.com/docker/docker/dockerversion"
|
||||
"github.com/docker/docker/engine"
|
||||
|
@ -29,7 +30,6 @@ import (
|
|||
"github.com/docker/docker/nat"
|
||||
"github.com/docker/docker/opts"
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/docker/pkg/parsers"
|
||||
"github.com/docker/docker/pkg/parsers/filters"
|
||||
|
|
|
@ -11,9 +11,9 @@ import (
|
|||
"runtime"
|
||||
"strings"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api"
|
||||
"github.com/docker/docker/dockerversion"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
"github.com/docker/docker/pkg/promise"
|
||||
"github.com/docker/docker/pkg/stdcopy"
|
||||
"github.com/docker/docker/pkg/term"
|
||||
|
|
|
@ -16,10 +16,10 @@ import (
|
|||
"strings"
|
||||
"syscall"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api"
|
||||
"github.com/docker/docker/dockerversion"
|
||||
"github.com/docker/docker/engine"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
"github.com/docker/docker/pkg/stdcopy"
|
||||
"github.com/docker/docker/pkg/term"
|
||||
"github.com/docker/docker/registry"
|
||||
|
|
|
@ -5,8 +5,8 @@ import (
|
|||
"mime"
|
||||
"strings"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/engine"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
"github.com/docker/docker/pkg/parsers"
|
||||
"github.com/docker/docker/pkg/version"
|
||||
)
|
||||
|
|
|
@ -23,10 +23,10 @@ import (
|
|||
"github.com/docker/libcontainer/user"
|
||||
"github.com/gorilla/mux"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api"
|
||||
"github.com/docker/docker/engine"
|
||||
"github.com/docker/docker/pkg/listenbuffer"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
"github.com/docker/docker/pkg/parsers"
|
||||
"github.com/docker/docker/pkg/stdcopy"
|
||||
"github.com/docker/docker/pkg/systemd"
|
||||
|
|
|
@ -14,8 +14,8 @@ import (
|
|||
"regexp"
|
||||
"strings"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/nat"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/docker/runconfig"
|
||||
)
|
||||
|
|
|
@ -27,10 +27,10 @@ import (
|
|||
"path"
|
||||
"strings"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/builder/parser"
|
||||
"github.com/docker/docker/daemon"
|
||||
"github.com/docker/docker/engine"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
"github.com/docker/docker/pkg/tarsum"
|
||||
"github.com/docker/docker/registry"
|
||||
"github.com/docker/docker/runconfig"
|
||||
|
|
|
@ -18,11 +18,11 @@ import (
|
|||
"syscall"
|
||||
"time"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/builder/parser"
|
||||
"github.com/docker/docker/daemon"
|
||||
imagepkg "github.com/docker/docker/image"
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
"github.com/docker/docker/pkg/parsers"
|
||||
"github.com/docker/docker/pkg/symlink"
|
||||
"github.com/docker/docker/pkg/system"
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"github.com/docker/docker/engine"
|
||||
"github.com/docker/docker/pkg/ioutils"
|
||||
"github.com/docker/docker/pkg/jsonlog"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/pkg/promise"
|
||||
"github.com/docker/docker/utils"
|
||||
)
|
||||
|
|
|
@ -25,7 +25,7 @@ import (
|
|||
"github.com/docker/docker/pkg/archive"
|
||||
"github.com/docker/docker/pkg/broadcastwriter"
|
||||
"github.com/docker/docker/pkg/ioutils"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/pkg/networkfs/etchosts"
|
||||
"github.com/docker/docker/pkg/networkfs/resolvconf"
|
||||
"github.com/docker/docker/pkg/promise"
|
||||
|
|
|
@ -14,6 +14,7 @@ import (
|
|||
|
||||
"github.com/docker/libcontainer/label"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/daemon/execdriver"
|
||||
"github.com/docker/docker/daemon/execdriver/execdrivers"
|
||||
"github.com/docker/docker/daemon/execdriver/lxc"
|
||||
|
@ -29,7 +30,6 @@ import (
|
|||
"github.com/docker/docker/pkg/broadcastwriter"
|
||||
"github.com/docker/docker/pkg/graphdb"
|
||||
"github.com/docker/docker/pkg/ioutils"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
"github.com/docker/docker/pkg/namesgenerator"
|
||||
"github.com/docker/docker/pkg/parsers"
|
||||
"github.com/docker/docker/pkg/parsers/kernel"
|
||||
|
@ -304,7 +304,7 @@ func (daemon *Daemon) restore() error {
|
|||
)
|
||||
|
||||
if !debug {
|
||||
log.Infof("Loading containers: ")
|
||||
log.Infof("Loading containers: start.")
|
||||
}
|
||||
dir, err := ioutil.ReadDir(daemon.repository)
|
||||
if err != nil {
|
||||
|
@ -392,7 +392,8 @@ func (daemon *Daemon) restore() error {
|
|||
}
|
||||
|
||||
if !debug {
|
||||
log.Infof(": done.")
|
||||
fmt.Println()
|
||||
log.Infof("Loading containers: done.")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"github.com/docker/docker/daemon/graphdriver"
|
||||
"github.com/docker/docker/daemon/graphdriver/aufs"
|
||||
"github.com/docker/docker/graph"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
)
|
||||
|
||||
// Given the graphdriver ad, if it is aufs, then migrate it.
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"path"
|
||||
|
||||
"github.com/docker/docker/engine"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
)
|
||||
|
||||
func (daemon *Daemon) ContainerRm(job *engine.Job) engine.Status {
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
"github.com/docker/docker/engine"
|
||||
"github.com/docker/docker/pkg/broadcastwriter"
|
||||
"github.com/docker/docker/pkg/ioutils"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/pkg/promise"
|
||||
"github.com/docker/docker/runconfig"
|
||||
"github.com/docker/docker/utils"
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
"github.com/kr/pty"
|
||||
|
||||
"github.com/docker/docker/daemon/execdriver"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/pkg/term"
|
||||
"github.com/docker/docker/utils"
|
||||
"github.com/docker/libcontainer/cgroups"
|
||||
|
|
|
@ -32,7 +32,7 @@ import (
|
|||
|
||||
"github.com/docker/docker/daemon/graphdriver"
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
mountpk "github.com/docker/docker/pkg/mount"
|
||||
"github.com/docker/docker/utils"
|
||||
"github.com/docker/libcontainer/label"
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"os/exec"
|
||||
"syscall"
|
||||
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
)
|
||||
|
||||
func Unmount(target string) error {
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"os"
|
||||
"syscall"
|
||||
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
)
|
||||
|
||||
func stringToLoopName(src string) [LoNameSize]uint8 {
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/docker/docker/daemon/graphdriver"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/pkg/parsers"
|
||||
"github.com/docker/docker/pkg/units"
|
||||
"github.com/docker/libcontainer/label"
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"runtime"
|
||||
"syscall"
|
||||
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
)
|
||||
|
||||
type DevmapperLogger interface {
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"path"
|
||||
|
||||
"github.com/docker/docker/daemon/graphdriver"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/pkg/mount"
|
||||
"github.com/docker/docker/pkg/units"
|
||||
)
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
"github.com/docker/docker/pkg/ioutils"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/utils"
|
||||
)
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
"github.com/docker/docker/dockerversion"
|
||||
"github.com/docker/docker/engine"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/pkg/parsers/kernel"
|
||||
"github.com/docker/docker/pkg/parsers/operatingsystem"
|
||||
"github.com/docker/docker/registry"
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
|
||||
"github.com/docker/docker/engine"
|
||||
"github.com/docker/docker/pkg/jsonlog"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/pkg/tailfile"
|
||||
"github.com/docker/docker/pkg/timeutils"
|
||||
)
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/docker/docker/daemon/execdriver"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/runconfig"
|
||||
)
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
"github.com/docker/docker/daemon/networkdriver/portmapper"
|
||||
"github.com/docker/docker/engine"
|
||||
"github.com/docker/docker/pkg/iptables"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/pkg/networkfs/resolvconf"
|
||||
"github.com/docker/docker/pkg/parsers/kernel"
|
||||
"github.com/docker/libcontainer/netlink"
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/docker/docker/daemon/networkdriver/portallocator"
|
||||
"github.com/docker/docker/pkg/iptables"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
)
|
||||
|
||||
type mapping struct {
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
|
||||
"github.com/docker/docker/daemon/execdriver"
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/pkg/symlink"
|
||||
"github.com/docker/docker/volumes"
|
||||
)
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/builder"
|
||||
"github.com/docker/docker/builtins"
|
||||
"github.com/docker/docker/daemon"
|
||||
|
@ -10,7 +11,6 @@ import (
|
|||
_ "github.com/docker/docker/daemon/execdriver/native"
|
||||
"github.com/docker/docker/dockerversion"
|
||||
"github.com/docker/docker/engine"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/docker/pkg/signal"
|
||||
)
|
||||
|
|
|
@ -28,6 +28,7 @@ func main() {
|
|||
if reexec.Init() {
|
||||
return
|
||||
}
|
||||
|
||||
flag.Parse()
|
||||
// FIXME: validate daemon flags here
|
||||
|
||||
|
@ -39,6 +40,8 @@ func main() {
|
|||
os.Setenv("DEBUG", "1")
|
||||
}
|
||||
|
||||
initLogging(*flDebug)
|
||||
|
||||
if len(flHosts) == 0 {
|
||||
defaultHost := os.Getenv("DOCKER_HOST")
|
||||
if defaultHost == "" || *flDaemon {
|
||||
|
|
16
docker/log.go
Normal file
16
docker/log.go
Normal file
|
@ -0,0 +1,16 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
)
|
||||
|
||||
func initLogging(debug bool) {
|
||||
log.SetOutput(os.Stderr)
|
||||
if debug {
|
||||
log.SetLevel(log.DebugLevel)
|
||||
} else {
|
||||
log.SetLevel(log.InfoLevel)
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
"github.com/docker/docker/engine"
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/pkg/parsers"
|
||||
)
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import (
|
|||
"github.com/docker/docker/dockerversion"
|
||||
"github.com/docker/docker/image"
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/pkg/truncindex"
|
||||
"github.com/docker/docker/runconfig"
|
||||
"github.com/docker/docker/utils"
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"github.com/docker/docker/engine"
|
||||
"github.com/docker/docker/image"
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
)
|
||||
|
||||
// Loads a set of images into the repository. This is the complementary of ImageExport.
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
|
||||
"github.com/docker/docker/engine"
|
||||
"github.com/docker/docker/image"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/registry"
|
||||
"github.com/docker/docker/utils"
|
||||
"github.com/docker/libtrust"
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
"github.com/docker/docker/engine"
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/registry"
|
||||
"github.com/docker/docker/utils"
|
||||
)
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
"github.com/docker/docker/engine"
|
||||
"github.com/docker/docker/image"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
)
|
||||
|
||||
func (s *TagStore) Install(eng *engine.Engine) error {
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/docker/docker/pkg/archive"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/runconfig"
|
||||
"github.com/docker/docker/utils"
|
||||
)
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
|
||||
"github.com/docker/docker/api/client"
|
||||
"github.com/docker/docker/daemon"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/pkg/term"
|
||||
"github.com/docker/docker/utils"
|
||||
"github.com/docker/libtrust"
|
||||
|
|
|
@ -21,7 +21,7 @@ import (
|
|||
"github.com/docker/docker/image"
|
||||
"github.com/docker/docker/nat"
|
||||
"github.com/docker/docker/pkg/ioutils"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/reexec"
|
||||
"github.com/docker/docker/runconfig"
|
||||
"github.com/docker/docker/utils"
|
||||
|
|
|
@ -18,20 +18,23 @@ import (
|
|||
"github.com/docker/docker/builtins"
|
||||
"github.com/docker/docker/daemon"
|
||||
"github.com/docker/docker/engine"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
flag "github.com/docker/docker/pkg/mflag"
|
||||
"github.com/docker/docker/pkg/sysinfo"
|
||||
"github.com/docker/docker/runconfig"
|
||||
"github.com/docker/docker/utils"
|
||||
)
|
||||
|
||||
type Fataler interface {
|
||||
Fatal(...interface{})
|
||||
}
|
||||
|
||||
// This file contains utility functions for docker's unit test suite.
|
||||
// It has to be named XXX_test.go, apparently, in other to access private functions
|
||||
// from other XXX_test.go functions.
|
||||
|
||||
// Create a temporary daemon suitable for unit testing.
|
||||
// Call t.Fatal() at the first error.
|
||||
func mkDaemon(f log.Fataler) *daemon.Daemon {
|
||||
func mkDaemon(f Fataler) *daemon.Daemon {
|
||||
eng := newTestEngine(f, false, "")
|
||||
return mkDaemonFromEngine(eng, f)
|
||||
// FIXME:
|
||||
|
@ -40,7 +43,7 @@ func mkDaemon(f log.Fataler) *daemon.Daemon {
|
|||
// [...]
|
||||
}
|
||||
|
||||
func createNamedTestContainer(eng *engine.Engine, config *runconfig.Config, f log.Fataler, name string) (shortId string) {
|
||||
func createNamedTestContainer(eng *engine.Engine, config *runconfig.Config, f Fataler, name string) (shortId string) {
|
||||
job := eng.Job("create", name)
|
||||
if err := job.ImportEnv(config); err != nil {
|
||||
f.Fatal(err)
|
||||
|
@ -53,23 +56,23 @@ func createNamedTestContainer(eng *engine.Engine, config *runconfig.Config, f lo
|
|||
return engine.Tail(outputBuffer, 1)
|
||||
}
|
||||
|
||||
func createTestContainer(eng *engine.Engine, config *runconfig.Config, f log.Fataler) (shortId string) {
|
||||
func createTestContainer(eng *engine.Engine, config *runconfig.Config, f Fataler) (shortId string) {
|
||||
return createNamedTestContainer(eng, config, f, "")
|
||||
}
|
||||
|
||||
func startContainer(eng *engine.Engine, id string, t log.Fataler) {
|
||||
func startContainer(eng *engine.Engine, id string, t Fataler) {
|
||||
job := eng.Job("start", id)
|
||||
if err := job.Run(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func containerRun(eng *engine.Engine, id string, t log.Fataler) {
|
||||
func containerRun(eng *engine.Engine, id string, t Fataler) {
|
||||
startContainer(eng, id, t)
|
||||
containerWait(eng, id, t)
|
||||
}
|
||||
|
||||
func containerFileExists(eng *engine.Engine, id, dir string, t log.Fataler) bool {
|
||||
func containerFileExists(eng *engine.Engine, id, dir string, t Fataler) bool {
|
||||
c := getContainer(eng, id, t)
|
||||
if err := c.Mount(); err != nil {
|
||||
t.Fatal(err)
|
||||
|
@ -84,7 +87,7 @@ func containerFileExists(eng *engine.Engine, id, dir string, t log.Fataler) bool
|
|||
return true
|
||||
}
|
||||
|
||||
func containerAttach(eng *engine.Engine, id string, t log.Fataler) (io.WriteCloser, io.ReadCloser) {
|
||||
func containerAttach(eng *engine.Engine, id string, t Fataler) (io.WriteCloser, io.ReadCloser) {
|
||||
c := getContainer(eng, id, t)
|
||||
i, err := c.StdinPipe()
|
||||
if err != nil {
|
||||
|
@ -97,31 +100,31 @@ func containerAttach(eng *engine.Engine, id string, t log.Fataler) (io.WriteClos
|
|||
return i, o
|
||||
}
|
||||
|
||||
func containerWait(eng *engine.Engine, id string, t log.Fataler) int {
|
||||
func containerWait(eng *engine.Engine, id string, t Fataler) int {
|
||||
ex, _ := getContainer(eng, id, t).WaitStop(-1 * time.Second)
|
||||
return ex
|
||||
}
|
||||
|
||||
func containerWaitTimeout(eng *engine.Engine, id string, t log.Fataler) error {
|
||||
func containerWaitTimeout(eng *engine.Engine, id string, t Fataler) error {
|
||||
_, err := getContainer(eng, id, t).WaitStop(500 * time.Millisecond)
|
||||
return err
|
||||
}
|
||||
|
||||
func containerKill(eng *engine.Engine, id string, t log.Fataler) {
|
||||
func containerKill(eng *engine.Engine, id string, t Fataler) {
|
||||
if err := eng.Job("kill", id).Run(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func containerRunning(eng *engine.Engine, id string, t log.Fataler) bool {
|
||||
func containerRunning(eng *engine.Engine, id string, t Fataler) bool {
|
||||
return getContainer(eng, id, t).IsRunning()
|
||||
}
|
||||
|
||||
func containerAssertExists(eng *engine.Engine, id string, t log.Fataler) {
|
||||
func containerAssertExists(eng *engine.Engine, id string, t Fataler) {
|
||||
getContainer(eng, id, t)
|
||||
}
|
||||
|
||||
func containerAssertNotExists(eng *engine.Engine, id string, t log.Fataler) {
|
||||
func containerAssertNotExists(eng *engine.Engine, id string, t Fataler) {
|
||||
daemon := mkDaemonFromEngine(eng, t)
|
||||
if c := daemon.Get(id); c != nil {
|
||||
t.Fatal(fmt.Errorf("Container %s should not exist", id))
|
||||
|
@ -130,7 +133,7 @@ func containerAssertNotExists(eng *engine.Engine, id string, t log.Fataler) {
|
|||
|
||||
// assertHttpNotError expect the given response to not have an error.
|
||||
// Otherwise the it causes the test to fail.
|
||||
func assertHttpNotError(r *httptest.ResponseRecorder, t log.Fataler) {
|
||||
func assertHttpNotError(r *httptest.ResponseRecorder, t Fataler) {
|
||||
// Non-error http status are [200, 400)
|
||||
if r.Code < http.StatusOK || r.Code >= http.StatusBadRequest {
|
||||
t.Fatal(fmt.Errorf("Unexpected http error: %v", r.Code))
|
||||
|
@ -139,14 +142,14 @@ func assertHttpNotError(r *httptest.ResponseRecorder, t log.Fataler) {
|
|||
|
||||
// assertHttpError expect the given response to have an error.
|
||||
// Otherwise the it causes the test to fail.
|
||||
func assertHttpError(r *httptest.ResponseRecorder, t log.Fataler) {
|
||||
func assertHttpError(r *httptest.ResponseRecorder, t Fataler) {
|
||||
// Non-error http status are [200, 400)
|
||||
if !(r.Code < http.StatusOK || r.Code >= http.StatusBadRequest) {
|
||||
t.Fatal(fmt.Errorf("Unexpected http success code: %v", r.Code))
|
||||
}
|
||||
}
|
||||
|
||||
func getContainer(eng *engine.Engine, id string, t log.Fataler) *daemon.Container {
|
||||
func getContainer(eng *engine.Engine, id string, t Fataler) *daemon.Container {
|
||||
daemon := mkDaemonFromEngine(eng, t)
|
||||
c := daemon.Get(id)
|
||||
if c == nil {
|
||||
|
@ -155,7 +158,7 @@ func getContainer(eng *engine.Engine, id string, t log.Fataler) *daemon.Containe
|
|||
return c
|
||||
}
|
||||
|
||||
func mkDaemonFromEngine(eng *engine.Engine, t log.Fataler) *daemon.Daemon {
|
||||
func mkDaemonFromEngine(eng *engine.Engine, t Fataler) *daemon.Daemon {
|
||||
iDaemon := eng.Hack_GetGlobalVar("httpapi.daemon")
|
||||
if iDaemon == nil {
|
||||
panic("Legacy daemon field not set in engine")
|
||||
|
@ -167,7 +170,7 @@ func mkDaemonFromEngine(eng *engine.Engine, t log.Fataler) *daemon.Daemon {
|
|||
return daemon
|
||||
}
|
||||
|
||||
func newTestEngine(t log.Fataler, autorestart bool, root string) *engine.Engine {
|
||||
func newTestEngine(t Fataler, autorestart bool, root string) *engine.Engine {
|
||||
if root == "" {
|
||||
if dir, err := newTestDirectory(unitTestStoreBase); err != nil {
|
||||
t.Fatal(err)
|
||||
|
@ -200,7 +203,7 @@ func newTestEngine(t log.Fataler, autorestart bool, root string) *engine.Engine
|
|||
return eng
|
||||
}
|
||||
|
||||
func NewTestEngine(t log.Fataler) *engine.Engine {
|
||||
func NewTestEngine(t Fataler) *engine.Engine {
|
||||
return newTestEngine(t, false, "")
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import (
|
|||
"github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar"
|
||||
|
||||
"github.com/docker/docker/pkg/fileutils"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/pkg/pools"
|
||||
"github.com/docker/docker/pkg/promise"
|
||||
"github.com/docker/docker/pkg/system"
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
|
||||
"github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar"
|
||||
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/pkg/pools"
|
||||
"github.com/docker/docker/pkg/system"
|
||||
)
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/docker/docker/pkg/jsonlog"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
)
|
||||
|
||||
// BroadcastWriter accumulate multiple io.WriteCloser by stream.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package fileutils
|
||||
|
||||
import (
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
)
|
||||
|
||||
type resumableRequestReader struct {
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
)
|
||||
|
||||
type Action string
|
||||
|
|
|
@ -8,9 +8,18 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/pkg/timeutils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
log.SetOutput(os.Stderr)
|
||||
log.SetLevel(log.InfoLevel)
|
||||
if os.Getenv("DEBUG") != "" {
|
||||
log.SetLevel(log.DebugLevel)
|
||||
}
|
||||
}
|
||||
|
||||
type priority int
|
||||
|
||||
const (
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"sync/atomic"
|
||||
"syscall"
|
||||
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
)
|
||||
|
||||
// Trap sets up a simplified signal "trap", appropriate for common
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"errors"
|
||||
"io"
|
||||
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
|
||||
"github.com/docker/docker/vendor/src/code.google.com/p/go/src/pkg/archive/tar"
|
||||
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
)
|
||||
|
||||
// scans string for api version in the URL path. returns the trimmed hostname, if version found, string and API version.
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
|
||||
"github.com/gorilla/mux"
|
||||
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -18,7 +18,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/docker/docker/pkg/httputils"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/pkg/tarsum"
|
||||
"github.com/docker/docker/utils"
|
||||
)
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"net/url"
|
||||
"strconv"
|
||||
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/utils"
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/docker/docker/nat"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
)
|
||||
|
||||
func Merge(userConf, imageConf *Config) error {
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/docker/docker/engine"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/libtrust"
|
||||
)
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/libtrust/trustgraph"
|
||||
)
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
)
|
||||
|
||||
// VersionInfo is used to model entities which has a version.
|
||||
|
|
|
@ -23,7 +23,7 @@ import (
|
|||
"github.com/docker/docker/dockerversion"
|
||||
"github.com/docker/docker/pkg/fileutils"
|
||||
"github.com/docker/docker/pkg/ioutils"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
)
|
||||
|
||||
type KeyValuePair struct {
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"sync"
|
||||
|
||||
"github.com/docker/docker/daemon/graphdriver"
|
||||
"github.com/docker/docker/pkg/log"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/utils"
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue