ec2launcher 1.3.1 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.3.2
2
+
3
+ * Added support for specifying per-environment IAM profiles in Applications.
4
+
1
5
  ## 1.3.1
2
6
 
3
7
  * Kludge around log4r issue with Route53.
@@ -41,7 +41,6 @@ module EC2Launcher
41
41
  dsl_accessor :availability_zone
42
42
  dsl_accessor :basename
43
43
  dsl_accessor :inherit
44
- dsl_accessor :iam_profile
45
44
  dsl_accessor :instance_type
46
45
  dsl_accessor :name_suffix
47
46
  dsl_accessor :subnet
@@ -61,8 +60,9 @@ module EC2Launcher
61
60
 
62
61
  def initialize(name)
63
62
  @name = name
63
+
64
64
  @email_notifications = nil
65
-
65
+ @iam_profile = Hash.new
66
66
  @use_rvm = true
67
67
  end
68
68
 
@@ -141,6 +141,31 @@ module EC2Launcher
141
141
  end
142
142
  end
143
143
 
144
+ # IAM profile role name to use for new instances.
145
+ #
146
+ # Expects one param in the form of either:
147
+ # * A string containing the name of the IAM profile
148
+ # * A Hash mapping environment names (as strings) to IAM profile names (as strings)
149
+ def iam_profile(*data)
150
+ if data.empty?
151
+ @iam_profile
152
+ else
153
+ if data[0].kind_of? Hash
154
+ @iam_profile = data[0]
155
+ else
156
+ @iam_profile["default"] = data[0]
157
+ end
158
+ end
159
+ end
160
+
161
+ # Retrieves the IAM profile for a given environment. Or
162
+ # returns the default profile name.
163
+ def iam_profile_for_environment(environment)
164
+ iam_profile = @iam_profile[environment]
165
+ iam_profile ||= @iam_profile["default"]
166
+ iam_profile
167
+ end
168
+
144
169
  # Takes values from the other server type and merges them into this one
145
170
  def merge(other_server)
146
171
  @name = other_server.name
@@ -2,5 +2,5 @@
2
2
  # Copyright (c) 2012 Sean Laurent
3
3
  #
4
4
  module EC2Launcher
5
- VERSION = "1.3.1"
5
+ VERSION = "1.3.2"
6
6
  end
data/lib/ec2launcher.rb CHANGED
@@ -189,8 +189,8 @@ module EC2Launcher
189
189
  ##############################
190
190
  # IAM PROFILE
191
191
  ##############################
192
- iam_profile = @environment.iam_profile
193
- iam_profile ||= @application.iam_profile
192
+ iam_profile = @application.iam_profile_for_environment(@environment.name)
193
+ iam_profile ||= @environment.iam_profile
194
194
 
195
195
  ##############################
196
196
  # INSTANCE TYPE
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ec2launcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-04 00:00:00.000000000 Z
12
+ date: 2012-10-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk