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

ServiceBrokerCreateOperationInProgressException should accept and return operation state #284

Closed
gberche-orange opened this issue May 7, 2020 · 3 comments · Fixed by #299
Milestone

Comments

@gberche-orange
Copy link
Contributor

gberche-orange commented May 7, 2020

Expected behavior

  • As a broker developer
  • In order to comply to OSB API specs
  • I need to return a 202 with an operation state field

/~https://github.com/openservicebrokerapi/servicebroker/blob/master/spec.md#response-3 mentions

Status Code Description
[..]
202 Accepted MUST be returned if the Service Instance provisioning is in progress. The operation string MUST match that returned for the original request. This triggers the Platform to poll the Last Operation for Service Instances endpoint for operation status. Note that a re-sent PUT request MUST return a 202 Accepted, not a 200 OK, if the Service Instance is not yet fully provisioned.

Observed behavior

Currently the operation string does not seem to be returned in the response body in a parseable json string

@ExceptionHandler(ServiceBrokerCreateOperationInProgressException.class)
@ResponseStatus(HttpStatus.ACCEPTED)
public ErrorMessage handleException(ServiceBrokerCreateOperationInProgressException ex) {
return getErrorResponse(ex);
}

As a workaround, don't use ServiceBrokerCreateOperationInProgressException, and directly control status code and response body.

return Mono.just(CreateServiceInstanceResponse.builder()
						.dashboardUrl(dashboard)
						.operation(operation)
						.async(true)
						.instanceExisted(false)
						.build());
@royclarkson
Copy link
Member

Thanks for reporting!

@royclarkson
Copy link
Member

This is part of the OSBAPI 2.15 spec, so will need to be back ported to 3.1.x.

/~https://github.com/openservicebrokerapi/servicebroker/blob/v2.15/spec.md#response-3

@royclarkson
Copy link
Member

There are five scenarios where this applies with three different exception objects:

  • Service instance provisioning via ServiceBrokerCreateOperationInProgressException
  • Service instance updating via ServiceBrokerUpdateOperationInProgressException
  • Service instance deleting via ServiceBrokerDeleteOperationInProgressException
  • Service instance binding via ServiceBrokerCreateOperationInProgressException
  • Service instance unbinding via ServiceBrokerDeleteOperationInProgressException

royclarkson added a commit that referenced this issue Jun 19, 2020
…ogress

This commit updates the ServiceBrokerExceptionHandler to marshal an
OperationInProgressMessage response body instead of an ErrorMessage when
handling any of the following scenarios and exceptions:

Service instance provisioning ServiceBrokerCreateOperationInProgressException
Service instance updating ServiceBrokerUpdateOperationInProgressException
Service instance deleting ServiceBrokerDeleteOperationInProgressException
Service instance binding ServiceBrokerCreateOperationInProgressException
Service instance unbinding ServiceBrokerDeleteOperationInProgressException

See /~https://github.com/openservicebrokerapi/servicebroker/blob/v2.15/spec.md#response-3

Resolves #284
royclarkson added a commit that referenced this issue Jun 19, 2020
This commit updates the ServiceBrokerExceptionHandler to marshal an
OperationInProgressMessage response body instead of an ErrorMessage when
handling any of the following scenarios and exceptions:

Service instance provisioning ServiceBrokerCreateOperationInProgressException
Service instance updating ServiceBrokerUpdateOperationInProgressException
Service instance deleting ServiceBrokerDeleteOperationInProgressException
Service instance binding ServiceBrokerCreateOperationInProgressException
Service instance unbinding ServiceBrokerDeleteOperationInProgressException

See /~https://github.com/openservicebrokerapi/servicebroker/blob/v2.15/spec.md#response-3

Resolves #284
royclarkson added a commit that referenced this issue Jun 22, 2020
This commit updates the ServiceBrokerExceptionHandler to marshal an
OperationInProgressMessage response body instead of an ErrorMessage when
handling any of the following scenarios and exceptions:

