Commit 54c462f 1 parent b4c3e10 commit 54c462f Copy full SHA for 54c462f
File tree 1 file changed +10
-6
lines changed
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 20
20
require 'json'
21
21
require 'fog'
22
22
require 'kitchen'
23
- include Fog ::AWS ::CredentialFetcher ::ServiceMethods
24
23
25
24
module Kitchen
26
25
@@ -31,11 +30,7 @@ module Driver
31
30
# @author Fletcher Nichol <[email protected] >
32
31
class Ec2 < Kitchen ::Driver ::SSHBase
33
32
34
-
35
- iam_creds = Fog ::AWS ::CredentialFetcher ::ServiceMethods . fetch_credentials (
36
- use_iam_profile : true
37
- ) rescue { }
38
-
33
+ extend Fog ::AWS ::CredentialFetcher ::ServiceMethods
39
34
default_config :region , 'us-east-1'
40
35
default_config :availability_zone , 'us-east-1b'
41
36
default_config :flavor_id , 'm1.small'
@@ -103,6 +98,15 @@ class Ec2 < Kitchen::Driver::SSHBase
103
98
end
104
99
end
105
100
101
+ def self . iam_creds
102
+ @iam_creds ||= begin
103
+ fetch_credentials ( use_iam_profile :true )
104
+ rescue
105
+ debug ( "fetch_credentials failed with exception #{ e . message } :#{ e . backtrace . join ( "\n " ) } " )
106
+ { }
107
+ end
108
+ end
109
+
106
110
def create ( state )
107
111
return if state [ :server_id ]
108
112
You can’t perform that action at this time.
0 commit comments