From be649fa46ffa4683a9fc347b50c396b43481c480 Mon Sep 17 00:00:00 2001 From: Alexander Zagaynov Date: Thu, 1 Aug 2019 16:59:43 +0200 Subject: [PATCH] use 'supports?' feature instead of class name --- app/controllers/mixins/ems_common/angular.rb | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/app/controllers/mixins/ems_common/angular.rb b/app/controllers/mixins/ems_common/angular.rb index ad053a4c4815..cbeb8aa58e4a 100644 --- a/app/controllers/mixins/ems_common/angular.rb +++ b/app/controllers/mixins/ems_common/angular.rb @@ -366,7 +366,7 @@ def ems_form_fields host_default_vnc_port_end = @ems.host_default_vnc_port_end.to_s end - if @ems.kind_of?(ManageIQ::Providers::Amazon::CloudManager) + if @ems.supports?(:assume_role) service_account = @ems.authentication_service_account end @@ -802,14 +802,13 @@ def build_credentials(ems, mode) console_password = params[:console_password] ? params[:console_password] : ems.authentication_password(:console) creds[:console] = {:userid => params[:console_userid], :password => console_password, :save => (mode != :validate)} # FIXME: skateman was here end - if ems.kind_of?(ManageIQ::Providers::Amazon::CloudManager) - if ems.supports_authentication?(:smartstate_docker) && params[:smartstate_docker_userid] - smartstate_docker_password = params[:smartstate_docker_password] || ems.authentication_password(:smartstate_docker) - creds[:smartstate_docker] = {:userid => params[:smartstate_docker_userid], :password => smartstate_docker_password, :save => true} - else - creds[:default] ||= {} - creds[:default][:service_account] = params[:service_account] - end + if ems.kind_of?(ManageIQ::Providers::Amazon::CloudManager) && + ems.supports_authentication?(:smartstate_docker) && params[:smartstate_docker_userid] + smartstate_docker_password = params[:smartstate_docker_password] || ems.authentication_password(:smartstate_docker) + creds[:smartstate_docker] = {:userid => params[:smartstate_docker_userid], :password => smartstate_docker_password, :save => true} + end + if ems.supports?(:assume_role) + (creds[:default] ||= {})[:service_account] = params[:service_account] end if (ems.kind_of?(ManageIQ::Providers::Openstack::InfraManager) || ems.kind_of?(ManageIQ::Providers::Openstack::CloudManager) ||