Merge pull request #5690 from satnam6502/failputnover

Give better error message for PUTs with no resource version
This commit is contained in:
Brian Grant
2015-03-27 07:12:56 -07:00
4 changed files with 58 additions and 26 deletions

View File

@@ -232,6 +232,11 @@ func ValidateObjectMetaUpdate(old, meta *api.ObjectMeta) errs.ValidationErrorLis
meta.CreationTimestamp = old.CreationTimestamp
}
// Reject updates that don't specify a resource version
if meta.ResourceVersion == "" {
allErrs = append(allErrs, errs.NewFieldInvalid("resourceVersion", meta.ResourceVersion, "resourceVersion must be specified for an update"))
}
if old.Name != meta.Name {
allErrs = append(allErrs, errs.NewFieldInvalid("name", meta.Name, "field is immutable"))
}