-
Notifications
You must be signed in to change notification settings - Fork 23
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
apisurface only returns InternalServerErrors. #13
Comments
catalog:
last_operation (service instances) and last_operation (service bindings):
provision:
update:
binding:
unbinding:
deprovision:
getserviceinstance:
getbinding:
|
Best to create a test for all of these cases then fix the error conditions. |
I actually worry about this because for |
You control the return code by returning an |
Hrm i though the thing with the erros was better documented - i’ll fix that. Your list of error codes should go ito the godoc on the interface |
Are you saying that the |
I personally think that the library should create semantic meanings for the returns. Pushing the logic of conforming to the spec down to the implementors of the library does not, IMO, provide that value that it could. |
Yes, Provision should return an HTTPStatusCode error for the scenarios you defined. I would be happy to add helper methods to create errors for specific scenarios like |
@pmorie I think a perfect example of where the current model does not work is Provision has 3 success response codes: https://github.com/openservicebrokerapi/servicebroker/blob/v2.13/spec.md#response-2 200 - OK So if I wanted to be spec compliant right now, I would return an HTTPStatusCode Error for 201? But that would return an error response and not the provision response that I would need. The same thing exists for binding. We could add a field to the provision response to handle these scenarios, or have some other type of return to capture these?. This is not about an "internal model" or "prescriptive model" to me it is about being able to use this library to conform to the spec. |
Let me rephrase that last sentence, I agree that this should be simple glue code, I just don't want to have to switch from this to my own to conform to the spec after I get started. |
Nope, you return a response with Async = true and the library sends the right thing. See: https://github.com/pmorie/osb-broker-lib/blob/master/pkg/rest/apisurface.go#L95 |
@shawn-hurley I see what you mean now - I think we should have our own response types that embed the osb client ones but add fields to indicate, for example, that you should respond to a provision request with 201 without having to return an error, example: type ProvisionResponse struct {
osb.ProvisionResponse
AlreadyReceived bool // if true, return 201
} |
Fixed by PR #27 |
Add chart and wire skeleton binary up
apisurface needs to handle a bunch of error conditions from the Brokers and return appropriate OSB spec compliant error codes.
Here are the responses from
handler.go
https://gist.github.com/jmrodri/8336a1c7738c916ed3ea39330821dcbfhttps://github.com/openshift/ansible-service-broker/blob/master/pkg/handler/handler.go
and the corresponding utility file
https://github.com/openshift/ansible-service-broker/blob/master/pkg/handler/io.go
The text was updated successfully, but these errors were encountered: