Skip to content

Commit 93828d8

Browse files
committed
add info about sp and sp to msg
1 parent 586999d commit 93828d8

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

app/controllers/v3/service_instances_controller.rb

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,9 @@ def create_user_provided(message)
255255
def create_managed(message, space:)
256256
service_plan = ServicePlan.first(guid: message.service_plan_guid)
257257
unprocessable_service_plan! unless service_plan_valid?(service_plan)
258-
unavailable_service_plan!(service_plan.name) unless service_plan_active?(service_plan)
259-
service_plan_not_visible_in_space! unless service_plan_exists_in_space?(service_plan, space)
258+
unavailable_service_plan!(service_plan.name, service_plan.guid) unless service_plan_active?(service_plan)
259+
service_plan_not_visible_in_space!(service_plan.name, service_plan.guid, space.name, space.guid) \
260+
unless service_plan_exists_in_space?(service_plan, space)
260261

261262
action = V3::ServiceInstanceCreateManaged.new(user_audit_info, message.audit_hash)
262263
VCAP::CloudController::ManagedServiceInstance.db.transaction do
@@ -414,8 +415,9 @@ def raise_if_invalid_service_plan!(service_instance, message)
414415

415416
service_plan = ServicePlan.first(guid: message.service_plan_guid)
416417
unprocessable_service_plan! unless service_plan_valid?(service_plan)
417-
unavailable_service_plan!(service_plan.name) unless service_plan_active?(service_plan)
418-
service_plan_not_visible_in_space! unless service_plan_exists_in_space?(service_plan, service_instance.space)
418+
unavailable_service_plan!(service_plan.name, service_plan.guid) unless service_plan_active?(service_plan)
419+
service_plan_not_visible_in_space!(service_plan.name, service_plan.guid, space.name, space.guid) \
420+
unless service_plan_exists_in_space?(service_plan, service_instance.space)
419421
invalid_service_plan_relation! unless service_plan.service == service_instance.service
420422
end
421423

@@ -435,13 +437,14 @@ def unprocessable_service_plan!
435437
unprocessable!('Invalid service plan. Ensure that the service plan exists, is available, and you have access to it.')
436438
end
437439

438-
def unavailable_service_plan!(service_plan)
439-
unprocessable!("Invalid service plan. The service plan #{service_plan} has been removed from the service broker's catalog." \
440+
def unavailable_service_plan!(service_plan, service_plan_guid)
441+
unprocessable!("Invalid service plan. The service plan #{service_plan} with guid #{service_plan_guid} has been removed from the service broker's catalog." \
440442
'It is not possible to create new service instances using this plan.')
441443
end
442444

443-
def service_plan_not_visible_in_space!
444-
unprocessable!('Invalid service plan. Ensure that the service plan is visible in your current space.')
445+
def service_plan_not_visible_in_space!(service_plan, service_plan_guid, space_name, space_guid)
446+
unprocessable!("Invalid service plan. Ensure that the service plan #{service_plan} with guid #{service_plan_guid} \
447+
is visible in your current space #{space_name} with guid #{space_guid}.")
445448
end
446449

447450
def invalid_service_plan_relation!

spec/request/service_instances_spec.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,7 +1260,8 @@ def check_filtered_instances(*instances)
12601260
expect(last_response).to have_status_code(422)
12611261
expect(parsed_response['errors']).to include(
12621262
include({
1263-
'detail' => 'Invalid service plan. Ensure that the service plan is visible in your current space.',
1263+
'detail' => "Invalid service plan. Ensure that the service plan #{service_plan.name} with \
1264+
guid #{service_plan_guid} is visible in your current space #{space.name} with guid #{space.guid}.",
12641265
'title' => 'CF-UnprocessableEntity',
12651266
'code' => 10_008
12661267
})
@@ -1276,7 +1277,8 @@ def check_filtered_instances(*instances)
12761277
expect(last_response).to have_status_code(422)
12771278
expect(parsed_response['errors']).to include(
12781279
include({
1279-
'detail' => "Invalid service plan. The service plan #{service_plan.name} has been removed from the service broker's catalog." \
1280+
'detail' => "Invalid service plan. The service plan #{service_plan.name} with guid #{service_plan.guid} " \
1281+
"has been removed from the service broker's catalog." \
12801282
'It is not possible to create new service instances using this plan.',
12811283
'title' => 'CF-UnprocessableEntity',
12821284
'code' => 10_008
@@ -2414,7 +2416,8 @@ def check_filtered_instances(*instances)
24142416
expect(last_response).to have_status_code(422)
24152417
expect(parsed_response['errors']).to include(
24162418
include({
2417-
'detail' => "Invalid service plan. The service plan #{service_plan.name} has been removed from the service broker's catalog." \
2419+
'detail' => "Invalid service plan. The service plan #{service_plan.name} with guid #{service_plan.guid} " \
2420+
"has been removed from the service broker's catalog." \
24182421
'It is not possible to create new service instances using this plan.',
24192422
'title' => 'CF-UnprocessableEntity',
24202423
'code' => 10_008

0 commit comments

Comments
 (0)