Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check restore Phase before downloading logs #496

Merged
merged 1 commit into from
May 17, 2018
Merged

Conversation

nrb
Copy link
Contributor

@nrb nrb commented May 16, 2018

Fixes #477

Signed-off-by: Nolan Brubaker [email protected]

@nrb nrb added the Bug label May 16, 2018
@nrb nrb requested review from ncdc and skriss May 16, 2018 19:50
@nrb
Copy link
Contributor Author

nrb commented May 16, 2018

Is this a reasonable fix? I added the logic to the Validate function based on my interpretation of the godoc.

return err
}
if r.Status.Phase != v1.RestorePhaseCompleted {
err = errors.Errorf("Restore %s is not yet complete.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say "unable to retrieve logs because restore is not yet complete." I don't think we need to include the name of the restore.

@ncdc
Copy link
Contributor

ncdc commented May 16, 2018

@nrb yes, this is reasonable, thanks.

@nrb nrb force-pushed the fix-477 branch 2 times, most recently from db214fe to 257262f Compare May 16, 2018 20:38
return err
}
if r.Status.Phase != v1.RestorePhaseCompleted {
err = errors.Errorf("unable to retrieve logs because restore is not complete")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

errors.New(...) since it's not a format string, and I'd probably just return the error here and change L93 to a return nil.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to returning here

I'm almost always in favor of Errorf 100% of the time even if there aren't format strings - saves you the time of having to replace New with Errorf if you do decide you need formatted vars

Copy link
Contributor

@skriss skriss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@ncdc
Copy link
Contributor

ncdc commented May 17, 2018

LGTM

@ncdc ncdc added this to the v0.9.0 milestone May 17, 2018
@ncdc ncdc merged commit 3a746a3 into vmware-tanzu:master May 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants