1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00

do not make requests if mocked.

This commit is contained in:
Shai Rosenfeld 2016-05-11 13:31:54 -07:00
parent 5e6f7fd085
commit 1e129089ab

View file

@ -5,6 +5,10 @@ module Fog
INSTANCE_METADATA_PATH = "/latest/meta-data/iam/security-credentials/"
module ServiceMethods
def fetch_credentials(options)
if options[:use_iam_profile] && Fog.mocking?
mock_iam = {:use_iam_profile => true, :aws_access_key_id => "mock-iam-role", :aws_secret_access_key => "mock-iam-role"}
return options.merge(mock_iam)
end
if options[:use_iam_profile]
begin
connection = options[:connection] || Excon.new(INSTANCE_METADATA_HOST)