Files
moby/vendor/github.com/docker/swarmkit/agent/exec/errors.go
Yong Tang ec860ca252 Update SwarmKit to 6bc357e9c5f0ac2cdf801898a43d08c260b4d5d0
This fix tries to update the SwarmKit from
ed384f3b3957f65e3111bd020f9815f3d4296fa2
to
6bc357e9c5f0ac2cdf801898a43d08c260b4d5d0

The following is the list of docker related changes:
1. Took long time for Docker Swarm service turn desired state from Ready to Running (Issue #28291)
2. Native Swarm in 1.12 - panic: runtime error: index out of range (Issue #25608)
3. Global mode target replicas keep increasing (Issue #30854)
4. Creating service with publish mode=host and without published port crashes swarm manager (Issue #30938)
5. Define signals used to stop containers for updates (Issue #25696) (PR #30754)

This fix fixes #28291, #25608, #30854, #30938.
This fix is required by PR #30754.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2017-02-16 08:50:00 -08:00

83 lines
2.3 KiB
Go

package exec
import "github.com/pkg/errors"
var (
// ErrRuntimeUnsupported encountered when a task requires a runtime
// unsupported by the executor.
ErrRuntimeUnsupported = errors.New("exec: unsupported runtime")
// ErrTaskPrepared is called if the task is already prepared.
ErrTaskPrepared = errors.New("exec: task already prepared")
// ErrTaskStarted can be returned from any operation that cannot be
// performed because the task has already been started. This does not imply
// that the task is running but rather that it is no longer valid to call
// Start.
ErrTaskStarted = errors.New("exec: task already started")
// ErrTaskUpdateRejected is returned if a task update is rejected by a controller.
ErrTaskUpdateRejected = errors.New("exec: task update rejected")
// ErrControllerClosed returned when a task controller has been closed.
ErrControllerClosed = errors.New("exec: controller closed")
// ErrTaskRetry is returned by Do when an operation failed by should be
// retried. The status should still be reported in this case.
ErrTaskRetry = errors.New("exec: task retry")
// ErrTaskNoop returns when the a subsequent call to Do will not result in
// advancing the task. Callers should avoid calling Do until the task has been updated.
ErrTaskNoop = errors.New("exec: task noop")
)
// ExitCoder is implemented by errors that have an exit code.
type ExitCoder interface {
// ExitCode returns the exit code.
ExitCode() int
}
// Temporary indicates whether or not the error condition is temporary.
//
// If this is encountered in the controller, the failing operation will be
// retried when this returns true. Otherwise, the operation is considered
// fatal.
type Temporary interface {
Temporary() bool
}
// MakeTemporary makes the error temporary.
func MakeTemporary(err error) error {
if IsTemporary(err) {
return err
}
return temporary{err}
}
type temporary struct {
error
}
func (t temporary) Cause() error { return t.error }
func (t temporary) Temporary() bool { return true }
// IsTemporary returns true if the error or a recursive cause returns true for
// temporary.
func IsTemporary(err error) bool {
for err != nil {
if tmp, ok := err.(Temporary); ok && tmp.Temporary() {
return true
}
cause := errors.Cause(err)
if cause == err {
break
}
err = cause
}
return false
}