Skip to content

Commit

Permalink
Added the user_agent when is creating the connection
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlleDaniel committed Oct 30, 2017
1 parent 56cf327 commit 0139819
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
18 changes: 10 additions & 8 deletions app/models/manageiq/providers/lenovo/manager_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ def connect(options = {})
host = options[:host] || address
port = options[:port] || self.port
auth_type = AUTH_TYPES[options[:auth_type]]
user_agent_label = "ManageIQ/#{MiqServer.first.version}"

# 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 = {})
Expand All @@ -39,14 +40,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
Expand Down
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0139819

Please sign in to comment.