mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #42717 from thaJeztah/move_defaults
This commit is contained in:
commit
a44a8e54ce
5 changed files with 19 additions and 12 deletions
|
@ -518,7 +518,7 @@ func (container *Container) StopSignal() int {
|
||||||
}
|
}
|
||||||
|
|
||||||
if int(stopSignal) == 0 {
|
if int(stopSignal) == 0 {
|
||||||
stopSignal, _ = signal.ParseSignal(signal.DefaultStopSignal)
|
stopSignal, _ = signal.ParseSignal(defaultStopSignal)
|
||||||
}
|
}
|
||||||
return int(stopSignal)
|
return int(stopSignal)
|
||||||
}
|
}
|
||||||
|
@ -528,7 +528,7 @@ func (container *Container) StopTimeout() int {
|
||||||
if container.Config.StopTimeout != nil {
|
if container.Config.StopTimeout != nil {
|
||||||
return *container.Config.StopTimeout
|
return *container.Config.StopTimeout
|
||||||
}
|
}
|
||||||
return DefaultStopTimeout
|
return defaultStopTimeout
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitDNSHostConfig ensures that the dns fields are never nil.
|
// InitDNSHostConfig ensures that the dns fields are never nil.
|
||||||
|
|
|
@ -19,7 +19,7 @@ func TestContainerStopSignal(t *testing.T) {
|
||||||
Config: &container.Config{},
|
Config: &container.Config{},
|
||||||
}
|
}
|
||||||
|
|
||||||
def, err := signal.ParseSignal(signal.DefaultStopSignal)
|
def, err := signal.ParseSignal(defaultStopSignal)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -44,8 +44,8 @@ func TestContainerStopTimeout(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
s := c.StopTimeout()
|
s := c.StopTimeout()
|
||||||
if s != DefaultStopTimeout {
|
if s != defaultStopTimeout {
|
||||||
t.Fatalf("Expected %v, got %v", DefaultStopTimeout, s)
|
t.Fatalf("Expected %v, got %v", defaultStopTimeout, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
stopTimeout := 15
|
stopTimeout := 15
|
||||||
|
|
|
@ -23,9 +23,12 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// DefaultStopTimeout sets the default time, in seconds, to wait
|
// defaultStopSignal is the default syscall signal used to stop a container.
|
||||||
|
defaultStopSignal = "SIGTERM"
|
||||||
|
|
||||||
|
// defaultStopTimeout sets the default time, in seconds, to wait
|
||||||
// for the graceful container stop before forcefully terminating it.
|
// for the graceful container stop before forcefully terminating it.
|
||||||
DefaultStopTimeout = 10
|
defaultStopTimeout = 10
|
||||||
|
|
||||||
containerConfigMountPath = "/"
|
containerConfigMountPath = "/"
|
||||||
containerSecretMountPath = "/run/secrets"
|
containerSecretMountPath = "/run/secrets"
|
||||||
|
|
|
@ -17,8 +17,11 @@ const (
|
||||||
containerInternalSecretMountPath = `C:\ProgramData\Docker\internal\secrets`
|
containerInternalSecretMountPath = `C:\ProgramData\Docker\internal\secrets`
|
||||||
containerInternalConfigsDirPath = `C:\ProgramData\Docker\internal\configs`
|
containerInternalConfigsDirPath = `C:\ProgramData\Docker\internal\configs`
|
||||||
|
|
||||||
// DefaultStopTimeout is the timeout (in seconds) for the shutdown call on a container
|
// defaultStopSignal is the default syscall signal used to stop a container.
|
||||||
DefaultStopTimeout = 30
|
defaultStopSignal = "SIGTERM"
|
||||||
|
|
||||||
|
// defaultStopTimeout is the timeout (in seconds) for the shutdown call on a container
|
||||||
|
defaultStopTimeout = 30
|
||||||
)
|
)
|
||||||
|
|
||||||
// UnmountIpcMount unmounts Ipc related mounts.
|
// UnmountIpcMount unmounts Ipc related mounts.
|
||||||
|
|
|
@ -48,7 +48,8 @@ const (
|
||||||
// SIGPIPE is a signal sent to a process when a pipe is written to before the other end is open for reading
|
// SIGPIPE is a signal sent to a process when a pipe is written to before the other end is open for reading
|
||||||
// Deprecated: use github.com/moby/sys/signal.SIGPIPE instead
|
// Deprecated: use github.com/moby/sys/signal.SIGPIPE instead
|
||||||
SIGPIPE = msignal.SIGPIPE
|
SIGPIPE = msignal.SIGPIPE
|
||||||
// DefaultStopSignal is the syscall signal used to stop a container in unix systems.
|
|
||||||
// Deprecated: use github.com/moby/sys/signal.DefaultStopSignal instead
|
// DefaultStopSignal has been deprecated and removed. The default value is
|
||||||
DefaultStopSignal = msignal.DefaultStopSignal
|
// now defined in github.com/docker/docker/container. Clients should omit
|
||||||
|
// the container's stop-signal field if the default should be used.
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue