Class: Lono::Cfn::Update
- Inherits:
-
Base
- Object
- AbstractBase
- Base
- Lono::Cfn::Update
- Defined in:
- lib/lono/cfn/update.rb
Instance Method Summary collapse
- #codediff_preview ⇒ Object
- #param_preview ⇒ Object
-
#save(parameters) ⇒ Object
save is the interface method aws cloudformation update-stack –stack-name prod-hi-123456789 –parameters file://output/params/prod-hi-123456789.json –template-body file://output/prod-hi.json.
- #standard_update(parameters) ⇒ Object
Methods inherited from Base
#capabilities, #command_with_iam, #continue_update_rollback, #continue_update_rollback_sure?, #delete_rollback_stack, #exit_unless_updatable!, #generate_all, #notification_arns, #pretty_path, #prompt_for_iam, #quit, #rerun_with_iam?, #run, #set_template_url!, #show_options, #stack_status, #starting_message, #status, #tags
Methods included from Utils::Sure
Methods included from AwsServices
#cfn, #ec2, #iam, #s3, #s3_presigner, #s3_resource, #sts
Methods included from AwsServices::Helper
#rollback_complete?, #testing_update?
Methods included from AwsServices::StackSet
#find_stack_set, #stack_set_exists?
Methods included from AwsServices::Stack
Methods inherited from AbstractBase
#initialize, #reinitialize, #template_path
Methods included from Blueprint::Root
#find_blueprint_root, #set_blueprint_root
Constructor Details
This class inherits a constructor from Lono::AbstractBase
Instance Method Details
#codediff_preview ⇒ Object
61 62 63 |
# File 'lib/lono/cfn/update.rb', line 61 def codediff_preview Lono::Cfn::Preview::Codediff.new(.merge(mute_params: true, mute_using: true)) end |
#param_preview ⇒ Object
66 67 68 |
# File 'lib/lono/cfn/update.rb', line 66 def param_preview Lono::Cfn::Preview::Param.new() end |
#save(parameters) ⇒ Object
save is the interface method aws cloudformation update-stack –stack-name prod-hi-123456789 –parameters file://output/params/prod-hi-123456789.json –template-body file://output/prod-hi.json
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/lono/cfn/update.rb', line 5 def save(parameters) = "Updating #{@stack} stack" if [:noop] puts "NOOP #{message}" return end deleted = delete_rollback_stack if deleted Create.new().save(parameters) return end unless stack_exists?(@stack) puts "Cannot update a stack because the #{@stack} does not exists." return end exit_unless_updatable! = .merge(mute_params: true, mute_using: true, keep: true) # create new copy of preview when update_stack is called because of IAM retry logic changeset_preview = Lono::Cfn::Preview::Changeset.new() param_preview.run if [:param_preview] codediff_preview.run if [:codediff_preview] changeset_preview.run if [:changeset_preview] sure?("Are you sure you want to update the #{@stack} stack?") if [:change_set] # defaults to this << " via change set: #{changeset_preview.change_set_name}" changeset_preview.execute_change_set else standard_update(parameters) end puts unless [:mute] end |
#standard_update(parameters) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/lono/cfn/update.rb', line 42 def standard_update(parameters) = { stack_name: @stack, parameters: parameters, capabilities: capabilities, # ["CAPABILITY_IAM", "CAPABILITY_NAMED_IAM"] disable_rollback: ![:rollback], } [:notification_arns] = notification_arns if notification_arns [:tags] = unless .empty? set_template_url!() (, "cfn.update_stack") begin cfn.update_stack() rescue Aws::CloudFormation::Errors::ValidationError => e puts "ERROR: #{e.message}".color(:red) false end end |