mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
client: remove API-version compatibility for API < v1.44
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -4,8 +4,6 @@ import (
|
||||
"context"
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
||||
"github.com/moby/moby/api/types/versions"
|
||||
)
|
||||
|
||||
// ContainerRestart stops, and starts a container again.
|
||||
@@ -22,17 +20,7 @@ func (cli *Client) ContainerRestart(ctx context.Context, containerID string, opt
|
||||
query.Set("t", strconv.Itoa(*options.Timeout))
|
||||
}
|
||||
if options.Signal != "" {
|
||||
// Make sure we negotiated (if the client is configured to do so),
|
||||
// as code below contains API-version specific handling of options.
|
||||
//
|
||||
// Normally, version-negotiation (if enabled) would not happen until
|
||||
// the API request is made.
|
||||
if err := cli.checkVersion(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
if versions.GreaterThanOrEqualTo(cli.version, "1.42") {
|
||||
query.Set("signal", options.Signal)
|
||||
}
|
||||
query.Set("signal", options.Signal)
|
||||
}
|
||||
resp, err := cli.post(ctx, "/containers/"+containerID+"/restart", query, nil, nil)
|
||||
defer ensureReaderClosed(resp)
|
||||
|
||||
Reference in New Issue
Block a user