Service instance provisioning ServiceBrokerCreateOperationInProgressException
Service instance updating ServiceBrokerUpdateOperationInProgressException
Service instance deleting ServiceBrokerDeleteOperationInProgressException
Service instance binding ServiceBrokerCreateOperationInProgressException
Service instance unbinding ServiceBrokerDeleteOperationInProgressException

See /~https://github.com/openservicebrokerapi/servicebroker/blob/v2.15/spec.md#response-3

Resolves #284
royclarkson added a commit that referenced this issue Jun 22, 2020
This commit updates the ServiceBrokerExceptionHandler to marshal an
OperationInProgressMessage response body instead of an ErrorMessage when
handling any of the following scenarios and exceptions:

Service instance provisioning ServiceBrokerCreateOperationInProgressException
Service instance updating ServiceBrokerUpdateOperationInProgressException
Service instance deleting ServiceBrokerDeleteOperationInProgressException
Service instance binding ServiceBrokerCreateOperationInProgressException
Service instance unbinding ServiceBrokerDeleteOperationInProgressException

See /~https://github.com/openservicebrokerapi/servicebroker/blob/v2.15/spec.md#response-3

Resolves #284
royclarkson added a commit that referenced this issue Jun 23, 2020
This commit updates the ServiceBrokerExceptionHandler to marshal an
OperationInProgressMessage response body instead of an ErrorMessage when
handling any of the following scenarios and exceptions:

Service instance provisioning ServiceBrokerCreateOperationInProgressException
Service instance updating ServiceBrokerUpdateOperationInProgressException
Service instance deleting ServiceBrokerDeleteOperationInProgressException
Service instance binding ServiceBrokerCreateOperationInProgressException
Service instance unbinding ServiceBrokerDeleteOperationInProgressException

See /~https://github.com/openservicebrokerapi/servicebroker/blob/v2.15/spec.md#response-3

Resolves #284
@royclarkson royclarkson modified the milestones: 3.2.0-M2, 3.2.0-M1 Aug 4, 2020
gberche-orange added a commit to orange-cloudfoundry/osb-cmdb that referenced this issue Apr 26, 2021
* [ ] Diagnose and handle test failure
  ```
 Service broker parameters are invalid: missing operation field

 GET "/v2/service_instances/43bcb7d0-2515-4d24-9e5c-4ee4c928f7f4/last_operation?plan_id=3a56d4f6-8775-4b0d-86c0-c4ec74d770de&service_id=78f94c53-5516-4f98-ab3c-b29fef7de5a7", parameters={masked}, messageType=OUT, sourceInstance=0, sourceType=APP/PROC/WEB, timestamp=1588842614618603232}
 Accept: isServiceGuidPreviousProvisionnedByUs=false for serviceInstanceId=43bcb7d0-2515-4d24-9e5c-4ee4c928f7f4 and request=ServiceBrokerRequest{platformInstanceId='null', apiInfoLocation='api.redacted-domain.org/v2/info', originatingIdentity=null', requestIdentity=f3bb2924-8bf5-4468-ac91-124202c942b3}GetLastServiceOperationRequest{serviceInstanceId='43bcb7d0-2515-4d24-9e5c-4ee4c928f7f4', serviceDefinitionId='78f94c53-5516-4f98-ab3c-b29fef7de5a7', planId='3a56d4f6-8775-4b0d-86c0-c4ec74d770de', operation='null'}, messageType=OUT, sourceInstance=0, sourceType=APP/PROC/WEB, timestamp=1588842614663803509}

  ```
    * [x] Check OSBClientFixture not passing state: not the case
    * [x] CC API receives empty last operation from concurrent call, and passes it around. Confirmed
       * Pb: not using CC API for simulating concurrent calls in ConcurrentCreateInstanceWithBackingServiceKeysAcceptanceTest, but OSB API fixture
       * Potentially with cleanup not being properly done and some instances remain.
          * No explicit clean up between early AT test phase and full phase.
       * [x] Fix it: pass state also in handleError()
          * [x] check ServiceBrokerCreateOperationInProgressException(operation) is indeed for OSB operation. Reported spring-cloud/spring-cloud-open-service-broker#284
    * [x] Check missing last operation in some CC API facing CSI calls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants