Skip to content

Commit

Permalink
Fix URL override not being used for API calls
Browse files Browse the repository at this point in the history
The openapi generated `ApiClient`/`Configuration` classes have a way to
to pass scheme, host, and base_path but `Configuration#server_settings`
and `Configuration#server_variables` is used unless server_index is set
to `nil`
  • Loading branch information
agrare committed Dec 9, 2024
1 parent 997421c commit 3152bde
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions app/models/manageiq/providers/cisco_intersight/manager_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,16 @@ def verify_provider_connection(api_client)
def raw_connect(url, verify_ssl, key_id, key)
require "intersight_client"

uri = URI.parse(url || "https://intersight.com")
scheme = uri.scheme
host = "#{uri.host}:#{uri.port}"

verify_ssl = OpenSSL::SSL::VERIFY_PEER if verify_ssl.nil?
verify_ssl = verify_ssl == OpenSSL::SSL::VERIFY_PEER

IntersightClient::ApiClient.new(
IntersightClient::Configuration.new do |config|
config.scheme = scheme
config.host = host
if url && url != IntersightClient::Configuration.default.base_url
server = url.gsub(/^\w+:\/\//, "")
config.server_variables[:server] = server
end

config.verify_ssl = verify_ssl
config.api_key = key
config.api_key_id = key_id
Expand Down

0 comments on commit 3152bde

Please sign in to comment.