Skip to content

Commit

Permalink
use 'supports?' feature instead of class name
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderZagaynov committed Aug 1, 2019
1 parent 6cb2683 commit be649fa
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions app/controllers/mixins/ems_common/angular.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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) ||
Expand Down

0 comments on commit be649fa

Please sign in to comment.