Class: Lono::Sets::Update
- Inherits:
-
Base
- Object
- AbstractBase
- Cfn::Base
- Base
- Lono::Sets::Update
- Includes:
- Summarize
- Defined in:
- lib/lono/sets/update.rb
Instance Method Summary collapse
- #codediff_preview ⇒ Object
- #long_desc ⇒ Object
- #param_preview ⇒ Object
- #save ⇒ Object
- #stack_instances ⇒ Object
Methods included from Summarize
Methods inherited from Base
#build_options, #exit_unless_updatable!, #initialize, #operation_preferences, #run
Methods inherited from Cfn::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::Sets::Base
Instance Method Details
#codediff_preview ⇒ Object
71 72 73 |
# File 'lib/lono/sets/update.rb', line 71 def codediff_preview Lono::Sets::Preview::Codediff.new(.merge(mute_params: true, mute_using: true)) end |
#long_desc ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/lono/sets/update.rb', line 56 def long_desc info = stack_instances.inject({}) do |result, instance| result[instance.account] ||= [] result[instance.account] << instance.region result end = "Will deploy to:\n" info.each do |account, regions| << " account: #{account}\n" << " regions: #{regions.join(",")}\n" end << "\nNumber of stack instances to be updated: #{stack_instances.size}" end |
#param_preview ⇒ Object
76 77 78 |
# File 'lib/lono/sets/update.rb', line 76 def param_preview Lono::Sets::Preview::Param.new() end |
#save ⇒ Object
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 41 42 43 44 45 46 47 48 49 |
# File 'lib/lono/sets/update.rb', line 5 def save = "Updating #{@stack} stack set" if [:noop] puts "NOOP #{message}" return end unless stack_set_exists?(@stack) puts "ERROR: Cannot update a stack set because #{@stack} does not exists.".color(:red) return end exit_unless_updatable! param_preview.run if [:param_preview] codediff_preview.run if [:codediff_preview] # changeset preview not supported for stack sets = (, "cfn.update_stack_set") if stack_instances.empty? puts " NOTE: There are 0 stack instances associated with the \#{@stack} stack set.\n Will update the stack set template but there no instances to be updated.\n Add `configs/\#{@blueprint}/accounts` and `configs/\#{@blueprint}/regions` settings\n and use `lono sets instances sync` to add stack instances.\n EOL\n else\n sure?(\"Are you sure you want to update the \#{@stack} stack set?\", long_desc)\n end\n\n resp = cfn.update_stack_set(options)\n operation_id = resp[:operation_id]\n puts message unless @options[:mute]\n\n return true if @options[:noop] || !@options[:wait]\n\n Lono::Sets::Status::Instance::Base.show_time_progress = true\n Lono::Sets::Status::Instance::Base.delay_factor = stack_instances.size\n status = Status.new(@options.merge(operation_id: operation_id))\n success = status.wait\n summarize(operation_id)\n exit 1 unless success\n success\nend\n" |
#stack_instances ⇒ Object
51 52 53 |
# File 'lib/lono/sets/update.rb', line 51 def stack_instances Lono::Sets::Status::Instances.new().stack_instances end |