Merge pull request #4132 from jszczepkowski/master

Improve "constraint violation" error message.
This commit is contained in:
Tim Hockin
2015-02-05 13:43:29 -08:00
4 changed files with 25 additions and 16 deletions

View File

@@ -214,8 +214,8 @@ func (r *Registry) assignPod(ctx api.Context, podID string, machine string) erro
err = r.AtomicUpdate(contKey, &api.BoundPods{}, func(in runtime.Object) (runtime.Object, error) {
boundPodList := in.(*api.BoundPods)
boundPodList.Items = append(boundPodList.Items, *boundPod)
if !constraint.Allowed(boundPodList.Items) {
return nil, fmt.Errorf("the assignment would cause a constraint violation")
if errors := constraint.Allowed(boundPodList.Items); len(errors) > 0 {
return nil, fmt.Errorf("the assignment would cause the following constraints violation: %v", errors)
}
return boundPodList, nil
})