Commit 4b0a001 1 parent 0ab44fe commit 4b0a001 Copy full SHA for 4b0a001
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'
@@ -78,6 +73,15 @@ class Ec2 < Kitchen::Driver::SSHBase
78
73
required_config :aws_ssh_key_id
79
74
required_config :image_id
80
75
76
+ def self . iam_creds
77
+ @iam_creds ||= begin
78
+ fetch_credentials ( use_iam_profile :true )
79
+ rescue
80
+ debug ( "fetch_credentials failed with exception #{ e . message } :#{ e . backtrace . join ( "\n " ) } " )
81
+ { }
82
+ end
83
+ end
84
+
81
85
def create ( state )
82
86
return if state [ :server_id ]
83
87
You can’t perform that action at this time.
0 commit comments