Rework TLS support, remove unsupported options

This commit is contained in:
Ross Cadogan 2016-10-14 11:10:48 +01:00
parent 69db640b98
commit 42fea79860
3 changed files with 43 additions and 148 deletions

View file

@ -2,7 +2,6 @@ package container
import (
"fmt"
"os"
"time"
log "github.com/Sirupsen/logrus"
@ -15,11 +14,6 @@ const (
defaultStopSignal = "SIGTERM"
)
var username = os.Getenv("REPO_USER")
var password = os.Getenv("REPO_PASS")
var email = os.Getenv("REPO_EMAIL")
var api_version = "1.24"
// A Filter is a prototype for a function that can be used to filter the
// results from a call to the ListContainers() method on the Client.
type Filter func(Container) bool
@ -33,13 +27,16 @@ type Client interface {
RenameContainer(Container, string) error
IsContainerStale(Container) (bool, error)
RemoveImage(Container) error
RegistryLogin(string) error
}
// NewClient returns a new Client instance which can be used to interact with
// the Docker API.
func NewClient(dockerHost string, pullImages bool) Client {
cli, err := dockerclient.NewClient(dockerHost, api_version, nil, nil)
// The client reads its configuration from the following environment variables:
// * DOCKER_HOST the docker-engine host to send api requests to
// * DOCKER_TLS_VERIFY whether to verify tls certificates
// * DOCKER_API_VERSION the minimum docker api version to work with
func NewClient(pullImages bool) Client {
cli, err := dockerclient.NewEnvClient()
if err != nil {
log.Fatalf("Error instantiating Docker client: %s", err)
@ -53,11 +50,6 @@ type dockerClient struct {
pullImages bool
}
func (client dockerClient) RegistryLogin(registryURL string) error {
log.Debug("Login not implemented")
return nil
}
func (client dockerClient) ListContainers(fn Filter) ([]Container, error) {
cs := []Container{}
bg := context.Background()