Module: Sfn::MonkeyPatch::Stack::Google::PretendStack

Defined in:
lib/sfn/monkey_patch/stack/google.rb

Overview

Helper module to allow nested stack behavior to function as expected internally within sfn

Instance Method Summary collapse

Instance Method Details

#eventsObject

Sub-stacks never provide events



36
37
38
39
40
# File 'lib/sfn/monkey_patch/stack/google.rb', line 36

def events
  collection = Miasma::Models::Orchestration::Stack::Events.new(self)
  collection.define_singleton_method(:perform_population) { [] }
  collection
end

#perform_template_loadObject

disable template load



19
20
21
# File 'lib/sfn/monkey_patch/stack/google.rb', line 19

def perform_template_load
  Smash.new
end

#reloadObject

disable reload



14
15
16
# File 'lib/sfn/monkey_patch/stack/google.rb', line 14

def reload
  self
end

#resourcesObject

only show resources associated to this stack



24
25
26
27
28
29
30
31
32
33
# File 'lib/sfn/monkey_patch/stack/google.rb', line 24

def resources
  collection = Miasma::Models::Orchestration::Stack::Resources.new(self)
  collection.define_singleton_method(:perform_population) do
    valid = stack.sparkleish_template.fetch(:resources, {}).keys
    stack.custom[:resources].find_all { |r| valid.include?(r[:name]) }.map do |attrs|
      Miasma::Models::Orchestration::Stack::Resource.new(stack, attrs).valid_state
    end
  end
  collection
end