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

Provider validate - don't attempt to directly connect from the UI #6237

Merged
merged 1 commit into from
Oct 2, 2019
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
11 changes: 1 addition & 10 deletions app/controllers/mixins/ems_common/angular.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,10 @@ def realtime_authentication_check(verify_ems = nil)
verify_ems.authentication_check(params[:cred_type], :save => false, :database => params[:metrics_database_name])
end

def realtime_raw_connect(ems_type)
ems_type.raw_connect(*get_task_args(ems_type))
true
rescue => err
[false, err.message]
end

def create_ems_button_validate
@in_a_form = true
ems_type = model.model_from_emstype(params[:emstype])
result, details = if %w[ems_cloud ems_infra].include?(params[:controller]) && session[:selected_roles].try(:include?, 'user_interface')
realtime_raw_connect(ems_type)
elsif %w[ems_cloud ems_infra].include?(params[:controller])
result, details = if %w[ems_cloud ems_infra].include?(params[:controller])
ems_type.validate_credentials_task(get_task_args(ems_type), session[:userid], params[:zone])
else
realtime_authentication_check(ems_type.new)
Expand Down
5 changes: 3 additions & 2 deletions spec/controllers/ems_cloud_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,11 @@
controller.send(:create_ems_button_validate)
end

it "does not queue the authentication check if it is a cloud provider with a ui role" do
it "does queue the authentication check even if it is a cloud provider with a ui role" do
session[:selected_roles] = ['user_interface']

expect(mocked_class).to receive(:raw_connect)
expect(mocked_class).not_to receive(:raw_connect)
expect(mocked_class).to receive(:validate_credentials_task)
controller.send(:create_ems_button_validate)
end

Expand Down