tsb: return error description on failed async operation
@@ -54,6 +54,7 @@ func (b *Broker) LastOperation(u user.Info, instanceID string, operation api.Ope
}
state := api.LastOperationStateInProgress
+ var description string
for _, condition := range templateInstance.Status.Conditions {
if condition.Type == templateapi.TemplateInstanceReady && condition.Status == kapi.ConditionTrue {
state = api.LastOperationStateSucceeded
@@ -61,9 +62,10 @@ func (b *Broker) LastOperation(u user.Info, instanceID string, operation api.Ope
}
if condition.Type == templateapi.TemplateInstanceInstantiateFailure && condition.Status == kapi.ConditionTrue {
state = api.LastOperationStateFailed
+ description = condition.Message
break
}
}
- return api.NewResponse(http.StatusOK, &api.LastOperationResponse{State: state}, nil)
+ return api.NewResponse(http.StatusOK, &api.LastOperationResponse{State: state, Description: description}, nil)
}
