1
0
mirror of https://github.com/rancher/os.git synced 2025-09-12 21:23:13 +00:00

Move around code for better clarity

This commit is contained in:
Darren Shepherd
2018-09-15 21:55:26 -07:00
committed by niusmallnan
parent 2f50b7b178
commit 1f50386828
112 changed files with 992 additions and 859 deletions

29
pkg/docker/client.go Normal file
View File

@@ -0,0 +1,29 @@
package docker
import (
dockerClient "github.com/docker/engine-api/client"
"github.com/rancher/os/config"
"golang.org/x/net/context"
)
func NewSystemClient() (dockerClient.APIClient, error) {
return NewClient(config.SystemDockerHost)
}
func NewDefaultClient() (dockerClient.APIClient, error) {
return NewClient(config.DockerHost)
}
func NewClient(endpoint string) (dockerClient.APIClient, error) {
client, err := dockerClient.NewClient(endpoint, "", nil, nil)
if err != nil {
return nil, err
}
err = ClientOK(endpoint, func() bool {
_, err := client.Info(context.Background())
return err == nil
})
return client, err
}