Skip to content

Commit 3d7cee4

Browse files
committed
Optional allow_reassignment flag and ec2 api response for assign ip address call
1 parent cc676aa commit 3d7cee4

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
MovableInkAWS (2.11.3)
4+
MovableInkAWS (2.11.4)
55
aws-sdk-athena (~> 1)
66
aws-sdk-autoscaling (~> 1)
77
aws-sdk-cloudwatch (~> 1)

lib/movable_ink/aws/ec2.rb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,20 +258,24 @@ def available_elastic_ips(role:)
258258
unassigned_elastic_ips.select { |address| address.tags.detect { |t| t.key == 'mi:roles' && t.value == role } }
259259
end
260260

261-
def assign_ip_address_with_retries(role:)
261+
def assign_ip_address_with_retries(role:, allow_reassociation: false)
262+
response = nil
262263
run_with_backoff do
263-
ec2_with_retries.associate_address({
264+
response = ec2_with_retries.associate_address({
264265
instance_id: instance_id,
265-
allocation_id: available_elastic_ips(role: role).sample.allocation_id
266+
allocation_id: available_elastic_ips(role: role).sample.allocation_id,
267+
allow_reassociation: allow_reassociation
266268
})
267269
end
270+
response
268271
end
269272

270-
def assign_ip_address(role:)
273+
def assign_ip_address(role:, allow_reassociation: false)
271274
run_with_backoff do
272275
ec2.associate_address({
273276
instance_id: instance_id,
274-
allocation_id: available_elastic_ips(role: role).sample.allocation_id
277+
allocation_id: available_elastic_ips(role: role).sample.allocation_id,
278+
allow_reassociation: allow_reassociation
275279
})
276280
end
277281
end

lib/movable_ink/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module MovableInk
22
class AWS
3-
VERSION = '2.11.3'
3+
VERSION = '2.11.4'
44
end
55
end

0 commit comments

Comments
 (0)