Skip to content

Commit

Permalink
Revert "compatible with new docker api"
Browse files Browse the repository at this point in the history
This reverts commit f74fff9.
  • Loading branch information
CMGS committed Jul 25, 2017
1 parent 5bc135e commit 5096c18
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ deps:
go get -u -v -d github.com/coreos/etcd
go get -u -v -d github.com/docker/docker/api/types || echo oops
go get -u -v -d github.com/docker/docker/api/types/container
go get -u -v -d golang.org/x/sys/unix
go get -u -v -d github.com/opencontainers/image-spec/specs-go/v1
go get -u -v -d github.com/opencontainers/go-digest
rm -rf $GOPATH/src/github.com/docker/docker/vendor
rm -rf $GOPATH/src/github.com/docker/distribution/vendor

build:
go build -ldflags "$(GO_LDFLAGS)" -a -tags netgo -installsuffix netgo -o eru-core
Expand Down
13 changes: 3 additions & 10 deletions cluster/calcium/run_and_wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

log "github.com/Sirupsen/logrus"
enginetypes "github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"gitlab.ricebook.net/platform/core/types"
"gitlab.ricebook.net/platform/core/utils"
"golang.org/x/net/context"
Expand Down Expand Up @@ -123,17 +122,11 @@ func (c *calcium) RunAndWait(specs types.Specs, opts *types.DeployOptions, stdin

// 超时的情况下根本不会到这里
// 不超时的情况下这里肯定会立即返回
statusBodyChan, errChan := node.Engine.ContainerWait(
context.Background(), containerID, container.WaitConditionNotRunning)

var exitData []byte
select {
case err := <-errChan:
code, err := node.Engine.ContainerWait(context.Background(), containerID)
exitData := []byte(fmt.Sprintf("[exitcode] %d", code))
if err != nil {
log.Errorf("[RunAndWait] %s run failed, %v", containerID[:12], err)
exitData = []byte(fmt.Sprintf("[exitcode] unknown %v", err))
case statusBody := <-statusBodyChan:
code := statusBody.StatusCode
exitData = []byte(fmt.Sprintf("[exitcode] %d", code))
}
ch <- &types.RunAndWaitMessage{ContainerID: containerID, Data: exitData}
}(node, message.ContainerID)
Expand Down

0 comments on commit 5096c18

Please sign in to comment.