Merge pull request #26378 from pwittrock/fix-26138

Automatic merge from submit-queue

Retry concurrency exceptions in e2e/kubectl.go.  Fixes #26138





[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()
This commit is contained in:
k8s-merge-robot
2016-05-27 02:21:21 -07:00
2 changed files with 23 additions and 2 deletions

View File

@@ -122,6 +122,8 @@ type Store struct {
Storage storage.Interface
}
const OptimisticLockErrorMsg = "the object has been modified; please apply your changes to the latest version and try again"
// NamespaceKeyRootFunc is the default function for constructing storage paths to resource directories enforcing namespace rules.
func NamespaceKeyRootFunc(ctx api.Context, prefix string) string {
key := prefix
@@ -364,7 +366,7 @@ func (e *Store) Update(ctx api.Context, name string, objInfo rest.UpdatedObjectI
return nil, nil, kubeerr.NewInvalid(qualifiedKind, name, fieldErrList)
}
if newVersion != version {
return nil, nil, kubeerr.NewConflict(e.QualifiedResource, name, fmt.Errorf("the object has been modified; please apply your changes to the latest version and try again"))
return nil, nil, kubeerr.NewConflict(e.QualifiedResource, name, fmt.Errorf(OptimisticLockErrorMsg))
}
}
if err := rest.BeforeUpdate(e.UpdateStrategy, ctx, obj, existing); err != nil {