Sha256: d9b218345a3b4c7872f4d1635426b49684e5ed9d5fd45134a321d304767ce9a0

Contents?: true

Size: 1.56 KB

Versions: 11

Compression:

Stored size: 1.56 KB

Contents

class Lono::Sets
  class Base < Lono::Cfn::Base
    def initialize(options={})
      options[:iam] = true # easy to forget the --iam option. Default to turning it on for StackSets
      super
    end

    def run
      generate_all
      save
    end

    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

    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

    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
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
lono-7.5.2 lib/lono/sets/base.rb
lono-7.5.1 lib/lono/sets/base.rb
lono-7.5.0 lib/lono/sets/base.rb
lono-7.4.11 lib/lono/sets/base.rb
lono-7.4.10 lib/lono/sets/base.rb
lono-7.4.9 lib/lono/sets/base.rb
lono-7.4.8 lib/lono/sets/base.rb
lono-7.4.7 lib/lono/sets/base.rb
lono-7.4.6 lib/lono/sets/base.rb
lono-7.4.5 lib/lono/sets/base.rb
lono-7.4.4 lib/lono/sets/base.rb