diff options
| author | Sebastiaan van Stijn <github@gone.nl> | 2021-08-21 00:23:26 +0200 |
|---|---|---|
| committer | Sebastiaan van Stijn <github@gone.nl> | 2022-04-20 21:29:30 +0200 |
| commit | 90de570cfa5f6de0b02bdf2e794627fbf5b0dfc8 (patch) | |
| tree | 4363e2f976693304624d14b644a53320d84c2e96 /api/server | |
| parent | 952902efbcea04a619c4d8c763eecf7fbfeecd85 (diff) | |
| download | docker-90de570cfa5f6de0b02bdf2e794627fbf5b0dfc8.tar.gz | |
backend: add StopOptions to ContainerRestart and ContainerStop
While we're modifying the interface, also add a context to both.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Diffstat (limited to 'api/server')
| -rw-r--r-- | api/server/router/container/backend.go | 4 | ||||
| -rw-r--r-- | api/server/router/container/container_routes.go | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/api/server/router/container/backend.go b/api/server/router/container/backend.go index 75ea1d82b7..564ccd8c99 100644 --- a/api/server/router/container/backend.go +++ b/api/server/router/container/backend.go @@ -37,10 +37,10 @@ type stateBackend interface { ContainerPause(name string) error ContainerRename(oldName, newName string) error ContainerResize(name string, height, width int) error - ContainerRestart(name string, seconds *int) error + ContainerRestart(ctx context.Context, name string, options container.StopOptions) error ContainerRm(name string, config *types.ContainerRmConfig) error ContainerStart(name string, hostConfig *container.HostConfig, checkpoint string, checkpointDir string) error - ContainerStop(name string, seconds *int) error + ContainerStop(ctx context.Context, name string, options container.StopOptions) error ContainerUnpause(name string) error ContainerUpdate(name string, hostConfig *container.HostConfig) (container.ContainerUpdateOKBody, error) ContainerWait(ctx context.Context, name string, condition containerpkg.WaitCondition) (<-chan containerpkg.StateStatus, error) diff --git a/api/server/router/container/container_routes.go b/api/server/router/container/container_routes.go index 392efc023e..ebb2f7b4d5 100644 --- a/api/server/router/container/container_routes.go +++ b/api/server/router/container/container_routes.go @@ -221,16 +221,16 @@ func (s *containerRouter) postContainersStop(ctx context.Context, w http.Respons return err } - var seconds *int + var options container.StopOptions if tmpSeconds := r.Form.Get("t"); tmpSeconds != "" { valSeconds, err := strconv.Atoi(tmpSeconds) if err != nil { return err } - seconds = &valSeconds + options.Timeout = &valSeconds } - if err := s.backend.ContainerStop(vars["name"], seconds); err != nil { + if err := s.backend.ContainerStop(ctx, vars["name"], options); err != nil { return err } w.WriteHeader(http.StatusNoContent) @@ -278,16 +278,16 @@ func (s *containerRouter) postContainersRestart(ctx context.Context, w http.Resp return err } - var seconds *int + var options container.StopOptions if tmpSeconds := r.Form.Get("t"); tmpSeconds != "" { valSeconds, err := strconv.Atoi(tmpSeconds) if err != nil { return err } - seconds = &valSeconds + options.Timeout = &valSeconds } - if err := s.backend.ContainerRestart(vars["name"], seconds); err != nil { + if err := s.backend.ContainerRestart(ctx, vars["name"], options); err != nil { return err } |
