Class: Lono::Sets::Base

Inherits:
Cfn::Base show all
Defined in:
lib/lono/sets/base.rb

Direct Known Subclasses

Create, Deploy, Instances::Base, Preview::Codediff, Update

Instance Method Summary collapse

Methods inherited from Cfn::Base

#capabilities, #check_registration, #command_with_iam, #continue_update_rollback, #continue_update_rollback_sure?, #delete_rollback_stack, #generate_all, #pretty_path, #prompt_for_iam, #quit, #rerun_with_iam?, #set_template_url!, #show_options, #stack_status, #starting_message, #status, #tags

Methods included from Utils::Sure

#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

#find_stack, #stack_exists?

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

#build_optionsObject



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/lono/sets/base.rb', line 21

def build_options
  parameters = generate_all
  options = {
    stack_set_name: @stack,
    parameters: parameters,
    capabilities: capabilities, # ["CAPABILITY_IAM", "CAPABILITY_NAMED_IAM"]
  }
  options[:tags] = tags unless tags.empty?
  options[:operation_preferences] = operation_preferences unless operation_preferences.empty?
  options.reject! {|k, v| v.nil? }
  set_template_url!(options)
  options
end

#exit_unless_updatable!Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/lono/sets/base.rb', line 8

def exit_unless_updatable!
  return true if ENV['LONO_ENV']
  return false if @options[:noop]

  status = Status.new(@options) # using status for completed?
  return if status.stack_instances.empty?
  completed = status.completed?(status.stack_set_status)
  unless completed
    puts "Cannot update stack set because #{@stack} is not in an updatable state.  Stack set status: #{status.stack_set_status}".color(:red)
    quit(1)
  end
end

#operation_preferencesObject



35
36
37
38
39
40
41
42
43
# File 'lib/lono/sets/base.rb', line 35

def operation_preferences
  o = {}
  o[:failure_tolerance_count] = @options[:failure_tolerance_count]
  o[:failure_tolerance_percentage] = @options[:failure_tolerance_percentage]
  o[:max_concurrent_count] = @options[:max_concurrent_count]
  o[:max_concurrent_percentage] = @options[:max_concurrent_percentage]
  o.reject! {|k, v| v.nil? }
  o
end

#runObject



3
4
5
6
# File 'lib/lono/sets/base.rb', line 3

def run
  generate_all
  save
end