Remove forked reference package. Use normalized named values everywhere and familiar functions to convert back to familiar strings for UX and storage compatibility. Enforce that the source repository in the distribution metadata is always a normalized string, ignore invalid values which are not. Update distribution tests to use normalized values. Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan) Upstream-commit: 3a1279393faf78632bf169619d407e584da84b66 Component: engine
42 lines
1007 B
Go
42 lines
1007 B
Go
package daemon
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/docker/docker/api/errors"
|
|
)
|
|
|
|
func (d *Daemon) imageNotExistToErrcode(err error) error {
|
|
if dne, isDNE := err.(ErrImageDoesNotExist); isDNE {
|
|
return errors.NewRequestNotFoundError(dne)
|
|
}
|
|
return err
|
|
}
|
|
|
|
type errNotRunning struct {
|
|
containerID string
|
|
}
|
|
|
|
func (e errNotRunning) Error() string {
|
|
return fmt.Sprintf("Container %s is not running", e.containerID)
|
|
}
|
|
|
|
func (e errNotRunning) ContainerIsRunning() bool {
|
|
return false
|
|
}
|
|
|
|
func errContainerIsRestarting(containerID string) error {
|
|
err := fmt.Errorf("Container %s is restarting, wait until the container is running", containerID)
|
|
return errors.NewRequestConflictError(err)
|
|
}
|
|
|
|
func errExecNotFound(id string) error {
|
|
err := fmt.Errorf("No such exec instance '%s' found in daemon", id)
|
|
return errors.NewRequestNotFoundError(err)
|
|
}
|
|
|
|
func errExecPaused(id string) error {
|
|
err := fmt.Errorf("Container %s is paused, unpause the container before exec", id)
|
|
return errors.NewRequestConflictError(err)
|
|
}
|