Skip to content

Commit

Permalink
Remove TryPatch methods (#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
tamalsaha authored Dec 26, 2017
1 parent 7706452 commit 2677c1d
Show file tree
Hide file tree
Showing 21 changed files with 114 additions and 401 deletions.
21 changes: 0 additions & 21 deletions client/typed/stash/v1alpha1/util/recovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,6 @@ func PatchRecovery(c cs.StashV1alpha1Interface, cur *api.Recovery, transform fun
return out, kutil.VerbPatched, err
}

func TryPatchRecovery(c cs.StashV1alpha1Interface, meta metav1.ObjectMeta, transform func(*api.Recovery) *api.Recovery) (result *api.Recovery, err error) {
attempt := 0
err = wait.PollImmediate(kutil.RetryInterval, kutil.RetryTimeout, func() (bool, error) {
attempt++
cur, e2 := c.Recoveries(meta.Namespace).Get(meta.Name, metav1.GetOptions{})
if kerr.IsNotFound(e2) {
return false, e2
} else if e2 == nil {
result, _, e2 = PatchRecovery(c, cur, transform)
return e2 == nil, nil
}
glog.Errorf("Attempt %d failed to patch Recovery %s/%s due to %v.", attempt, cur.Namespace, cur.Name, e2)
return false, nil
})

if err != nil {
err = fmt.Errorf("failed to patch Recovery %s/%s after %d attempts due to %v", meta.Namespace, meta.Name, attempt, err)
}
return
}

func TryUpdateRecovery(c cs.StashV1alpha1Interface, meta metav1.ObjectMeta, transform func(*api.Recovery) *api.Recovery) (result *api.Recovery, err error) {
attempt := 0
err = wait.PollImmediate(kutil.RetryInterval, kutil.RetryTimeout, func() (bool, error) {
Expand Down
21 changes: 0 additions & 21 deletions client/typed/stash/v1alpha1/util/restic.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,27 +56,6 @@ func PatchRestic(c cs.StashV1alpha1Interface, cur *api.Restic, transform func(*a
return out, kutil.VerbPatched, err
}

func TryPatchRestic(c cs.StashV1alpha1Interface, meta metav1.ObjectMeta, transform func(*api.Restic) *api.Restic) (result *api.Restic, err error) {
attempt := 0
err = wait.PollImmediate(kutil.RetryInterval, kutil.RetryTimeout, func() (bool, error) {
attempt++
cur, e2 := c.Restics(meta.Namespace).Get(meta.Name, metav1.GetOptions{})
if kerr.IsNotFound(e2) {
return false, e2
} else if e2 == nil {
result, _, e2 = PatchRestic(c, cur, transform)
return e2 == nil, nil
}
glog.Errorf("Attempt %d failed to patch Restic %s/%s due to %v.", attempt, cur.Namespace, cur.Name, e2)
return false, nil
})

if err != nil {
err = fmt.Errorf("failed to patch Restic %s/%s after %d attempts due to %v", meta.Namespace, meta.Name, attempt, err)
}
return
}

func TryUpdateRestic(c cs.StashV1alpha1Interface, meta metav1.ObjectMeta, transform func(*api.Restic) *api.Restic) (result *api.Restic, err error) {
attempt := 0
err = wait.PollImmediate(kutil.RetryInterval, kutil.RetryTimeout, func() (bool, error) {
Expand Down
4 changes: 2 additions & 2 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 0 additions & 21 deletions vendor/github.com/appscode/kutil/apps/v1beta1/deployment.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 29 additions & 21 deletions vendor/github.com/appscode/kutil/apps/v1beta1/statefulset.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 0 additions & 21 deletions vendor/github.com/appscode/kutil/batch/v1beta1/cronjob.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 0 additions & 21 deletions vendor/github.com/appscode/kutil/core/v1/configmap.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 0 additions & 21 deletions vendor/github.com/appscode/kutil/core/v1/node.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 55 additions & 21 deletions vendor/github.com/appscode/kutil/core/v1/pod.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 0 additions & 21 deletions vendor/github.com/appscode/kutil/core/v1/rc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2677c1d

Please sign in to comment.