Skip to content

Commit ef38937

Browse files
committed
Re-raise 'root' user error in desire app handler
* If not re-raised, error is supressed with no clear user feedback
1 parent 2cc419e commit ef38937

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lib/cloud_controller/diego/desire_app_handler.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ def create_or_update_app(process, client)
1212
if e.name == 'RunnerError' && e.message['the requested resource already exists']
1313
existing_lrp = client.get_app(process)
1414
client.update_app(process, existing_lrp)
15+
elsif e.name == 'RunnerError' && e.message["'root' user not permitted"]
16+
raise
1517
end
1618
end
1719
end

spec/unit/lib/cloud_controller/diego/desire_app_handler_spec.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,17 @@ module Diego
5151
expect(client).to have_received(:get_app).exactly(2).times
5252
end
5353
end
54+
55+
context 'when root user is not permitted' do
56+
it 'raises a CloudController::Errors::ApiError' do
57+
allow(client).to receive(:desire_app).and_raise(CloudController::Errors::ApiError.new_from_details('RunnerError', "'root' user not permitted"))
58+
expect { DesireAppHandler.create_or_update_app(process, client) }.to(raise_error do |error|
59+
expect(error).to be_a(CloudController::Errors::ApiError)
60+
expect(error.name).to eq('RunnerError')
61+
expect(error.message).to include(/'root' user not permitted/)
62+
end)
63+
end
64+
end
5465
end
5566
end
5667
end

0 commit comments

Comments
 (0)