Module: Furnish::Provisioner::DummyInclude

Included in:
Dummy, DummyVM
Defined in:
lib/furnish/provisioners/dummy_include.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idObject

arbitrary identifier for Dummy#call_order



18
19
20
# File 'lib/furnish/provisioners/dummy_include.rb', line 18

def id
  @id
end

#orderObject (readonly)

order tracking via Palsy::List, delegation makes a breadcrumb here that’s ordered between all provisioners.



15
16
17
# File 'lib/furnish/provisioners/dummy_include.rb', line 15

def order
  @order
end

#storeObject (readonly)

basic Palsy::Object store for stuffing random stuff



11
12
13
# File 'lib/furnish/provisioners/dummy_include.rb', line 11

def store
  @store
end

Instance Method Details

#call_orderObject

call order is ordering on a per-provisioner group basis, and is used to validate that groups do indeed execute in the proper order.



39
40
41
42
# File 'lib/furnish/provisioners/dummy_include.rb', line 39

def call_order
  # respond_to? here is to assist with deprecation tests
  @call_order ||= Palsy::List.new('dummy_order', respond_to?(:furnish_group_name) ? furnish_group_name : name)
end

#do_delegate(meth_name) ⇒ Object

Helper to trace calls to this provisioner. Pretty much everything we care about goes through here.



76
77
78
79
80
81
82
83
84
85
# File 'lib/furnish/provisioners/dummy_include.rb', line 76

def do_delegate(meth_name)
  meth_name = meth_name.to_s

  # indicate we actually did something
  @store[ [furnish_group_name, meth_name].join("-") ] = Time.now.to_i
  @order.push(furnish_group_name)
  call_order.push(id || "unknown")

  yield
end

#initializeObject

Construct a Dummy.



23
24
25
26
# File 'lib/furnish/provisioners/dummy_include.rb', line 23

def initialize
  @store = Palsy::Object.new('dummy')
  @order = Palsy::List.new('dummy_order', 'shared')
end

#make_logObject

Test the mixin functionality



90
91
92
93
94
# File 'lib/furnish/provisioners/dummy_include.rb', line 90

def make_log
  if_debug do
    puts "hello from Dummy"
  end
end

#reportObject

report shim



47
48
49
50
51
# File 'lib/furnish/provisioners/dummy_include.rb', line 47

def report
  do_delegate(__method__) do
    [furnish_group_name, @persist]
  end
end

#run_stateObject

used in state transitions to capture run information



31
32
33
# File 'lib/furnish/provisioners/dummy_include.rb', line 31

def run_state
  @run_state ||= Palsy::Map.new('dummy_run_state', [self.class.name, respond_to?(:furnish_group_name) ? furnish_group_name : name].join("-"))
end

#shutdown(args = { }) ⇒ Object

shutdown shim



66
67
68
69
70
# File 'lib/furnish/provisioners/dummy_include.rb', line 66

def shutdown(args={ })
  do_delegate(__method__) do
    run_state[__method__] = args
  end
end

#startup(args = { }) ⇒ Object

startup shim



56
57
58
59
60
61
# File 'lib/furnish/provisioners/dummy_include.rb', line 56

def startup(args={ })
  @persist = "floop"
  do_delegate(__method__) do
    run_state[__method__] = args
  end
end