Skip to content

Commit 6f4c71d

Browse files
authored
Do not warn using process credentials in shared config (#3062)
1 parent 5d3d278 commit 6f4c71d

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

gems/aws-sdk-core/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Unreleased Changes
22
------------------
33

4+
* Issue - Fix `Aws::ProcessCredentials` warning in cases where shared config is used.
5+
46
3.201.0 (2024-07-02)
57
------------------
68

gems/aws-sdk-core/lib/aws-sdk-core/credential_provider_chain.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def static_profile_credentials(options)
8484
def static_profile_process_credentials(options)
8585
if Aws.shared_config.config_enabled? && options[:config] && options[:config].profile
8686
process_provider = Aws.shared_config.credential_process(profile: options[:config].profile)
87-
ProcessCredentials.new(process_provider) if process_provider
87+
ProcessCredentials.new([process_provider]) if process_provider
8888
end
8989
rescue Errors::NoSuchProfileError
9090
nil
@@ -117,9 +117,9 @@ def shared_credentials(options)
117117

118118
def process_credentials(options)
119119
profile_name = determine_profile_name(options)
120-
if Aws.shared_config.config_enabled? &&
121-
(process_provider = Aws.shared_config.credential_process(profile: profile_name))
122-
ProcessCredentials.new(process_provider)
120+
if Aws.shared_config.config_enabled?
121+
process_provider = Aws.shared_config.credential_process(profile: profile_name)
122+
ProcessCredentials.new([process_provider]) if process_provider
123123
end
124124
rescue Errors::NoSuchProfileError
125125
nil

gems/aws-sdk-core/lib/aws-sdk-core/shared_config.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ def assume_role_process_credentials_from_config(profile)
339339
if @parsed_config
340340
credential_process ||= @parsed_config.fetch(profile, {})['credential_process']
341341
end
342-
ProcessCredentials.new(credential_process) if credential_process
342+
ProcessCredentials.new([credential_process]) if credential_process
343343
end
344344

345345
def credentials_from_shared(profile, _opts)

gems/aws-sdk-core/spec/aws/credential_resolution_chain_spec.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44

55
module Aws
66
describe 'Credential Resolution Chain' do
7-
before(:each) do
8-
allow_any_instance_of(ProcessCredentials).to receive(:warn)
9-
end
10-
117
let(:mock_credential_file) do
128
File.expand_path(
139
File.join(
@@ -35,6 +31,8 @@ module Aws
3531

3632
before(:each) do
3733
allow(InstanceProfileCredentials).to receive(:new).and_return(mock_instance_creds)
34+
35+
expect_any_instance_of(ProcessCredentials).not_to receive(:warn)
3836
end
3937

4038
describe 'default behavior' do

0 commit comments

Comments
 (0)