always add but hide experimental cmds and flags
Signed-off-by: Victor Vieux <vieux@docker.com> update cobra and use Tags Signed-off-by: Victor Vieux <vieux@docker.com> allow client to talk to an older server Signed-off-by: Victor Vieux <vieux@docker.com>
This commit is contained in:
@@ -1,19 +1,30 @@
|
||||
package client
|
||||
|
||||
import "golang.org/x/net/context"
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
// Ping pings the server and return the value of the "Docker-Experimental" header
|
||||
func (cli *Client) Ping(ctx context.Context) (bool, error) {
|
||||
serverResp, err := cli.get(ctx, "/_ping", nil, nil)
|
||||
"github.com/docker/docker/api/types"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// Ping pings the server and return the value of the "Docker-Experimental" & "API-Version" headers
|
||||
func (cli *Client) Ping(ctx context.Context) (types.Ping, error) {
|
||||
var ping types.Ping
|
||||
req, err := cli.buildRequest("GET", fmt.Sprintf("%s/_ping", cli.basePath), nil, nil)
|
||||
if err != nil {
|
||||
return false, err
|
||||
return ping, err
|
||||
}
|
||||
serverResp, err := cli.doRequest(ctx, req)
|
||||
if err != nil {
|
||||
return ping, err
|
||||
}
|
||||
defer ensureReaderClosed(serverResp)
|
||||
|
||||
exp := serverResp.header.Get("Docker-Experimental")
|
||||
if exp != "true" {
|
||||
return false, nil
|
||||
ping.APIVersion = serverResp.header.Get("API-Version")
|
||||
|
||||
if serverResp.header.Get("Docker-Experimental") == "true" {
|
||||
ping.Experimental = true
|
||||
}
|
||||
|
||||
return true, nil
|
||||
return ping, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user