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

Fix last op endpoint unbind response #765

Merged
merged 1 commit into from
Feb 21, 2018
Merged

Fix last op endpoint unbind response #765

merged 1 commit into from
Feb 21, 2018

Conversation

philipgough
Copy link
Contributor

@philipgough philipgough commented Feb 15, 2018

Ready for review

Changes proposed in this pull request

  • If job already in progress return correct status code to handler
  • Wrap clean up of unbind process in function, which can be called from async job or broker

Which issue this PR fixes (This will close that issue when PR gets merged)
fixes #709

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 15, 2018
@shawn-hurley shawn-hurley self-requested a review February 15, 2018 17:19
@openshift-bot openshift-bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Feb 19, 2018
return nil, false, err
err = cleanupUnbind(&bindInstance, &serviceInstance, a.dao, true)
} else {
err = cleanupUnbind(&bindInstance, &serviceInstance, a.dao, false)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that we should remove the if else and just call cleanupUnbind and pass in the bind creds to cleanupUnbind and do the nil check in that method. I think that might be more clear what that is doing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah sounds good to me.

@shawn-hurley shawn-hurley added needs-review 3.10 | release-1.2 Kubernetes 1.10 | Openshift 3.10 | Broker release-1.2 and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Feb 20, 2018
@shawn-hurley shawn-hurley changed the title WIP: Fix last op endpoint unbind response Fix last op endpoint unbind response Feb 20, 2018
}
if jobInProgress {
log.Infof("Unbind requested for instance %s, but job is already in progress", instance.ID)
return &UnbindResponse{Operation: jobToken}, false, ErrorDeprovisionInProgress
Copy link
Member

Choose a reason for hiding this comment

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

If I'm reading it correctly, I think the handler needs to be augmented to understand this error and make sure it results in the correct response.

There's also a potentially difficult question to answer, which is: we know there is a job running, but is it executing asynchronously? If yes, the response should be a 202. If not, I don't think the spec is very clear. Maybe the best response in that case would be 400. Here is what the proposed spec changes say:

https://github.com/mattmcneeney/servicebroker/blob/f9f7be4b03972a32814de2784060a975a47f8cd2/spec.md#response-6

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Ive added logic to the handler to check the error but I think returing 202 regardless of async or not is appropriate since the job in running and it will force the client to poll last op endpoint for the result. This meets the spec 202 MUST be returned if the unbinding is in progress. which in this case it is.

This logic is also used for the deprovision handler

@eriknelson
Copy link
Contributor

Is this considered complete and ready for review / merge? The PR message still states it's not ready, I might have missed something though.

@philipgough
Copy link
Contributor Author

@eriknelson ready for review yes, dont think its ready for merge yet

@eriknelson eriknelson merged commit ab00c18 into openshift:master Feb 21, 2018
@philipgough philipgough deleted the fix-709 branch February 21, 2018 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.10 | release-1.2 Kubernetes 1.10 | Openshift 3.10 | Broker release-1.2 needs-review size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

unbind last_operation response always responds with 410 Gone
7 participants