Merge pull request #346 from crosbymichael/hook-timeout

Add timeout field to hooks
This commit is contained in:
Mrunal Patel 2016-03-18 10:21:31 -07:00
commit e23fbbb408
2 changed files with 6 additions and 3 deletions

View File

@ -226,6 +226,7 @@ If a hook returns a non-zero exit code, then an error is logged and the remainin
"poststart": [ "poststart": [
{ {
"path": "/usr/bin/notify-start" "path": "/usr/bin/notify-start"
"timeout": 5
} }
], ],
"poststop": [ "poststop": [
@ -239,6 +240,7 @@ If a hook returns a non-zero exit code, then an error is logged and the remainin
`path` is required for a hook. `path` is required for a hook.
`args` and `env` are optional. `args` and `env` are optional.
`timeout` is the number of seconds before aborting the hook.
The semantics are the same as `Path`, `Args` and `Env` in [golang Cmd](https://golang.org/pkg/os/exec/#Cmd). The semantics are the same as `Path`, `Args` and `Env` in [golang Cmd](https://golang.org/pkg/os/exec/#Cmd).
## Annotations ## Annotations

View File

@ -99,6 +99,7 @@ type Hook struct {
Path string `json:"path"` Path string `json:"path"`
Args []string `json:"args,omitempty"` Args []string `json:"args,omitempty"`
Env []string `json:"env,omitempty"` Env []string `json:"env,omitempty"`
Timeout *int `json:"timeout,omitempty"`
} }
// Hooks for container setup and teardown // Hooks for container setup and teardown