Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

retry CPI calls in case of SSL_read errors as well #689

Merged
merged 5 commits into from
Feb 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/bosh_azure_cpi/lib/cloud/azure/restapi/azure_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,15 @@ class AzureClient # rubocop:todo Metrics/ClassLength

def initialize(azure_config, logger)
@logger = logger

@azure_config = azure_config

# Allow Net::HTTP to support instance variable names via ssl_options
(Net::HTTP::SSL_IVNAMES << :@ssl_options).uniq!
(Net::HTTP::SSL_ATTRIBUTES << :options).uniq!
mvach marked this conversation as resolved.
Show resolved Hide resolved

Net::HTTP.class_eval do
attr_accessor :ssl_options
end
end

# Common
Expand Down Expand Up @@ -2255,6 +2262,7 @@ def redact_credentials_in_response_body(body)
def http(uri, use_ssl = true)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true && use_ssl
http.ssl_options = OpenSSL::SSL::OP_IGNORE_UNEXPECTED_EOF
if @azure_config.environment == ENVIRONMENT_AZURESTACK && uri.host.include?(@azure_config.azure_stack.domain)
# The CA cert is only specified for the requests to AzureStack domain. If specified for other domains, the request will fail.
http.ca_file = get_ca_cert_path
Expand Down