Sha256: a5b90df7bc9fe26ff4ffb5777a8f289e955d3e1b53182890f64ba67be5af79ea

Contents?: true

Size: 765 Bytes

Versions: 6

Compression:

Stored size: 765 Bytes

Contents

require 'json'

module Stackster
  class StackUpdater

    def initialize(args)
      @config = args[:config]
      @entry = args[:entry]
      @name = args[:name]
      @template_body = args[:template_body]
      @cf = AWS::CloudFormation.new :config => @config
    end

    def update
      @cf.update :name => @name,
                 :parameters => read_parameters_from_entry,
                 :template => @template_body
    end

    def read_parameters_from_entry
      h = {}
      read_parameters_from_template.each do |p|
        h[p] = @entry.attributes[p] if @entry.attributes[p]
      end
      h
    end

    def read_parameters_from_template
      t = JSON.parse @template_body
      t['Paramaters'].nil? ? t['Parameters'].keys : []
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
stackster-0.1.3 lib/stackster/stack/stack_updater.rb
stackster-0.1.2 lib/stackster/stack/stack_updater.rb
stackster-0.1.1 lib/stackster/stack/stack_updater.rb
stackster-0.1.0 lib/stackster/stack/stack_updater.rb
stackster-0.0.5 lib/stackster/stack/stack_updater.rb
stackster-0.0.4 lib/stackster/stack/stack_updater.rb