Sha256: bcc440b17e66c4e98e62c2cee10c306cbff07986ea2debe5461043d489ef60a9

Contents?: true

Size: 844 Bytes

Versions: 54

Compression:

Stored size: 844 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?
    return "fake-bucket" if ENV['JETS_BUILD_NO_INTERNET']

    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

54 entries across 54 versions & 2 rubygems

Version Path
jets-3.2.2 lib/jets/commands/stack_info.rb
jets-3.2.1 lib/jets/commands/stack_info.rb
jets.benforeva-3.0.17.pre.mount.pre.fix lib/jets/commands/stack_info.rb
jets-3.2.0 lib/jets/commands/stack_info.rb
jets-3.1.5 lib/jets/commands/stack_info.rb
jets-3.1.4 lib/jets/commands/stack_info.rb
jets-3.1.3 lib/jets/commands/stack_info.rb
jets-3.1.2 lib/jets/commands/stack_info.rb
jets-3.1.1 lib/jets/commands/stack_info.rb
jets-3.1.0 lib/jets/commands/stack_info.rb
jets-3.0.23 lib/jets/commands/stack_info.rb
jets-3.0.22 lib/jets/commands/stack_info.rb
jets-3.0.21 lib/jets/commands/stack_info.rb
jets-3.0.20 lib/jets/commands/stack_info.rb
jets-3.0.19 lib/jets/commands/stack_info.rb
jets-3.0.18 lib/jets/commands/stack_info.rb
jets-3.0.17 lib/jets/commands/stack_info.rb
jets-3.0.16 lib/jets/commands/stack_info.rb
jets-3.0.15 lib/jets/commands/stack_info.rb
jets-3.0.14 lib/jets/commands/stack_info.rb