abord build if mergeConfig returns an error and fix duplicate error message
This commit is contained in:
parent
a81393787f
commit
5bd0437eed
3
api.go
3
api.go
|
@ -892,8 +892,7 @@ func postBuild(srv *Server, version float64, w http.ResponseWriter, r *http.Requ
|
||||||
b := NewBuildFile(srv, utils.NewWriteFlusher(w), !suppressOutput, !noCache, rm)
|
b := NewBuildFile(srv, utils.NewWriteFlusher(w), !suppressOutput, !noCache, rm)
|
||||||
id, err := b.Build(context)
|
id, err := b.Build(context)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(w, "Error build: %s\n", err)
|
return fmt.Errorf("Error build: %s", err)
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
if repoName != "" {
|
if repoName != "" {
|
||||||
srv.runtime.repositories.Set(repoName, tag, id, false)
|
srv.runtime.repositories.Set(repoName, tag, id, false)
|
||||||
|
|
|
@ -282,7 +282,9 @@ func (runtime *Runtime) Create(config *Config) (*Container, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if img.Config != nil {
|
if img.Config != nil {
|
||||||
MergeConfig(config, img.Config)
|
if err := MergeConfig(config, img.Config); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(config.Entrypoint) != 0 && config.Cmd == nil {
|
if len(config.Entrypoint) != 0 && config.Cmd == nil {
|
||||||
|
|
8
utils.go
8
utils.go
|
@ -65,7 +65,7 @@ func CompareConfig(a, b *Config) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func MergeConfig(userConf, imageConf *Config) {
|
func MergeConfig(userConf, imageConf *Config) error {
|
||||||
if userConf.User == "" {
|
if userConf.User == "" {
|
||||||
userConf.User = imageConf.User
|
userConf.User = imageConf.User
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,10 @@ func MergeConfig(userConf, imageConf *Config) {
|
||||||
found := false
|
found := false
|
||||||
imageNat, _ := parseNat(imagePortSpec)
|
imageNat, _ := parseNat(imagePortSpec)
|
||||||
for _, userPortSpec := range userConf.PortSpecs {
|
for _, userPortSpec := range userConf.PortSpecs {
|
||||||
userNat, _ := parseNat(userPortSpec)
|
userNat, err := parseNat(userPortSpec)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if imageNat.Proto == userNat.Proto && imageNat.Backend == userNat.Backend {
|
if imageNat.Proto == userNat.Proto && imageNat.Backend == userNat.Backend {
|
||||||
found = true
|
found = true
|
||||||
}
|
}
|
||||||
|
@ -146,6 +149,7 @@ func MergeConfig(userConf, imageConf *Config) {
|
||||||
userConf.Volumes[k] = v
|
userConf.Volumes[k] = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseLxcConfOpts(opts ListOpts) ([]KeyValuePair, error) {
|
func parseLxcConfOpts(opts ListOpts) ([]KeyValuePair, error) {
|
||||||
|
|
Loading…
Reference in New Issue