Skip to content

Commit

Permalink
Merge pull request fog#2208 from restebanez/aws_autoscaling/fix-group…
Browse files Browse the repository at this point in the history
…-creation

Aws autoscaling/fix tag assignment
  • Loading branch information
geemus committed Oct 2, 2013
2 parents c0af5b9 + 557204e commit b490406
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/fog/aws/models/auto_scaling/group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def initialize(attributes={})
self.max_size = 0
self.min_size = 0
self.suspended_processes = []
self.tags = []
self.tags = {}
self.termination_policies = ['Default']
super
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,17 @@ def create_auto_scaling_group(auto_scaling_group_name, availability_zones, launc
if load_balancer_names = options.delete('LoadBalancerNames')
options.merge!(AWS.indexed_param('LoadBalancerNames.member.%d', [*load_balancer_names]))
end

if tags = options.delete('Tags')
tags.each_with_index do |tag, i|
tag.each do |key, value|
options["Tags.member.#{i+1}.#{key}"] = value unless value.nil?
end
tags.each_with_index do |(key, value), i|
options["Tags.member.#{i+1}.Key"] = key.to_s # turns symbol into string
options["Tags.member.#{i+1}.Value"] = value
end
end
if termination_policies = options.delete('TerminationPolicies')
options.merge!(AWS.indexed_param('TerminationPolicies.member.%d', [*termination_policies]))
end

request({
'Action' => 'CreateAutoScalingGroup',
'AutoScalingGroupName' => auto_scaling_group_name,
Expand Down

0 comments on commit b490406

Please sign in to comment.