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

Bug 1539542 - return bindings_retrievable #776

Merged
merged 1 commit into from
Feb 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pkg/broker/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,14 @@ func (a AnsibleBroker) Catalog() (*CatalogResponse, error) {
if err != nil {
log.Errorf("not adding spec %v to list of services due to error transforming to service - %v", spec.FQName, err)
} else {
// Bug 1539542 - in order for async bind to work,
// bindings_retrievable needs to be set to true. We only want to
// set BindingsRetrievable to true if the service is bindable
// AND we the broker is configured to launch apbs on bind
if ser.Bindable && a.brokerConfig.LaunchApbOnBind {
ser.BindingsRetrievable = true
}

services = append(services, ser)
}
}
Expand Down
22 changes: 12 additions & 10 deletions pkg/broker/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,18 @@ func IsValidWorkTopic(topic WorkTopic) bool {
// Service - Service object to be returned.
// based on https://github.com/openservicebrokerapi/servicebroker/blob/master/spec.md#service-objects
type Service struct {
Name string `json:"name"`
ID string `json:"id"`
Description string `json:"description"`
Tags []string `json:"tags,omitempty"`
Requires []string `json:"requires,omitempty"`
Bindable bool `json:"bindable"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
DashboardClient *DashboardClient `json:"dashboard_client,omitempty"`
PlanUpdatable bool `json:"plan_updateable,omitempty"`
Plans []Plan `json:"plans"`
Name string `json:"name"`
ID string `json:"id"`
Description string `json:"description"`
Tags []string `json:"tags,omitempty"`
Requires []string `json:"requires,omitempty"`
Bindable bool `json:"bindable"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
DashboardClient *DashboardClient `json:"dashboard_client,omitempty"`
InstancesRetrievable bool `json:"instances_retrievable"`
BindingsRetrievable bool `json:"bindings_retrievable"`
PlanUpdatable bool `json:"plan_updateable,omitempty"`
Plans []Plan `json:"plans"`
}

// DashboardClient - Dashboard Client to be returned
Expand Down
19 changes: 11 additions & 8 deletions pkg/broker/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,17 @@ func SpecToService(spec *apb.Spec) (Service, error) {
return Service{}, err
}
retSvc := Service{
ID: spec.ID,
Name: spec.FQName,
Description: spec.Description,
Tags: make([]string, len(spec.Tags)),
Bindable: spec.Bindable,
PlanUpdatable: planUpdatable(spec.Plans),
Plans: plans,
Metadata: spec.Metadata,
ID: spec.ID,
Name: spec.FQName,
Description: spec.Description,
Tags: make([]string, len(spec.Tags)),
Bindable: spec.Bindable,
PlanUpdatable: planUpdatable(spec.Plans),
Plans: plans,
Metadata: spec.Metadata,
InstancesRetrievable: true,
// NOTE: not setting BindingsRetrievable here since that is dependent on
// whether we have async bind enabled.
}

copy(retSvc.Tags, spec.Tags)
Expand Down