Skip to content

Commit 84f2c7c

Browse files
committed
deis fixed bugs
1 parent d96d9bb commit 84f2c7c

2 files changed

Lines changed: 21 additions & 6 deletions

File tree

cmd/cmd.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ package cmd
22

33
import (
44
"fmt"
5-
"github.com/deis/deis/tests/dockercli"
65
"github.com/deis/deisctl/client"
7-
"github.com/deis/deisctl/updatectl"
6+
"github.com/deis/deisctl/utils"
87
"regexp"
98
"strconv"
109
"strings"
@@ -16,9 +15,9 @@ func List(c client.Client) error {
1615
}
1716

1817
func PullImage(service string) error {
19-
Dockercli, _, _ := dockercli.GetNewClient()
18+
dockercli, _, _ := utils.GetNewClient()
2019
fmt.Println("pulling image :" + strings.Split(service, ".")[0])
21-
err := cli.CmdPull(strings.Split(service, ".")[0])
20+
err := utils.CmdPull(dockercli, strings.Split(service, ".")[0])
2221
if err != nil {
2322
return err
2423
}

utils/utils.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import (
66
_ "bufio"
77
"bytes"
88
"fmt"
9+
"github.com/docker/docker/api/client"
10+
"github.com/satori/go.uuid"
911
"io"
1012
"io/ioutil"
1113
"net"
@@ -16,8 +18,6 @@ import (
1618
"syscall"
1719
"testing"
1820
"time"
19-
20-
"github.com/satori/go.uuid"
2121
)
2222

2323
// NewUuid returns a new V4-style unique identifier.
@@ -27,6 +27,22 @@ func NewUuid() string {
2727
return strings.Split(s1, "-")[0]
2828
}
2929

30+
func GetNewClient() (
31+
cli *client.DockerCli, stdout *io.PipeReader, stdoutPipe *io.PipeWriter) {
32+
testDaemonAddr := "/var/run/docker.sock"
33+
testDaemonProto := "unix"
34+
stdout, stdoutPipe = io.Pipe()
35+
cli = client.NewDockerCli(
36+
nil, stdoutPipe, nil, testDaemonProto, testDaemonAddr, nil)
37+
return
38+
}
39+
40+
func PullImage(cli *client.DockerCli, args ...string) error {
41+
fmt.Println("pulling image :" + args[0])
42+
err := cli.CmdPull(args...)
43+
return err
44+
}
45+
3046
func GetServices() []string {
3147
service := []string{
3248
"deis-builder.service",

0 commit comments

Comments
 (0)