From 1e129089ab39c8840a721a13c4b9528e86f35076 Mon Sep 17 00:00:00 2001 From: Shai Rosenfeld Date: Wed, 11 May 2016 13:31:54 -0700 Subject: [PATCH] do not make requests if mocked. --- lib/fog/aws/credential_fetcher.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/fog/aws/credential_fetcher.rb b/lib/fog/aws/credential_fetcher.rb index 3e5ffc290..738e6e752 100644 --- a/lib/fog/aws/credential_fetcher.rb +++ b/lib/fog/aws/credential_fetcher.rb @@ -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)