Class: LonoCfn::Update
Instance Method Summary collapse
- #change_set_update ⇒ Object
- #plan ⇒ Object
- #preview_changes ⇒ Object
-
#save_stack(params) ⇒ Object
save_stack is the interface method.
- #standard_update(params) ⇒ Object
-
#update_stack(params) ⇒ Object
aws cloudformation update-stack –stack-name prod-hi-123456789 –parameters file://output/params/prod-hi-123456789.json –template-body file://output/prod-hi.json.
Methods inherited from Base
#check_files, #check_for_errors, #convention_path, #detect_format, #exist_unless_updatable, #generate_params, #generate_templates, #get_source_path, #initialize, #quit, #run, #stack_status
Methods included from Util
Methods included from AwsServices
#cfn, #stack_exists?, #testing_update?
Constructor Details
This class inherits a constructor from LonoCfn::Base
Instance Method Details
#change_set_update ⇒ Object
60 61 62 |
# File 'lib/lono_cfn/update.rb', line 60 def change_set_update plan.execute_change_set end |
#plan ⇒ Object
49 50 51 52 53 54 |
# File 'lib/lono_cfn/update.rb', line 49 def plan return @plan if @plan @plan = Plan.new(@stack_name, @options.merge(lono: false, mute_params: true)) @plan.setup @plan end |
#preview_changes ⇒ Object
56 57 58 |
# File 'lib/lono_cfn/update.rb', line 56 def preview_changes plan.preview_change_set end |
#save_stack(params) ⇒ Object
save_stack is the interface method
4 5 6 |
# File 'lib/lono_cfn/update.rb', line 4 def save_stack(params) update_stack(params) end |
#standard_update(params) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/lono_cfn/update.rb', line 34 def standard_update(params) template_body = IO.read(@template_path) begin cfn.update_stack( stack_name: @stack_name, template_body: template_body, parameters: params#, # capabilities: ["CAPABILITY_IAM"] ) rescue Aws::CloudFormation::Errors::ValidationError => e puts "ERROR: #{e.}".red error = true end end |
#update_stack(params) ⇒ Object
aws cloudformation update-stack –stack-name prod-hi-123456789 –parameters file://output/params/prod-hi-123456789.json –template-body file://output/prod-hi.json
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/lono_cfn/update.rb', line 9 def update_stack(params) unless stack_exists?(@stack_name) puts "Cannot update a stack because the #{@stack_name} does not exists." return end exist_unless_updatable(stack_status(@stack_name)) = "Updating #{@stack_name} stack" error = nil if @options[:noop] = "NOOP #{}" else preview_changes if @options[:preview] are_you_sure?(:update) if @options[:change_set] # defaults to this << " via change set: #{plan.change_set_name}" change_set_update else standard_update(params) end end puts unless @options[:mute] || error end |