Merge pull request #63 from calavera/revert_pull_behavior

Revert "Moving Pull Behavior into engine-api to support docker pr#16609"
This commit is contained in:
David Calavera 2016-01-25 13:04:11 -08:00
Родитель 57dd6a77ab f3d1cee74f
Коммит bdbab71ec2
3 изменённых файлов: 5 добавлений и 44 удалений

Просмотреть файл

@ -68,11 +68,14 @@ func imageBuildOptionsToQuery(options types.ImageBuildOptions) (url.Values, erro
query.Set("forcerm", "1")
}
if options.PullParent {
query.Set("pull", "1")
}
if !container.IsolationLevel.IsDefault(options.IsolationLevel) {
query.Set("isolation", string(options.IsolationLevel))
}
query.Set("pull", options.PullParent.String())
query.Set("cpusetcpus", options.CPUSetCPUs)
query.Set("cpusetmems", options.CPUSetMems)
query.Set("cpushares", strconv.FormatInt(options.CPUShares, 10))

Просмотреть файл

@ -7,7 +7,6 @@ import (
"github.com/docker/engine-api/types/container"
"github.com/docker/engine-api/types/filters"
"github.com/docker/engine-api/types/image"
"github.com/docker/go-units"
)
@ -127,7 +126,7 @@ type ImageBuildOptions struct {
NoCache bool
Remove bool
ForceRemove bool
PullParent image.PullBehavior
PullParent bool
IsolationLevel container.IsolationLevel
CPUSetCPUs string
CPUSetMems string

Просмотреть файл

@ -1,41 +0,0 @@
package image
import (
"fmt"
)
// PullBehavior can be one of: never, always, or missing
type PullBehavior int
// PullBehavior can be one of: never, always, or missing
const (
PullNever PullBehavior = iota
PullAlways
PullMissing
)
// ParsePullBehavior validates and converts a string into a PullBehavior
func ParsePullBehavior(pullVal string) (PullBehavior, error) {
switch pullVal {
case "never":
return PullNever, nil
case "always":
return PullAlways, nil
case "missing", "":
return PullMissing, nil
}
return PullNever, fmt.Errorf("Invalid pull behavior '%s'", pullVal)
}
// String returns a string representation of a PullBehavior
func (p PullBehavior) String() string {
switch p {
case PullNever:
return "never"
case PullAlways:
return "always"
case PullMissing:
return "missing"
}
return ""
}