Merge branch 'master' into net

This commit is contained in:
Fabrizio Steiner 2017-01-24 21:24:40 +01:00 committed by GitHub
commit db473821f6
15 changed files with 329 additions and 105 deletions

View file

@ -165,10 +165,9 @@ func (client dockerClient) StartContainer(c Container) error {
}
func (client dockerClient) RenameContainer(c Container, newName string) error {
bg := context.Background()
log.Debugf("Renaming container %s (%s) to %s", c.Name(), c.ID(), newName)
//return client.api.ContainerRename(c.ID(), newName)
// no op
return nil
return client.api.ContainerRename(bg, c.ID(), newName)
}
func (client dockerClient) IsContainerStale(c Container) (bool, error) {

View file

@ -3,8 +3,8 @@ package mockclient
import (
"time"
"github.com/CenturyLinkLabs/watchtower/container"
"github.com/stretchr/testify/mock"
"github.com/v2tec/watchtower/container"
)
type MockClient struct {

View file

@ -4,7 +4,7 @@ import (
"reflect"
"testing"
"github.com/CenturyLinkLabs/watchtower/container"
"github.com/v2tec/watchtower/container"
)
func TestMockInterface(t *testing.T) {

View file

@ -2,6 +2,9 @@ package container
import (
"errors"
"os"
"strings"
log "github.com/Sirupsen/logrus"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/reference"
@ -9,8 +12,6 @@ import (
"github.com/docker/docker/cliconfig"
"github.com/docker/docker/cliconfig/configfile"
"github.com/docker/docker/cliconfig/credentials"
"os"
"strings"
)
/**
@ -80,14 +81,13 @@ func ParseServerAddress(ref string) (string, error) {
}
parts := strings.Split(repository, "/")
return parts[0], nil
}
// CredentialsStore returns a new credentials store based
// on the settings provided in the configuration file.
func CredentialsStore(configFile configfile.ConfigFile) credentials.Store {
if configFile.CredentialsStore != "" {
return credentials.NewNativeStore(&configFile)
return credentials.NewNativeStore(&configFile, configFile.CredentialsStore)
}
return credentials.NewFileStore(&configFile)
}