From 81306ab1d54c1594806cc29670e7a951380f2f69 Mon Sep 17 00:00:00 2001 From: Adam Grare Date: Mon, 20 Nov 2017 08:34:33 -0500 Subject: [PATCH] Explicitly disable broker for vSphere validation 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 manageiq@cf1eae992eae10b38a3efec92b0d04cc68aa31ea 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. --- app/controllers/mixins/ems_common_angular.rb | 2 +- spec/controllers/ems_cloud_controller_spec.rb | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/controllers/mixins/ems_common_angular.rb b/app/controllers/mixins/ems_common_angular.rb index fb51b92fad7..9a3a15c75cb 100644 --- a/app/controllers/mixins/ems_common_angular.rb +++ b/app/controllers/mixins/ems_common_angular.rb @@ -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] diff --git a/spec/controllers/ems_cloud_controller_spec.rb b/spec/controllers/ems_cloud_controller_spec.rb index b8840d0dcbd..2222d51f075 100644 --- a/spec/controllers/ems_cloud_controller_spec.rb +++ b/spec/controllers/ems_cloud_controller_spec.rb @@ -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