Class: Lono::Sets::Base
- Inherits:
-
Cfn::Base
- Object
- AbstractBase
- Cfn::Base
- Lono::Sets::Base
- Defined in:
- lib/lono/sets/base.rb
Direct Known Subclasses
Instance Method Summary collapse
- #build_options ⇒ Object
- #exit_unless_updatable! ⇒ Object
-
#initialize(options = {}) ⇒ Base
constructor
A new instance of Base.
- #operation_preferences ⇒ Object
- #run ⇒ Object
Methods inherited from Cfn::Base
#capabilities, #command_with_iam, #continue_update_rollback, #continue_update_rollback_sure?, #delete_rollback_stack, #generate_all, #notification_arns, #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
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
Methods included from Blueprint::Root
#find_blueprint_root, #set_blueprint_root
Constructor Details
#initialize(options = {}) ⇒ Base
Returns a new instance of Base.
3 4 5 6 |
# File 'lib/lono/sets/base.rb', line 3 def initialize(={}) [:iam] = true # easy to forget the --iam option. Default to turning it on for StackSets super end |
Instance Method Details
#build_options ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/lono/sets/base.rb', line 26 def parameters = generate_all = { stack_set_name: @stack, parameters: parameters, capabilities: capabilities, # ["CAPABILITY_IAM", "CAPABILITY_NAMED_IAM"] } [:tags] = unless .empty? [:operation_preferences] = operation_preferences unless operation_preferences.empty? .reject! {|k, v| v.nil? } set_template_url!() end |
#exit_unless_updatable! ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/lono/sets/base.rb', line 13 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_preferences ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/lono/sets/base.rb', line 40 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 |
#run ⇒ Object
8 9 10 11 |
# File 'lib/lono/sets/base.rb', line 8 def run generate_all save end |