Sha256: ec86f040870e0e21e9a6cffcd801e9c28d8d21e060b553d60f82be545ebe3e56

Contents?: true

Size: 787 Bytes

Versions: 188

Compression:

Stored size: 787 Bytes

Contents

# The important methods in this class are stack_type, s3_bucket and first_run?
# We use stack_type and s3_bucket to get info for both the build and deploy CLI
# commands.
# first_run? will always make an API call.
module Jets::Commands::StackInfo
  include Jets::AwsServices

  def stack_type
    first_run? ? :minimal : :full
  end

  def s3_bucket
    return @s3_bucket if @s3_bucket

    return nil if first_run?

    resp = cfn.describe_stacks(stack_name: parent_stack_name)
    output = resp.stacks[0].outputs.find {|o| o.output_key == 'S3Bucket'}
    @s3_bucket = output.output_value # once an s3 bucket is found, cache it
  end

  # Always call API
  def first_run?
    !stack_exists?(parent_stack_name)
  end

  def parent_stack_name
    Jets::Naming.parent_stack_name
  end
end

Version data entries

188 entries across 188 versions & 3 rubygems

Version Path
jets-2.0.0 lib/jets/commands/stack_info.rb
jets-1.9.32 lib/jets/commands/stack_info.rb
jets-1.9.31 lib/jets/commands/stack_info.rb
jets-1.9.30 lib/jets/commands/stack_info.rb
jets-1.9.29 lib/jets/commands/stack_info.rb
jets-1.9.28 lib/jets/commands/stack_info.rb
jets-1.9.27 lib/jets/commands/stack_info.rb
jets-1.9.26 lib/jets/commands/stack_info.rb
jets-1.9.25 lib/jets/commands/stack_info.rb
jets-1.9.24 lib/jets/commands/stack_info.rb
jets-1.9.23 lib/jets/commands/stack_info.rb
jets-1.9.22 lib/jets/commands/stack_info.rb
jets-1.9.21 lib/jets/commands/stack_info.rb
jets-1.9.20 lib/jets/commands/stack_info.rb
jets-1.9.19 lib/jets/commands/stack_info.rb
jets-1.9.18 lib/jets/commands/stack_info.rb
jets-1.9.17 lib/jets/commands/stack_info.rb
jets-1.9.16 lib/jets/commands/stack_info.rb
jets-1.9.15 lib/jets/commands/stack_info.rb
jets-1.9.14 lib/jets/commands/stack_info.rb