From 9ada312d58a75e6e3af14ddc43532abbfa601ab8 Mon Sep 17 00:00:00 2001 From: David Chen Date: Mon, 14 Jan 2013 14:41:48 -0500 Subject: [PATCH 1/2] Add ability to specify Tags to AWS cfn-create-stack call --- .../requests/cloud_formation/create_stack.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/fog/aws/requests/cloud_formation/create_stack.rb b/lib/fog/aws/requests/cloud_formation/create_stack.rb index 4fa524b27..c66211595 100644 --- a/lib/fog/aws/requests/cloud_formation/create_stack.rb +++ b/lib/fog/aws/requests/cloud_formation/create_stack.rb @@ -51,6 +51,23 @@ module Fog end end + num_tags = 0 + if options['Tags'] + options['Tags'].keys.each_with_index do |key, index| + index += 1 # tags are 1-indexed + num_tags += 1 # 10 tag max + + params.merge!({ + "Tags.member.#{index}.Key" => key, + "Tags.member.#{index}.Value" => options['Tags'][key] + }) + end + end + + if num_tags > 10 + raise ArgumentError.new("a maximum of 10 tags can be specified <#{num_tags}>") + end + if options['TemplateBody'] params['TemplateBody'] = options['TemplateBody'] elsif options['TemplateURL'] From 563bb4376bf863e0572e8cf0654705820cd596fb Mon Sep 17 00:00:00 2001 From: David Chen Date: Mon, 14 Jan 2013 14:50:26 -0500 Subject: [PATCH 2/2] Remove tabs... --- lib/fog/aws/requests/cloud_formation/create_stack.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/fog/aws/requests/cloud_formation/create_stack.rb b/lib/fog/aws/requests/cloud_formation/create_stack.rb index c66211595..7166b07e3 100644 --- a/lib/fog/aws/requests/cloud_formation/create_stack.rb +++ b/lib/fog/aws/requests/cloud_formation/create_stack.rb @@ -51,7 +51,7 @@ module Fog end end - num_tags = 0 + num_tags = 0 if options['Tags'] options['Tags'].keys.each_with_index do |key, index| index += 1 # tags are 1-indexed @@ -64,9 +64,9 @@ module Fog end end - if num_tags > 10 - raise ArgumentError.new("a maximum of 10 tags can be specified <#{num_tags}>") - end + if num_tags > 10 + raise ArgumentError.new("a maximum of 10 tags can be specified <#{num_tags}>") + end if options['TemplateBody'] params['TemplateBody'] = options['TemplateBody']