Class: Furnish::Provisioner::Dummy
- Defined in:
- lib/furnish/provisioners/dummy.rb
Overview
Primarily for testing, this is a provisioner that has a basic storage model.
In short, unless you’re writing tests you should probably never use this code.
Instance Attribute Summary collapse
-
#id ⇒ Object
arbitrary identifier for Dummy#call_order.
-
#order ⇒ Object
readonly
order tracking via Palsy::List, delegation makes a breadcrumb here that’s ordered between all provisioners.
-
#store ⇒ Object
readonly
basic Palsy::Object store for stuffing random stuff.
Attributes inherited from API
Instance Method Summary collapse
-
#call_order ⇒ Object
call order is ordering on a per-provisioner group basis, and is used to validate that groups do indeed execute in the proper order.
-
#do_delegate(meth_name) ⇒ Object
Helper to trace calls to this provisioner.
-
#initialize ⇒ Dummy
constructor
Construct a Dummy.
-
#report ⇒ Object
report shim.
-
#run_state ⇒ Object
used in state transitions to capture run information.
-
#shutdown(args = { }) ⇒ Object
shutdown shim.
-
#startup(args = { }) ⇒ Object
startup shim.
Methods inherited from API
#==, allows_recovery, allows_recovery?, configure_shutdown, configure_startup, furnish_properties, furnish_property, #hash, inherited, #recover, shutdown_protocol, startup_protocol, #to_s
Constructor Details
#initialize ⇒ Dummy
Construct a Dummy.
30 31 32 33 |
# File 'lib/furnish/provisioners/dummy.rb', line 30 def initialize @store = Palsy::Object.new('dummy') @order = Palsy::List.new('dummy_order', 'shared') end |
Instance Attribute Details
#id ⇒ Object
arbitrary identifier for Dummy#call_order
25 26 27 |
# File 'lib/furnish/provisioners/dummy.rb', line 25 def id @id end |
#order ⇒ Object (readonly)
order tracking via Palsy::List, delegation makes a breadcrumb here that’s ordered between all provisioners.
22 23 24 |
# File 'lib/furnish/provisioners/dummy.rb', line 22 def order @order end |
#store ⇒ Object (readonly)
basic Palsy::Object store for stuffing random stuff
18 19 20 |
# File 'lib/furnish/provisioners/dummy.rb', line 18 def store @store end |
Instance Method Details
#call_order ⇒ Object
call order is ordering on a per-provisioner group basis, and is used to validate that groups do indeed execute in the proper order.
46 47 48 49 |
# File 'lib/furnish/provisioners/dummy.rb', line 46 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.
83 84 85 86 87 88 89 90 91 92 |
# File 'lib/furnish/provisioners/dummy.rb', line 83 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 |
#report ⇒ Object
report shim
54 55 56 57 58 |
# File 'lib/furnish/provisioners/dummy.rb', line 54 def report do_delegate(__method__) do [furnish_group_name, @persist] end end |
#run_state ⇒ Object
used in state transitions to capture run information
38 39 40 |
# File 'lib/furnish/provisioners/dummy.rb', line 38 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
73 74 75 76 77 |
# File 'lib/furnish/provisioners/dummy.rb', line 73 def shutdown(args={ }) do_delegate(__method__) do run_state[__method__] = args end end |
#startup(args = { }) ⇒ Object
startup shim
63 64 65 66 67 68 |
# File 'lib/furnish/provisioners/dummy.rb', line 63 def startup(args={ }) @persist = "floop" do_delegate(__method__) do run_state[__method__] = args end end |