Skip to content

Commit

Permalink
Explicitly disable broker for vSphere validation
Browse files Browse the repository at this point in the history
The Vmware::InfraManager#verify_credentials method explicitly disabled
broker connections when verifying credentials so that new providers
aren't saved in the brokered connection list in addition to the issue
that the broker will not typically be running when validating
credentials for the first VMware provider.

When moving to validate_credentials_task which calls raw_connect this
option wasn't passed in, but we were checking for :fault_tolerant and
using MiqVim instead of MiqFaultTolerantVim which implicitly doesn't use
the broker so everything worked fine.

In cf1eae9 we removed the
:fault_tolerant option because it should always be enabled, the
:use_broker option is intended to control if we connect to
the broker or not.  This however broke the implicit skip broker option
that credential validation was using.

This mimics the Vmware::InfraManager#verify_credentials way of
explicitly disabling use of the broker by passing it as a task argument.
  • Loading branch information
agrare committed Nov 20, 2017
1 parent 28c6f65 commit 712f19b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/mixins/ems_common_angular.rb
Expand Up @@ -156,7 +156,7 @@ def get_task_args(ems)
:metrics_database => params[:metrics_database_name],
}]
when 'ManageIQ::Providers::Vmware::InfraManager'
[{:pass => password, :user => user, :ip => params[:default_hostname]}]
[{:pass => password, :user => user, :ip => params[:default_hostname], :use_broker => false}]
when 'ManageIQ::Providers::Nuage::NetworkManager'
endpoint_opts = {:protocol => params[:default_security_protocol], :hostname => params[:default_hostname], :api_port => params[:default_api_port], :api_version => params[:api_version]}
[user, params[:default_password], endpoint_opts]
Expand Down
11 changes: 11 additions & 0 deletions spec/controllers/ems_cloud_controller_spec.rb
Expand Up @@ -349,6 +349,17 @@
expect(mocked_class).to receive(:validate_credentials_task)
controller.send(:create_ems_button_validate)
end

context "vmware infrastructure manager" do
let(:mocked_class) { ManageIQ::Providers::Vmware::InfraManager }
let(:mocked_class_controller) { "ems_infra" }

it "disables the broker" do
expected_validate_args = [{:pass=>nil, :user=>nil, :ip=>nil, :use_broker=>false}]
expect(mocked_class).to receive(:validate_credentials_task).with(expected_validate_args, nil, nil)
controller.send(:create_ems_button_validate)
end
end
end

context "with a container manager" do
Expand Down

0 comments on commit 712f19b

Please sign in to comment.