Make experimental a runtime flag

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
Upstream-commit: 7781a1bf0fef748877326632b88e92fbf3c90daa
Component: engine
This commit is contained in:
Kenfe-Mickael Laventure
2016-10-06 07:09:54 -07:00
parent c42c998198
commit 9a299b360f
112 changed files with 782 additions and 979 deletions

View File

@ -19,6 +19,7 @@ import (
dopts "github.com/docker/docker/opts"
"github.com/docker/go-connections/sockets"
"github.com/docker/go-connections/tlsconfig"
"golang.org/x/net/context"
)
// Streams is an interface which exposes the standard input and output streams
@ -31,12 +32,27 @@ type Streams interface {
// DockerCli represents the docker command line client.
// Instances of the client can be returned from NewDockerCli.
type DockerCli struct {
configFile *configfile.ConfigFile
in *InStream
out *OutStream
err io.Writer
keyFile string
client client.APIClient
configFile *configfile.ConfigFile
in *InStream
out *OutStream
err io.Writer
keyFile string
client client.APIClient
hasExperimental *bool
}
// HasExperimental returns true if experimental features are accessible
func (cli *DockerCli) HasExperimental() bool {
if cli.hasExperimental == nil {
if cli.client == nil {
cli.Initialize(cliflags.NewClientOptions())
}
enabled := false
cli.hasExperimental = &enabled
enabled, _ = cli.client.Ping(context.Background())
}
return *cli.hasExperimental
}
// Client returns the APIClient