diff --git a/app/models/manageiq/providers/lenovo/manager_mixin.rb b/app/models/manageiq/providers/lenovo/manager_mixin.rb index 887690f1db..66d853a7d9 100644 --- a/app/models/manageiq/providers/lenovo/manager_mixin.rb +++ b/app/models/manageiq/providers/lenovo/manager_mixin.rb @@ -8,6 +8,8 @@ module ManageIQ::Providers::Lenovo::ManagerMixin nil => 'basic_auth' }.freeze + USER_AGENT = "CFME/#{MiqServer.first.version}".freeze + def description "Lenovo XClarity" end @@ -20,10 +22,11 @@ def connect(options = {}) host = options[:host] || address port = options[:port] || self.port auth_type = AUTH_TYPES[options[:auth_type]] + user_agent_label = USER_AGENT # TODO: improve this SSL verification verify_ssl = options[:verify_ssl] == 1 ? 'PEER' : 'NONE' - self.class.raw_connect(username, password, host, port, auth_type, verify_ssl) + self.class.raw_connect(username, password, host, port, auth_type, verify_ssl, user_agent_label) end def verify_credentials(auth_type = nil, options = {}) @@ -39,14 +42,15 @@ def verify_credentials(auth_type = nil, options = {}) end module ClassMethods - def raw_connect(username, password, host, port, auth_type, verify_ssl) + def raw_connect(username, password, host, port, auth_type, verify_ssl, user_agent_label) xclarity = XClarityClient::Configuration.new( - :username => username, - :password => password, - :host => host, - :port => port, - :auth_type => auth_type, - :verify_ssl => verify_ssl + :username => username, + :password => password, + :host => host, + :port => port, + :auth_type => auth_type, + :verify_ssl => verify_ssl, + :user_agent_label => user_agent_label, ) XClarityClient::Client.new(xclarity) end diff --git a/spec/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser_spec.rb b/spec/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser_spec.rb index c2b657d5e8..f5fbaffe13 100644 --- a/spec/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser_spec.rb +++ b/spec/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser_spec.rb @@ -1,4 +1,7 @@ describe ManageIQ::Providers::Lenovo::PhysicalInfraManager::RefreshParser do + before :all do + FactoryGirl.create(:miq_server, :version=> 'master') + end it 'will retrieve physical servers' do pim = FactoryGirl.create(:physical_infra, :name => "LXCA", diff --git a/spec/models/manageiq/providers/lenovo/physical_infra_manager/refresher_spec.rb b/spec/models/manageiq/providers/lenovo/physical_infra_manager/refresher_spec.rb index 87d5aa2248..65700c0de8 100644 --- a/spec/models/manageiq/providers/lenovo/physical_infra_manager/refresher_spec.rb +++ b/spec/models/manageiq/providers/lenovo/physical_infra_manager/refresher_spec.rb @@ -1,4 +1,8 @@ describe ManageIQ::Providers::Lenovo::PhysicalInfraManager::Refresher do + before :all do + FactoryGirl.create(:miq_server, :version=> 'master') + end + let(:auth) do FactoryGirl.create(:authentication, :userid => 'admin', diff --git a/spec/models/manageiq/providers/lenovo/physical_infra_manager_spec.rb b/spec/models/manageiq/providers/lenovo/physical_infra_manager_spec.rb index 9cc4c05360..54ff6e5315 100644 --- a/spec/models/manageiq/providers/lenovo/physical_infra_manager_spec.rb +++ b/spec/models/manageiq/providers/lenovo/physical_infra_manager_spec.rb @@ -4,6 +4,7 @@ describe ManageIQ::Providers::Lenovo::PhysicalInfraManager do before :all do @auth = { :user => 'admin', :pass => 'smartvm', :host => 'localhost', :port => '3000' } + FactoryGirl.create(:miq_server, :version=>'master') end it 'will turn on a location LED successfully' do