Method: RSpecSystem::Node#initialize

Defined in:
lib/rspec-system/node.rb

#initialize(options) ⇒ Node

Create a new node object.

Parameters:

  • options (Hash)

    options for new node

Options Hash (options):

  • :name (String)

    name of node. Mandatory.

  • :prefab (String)

    prefab setting. Mandatory.

  • :nodeset (RSpecSystem::NodeSet)

    the parent nodeset for this node. Mandatory.

  • :custom_prefabs_path (String)

    path of custom prefabs yaml file. Optional.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/rspec-system/node.rb', line 34

def initialize(options)
  @name = options[:name]
  prefab = options[:prefab]
  @nodeset = options[:nodeset]
  @custom_prefabs_path = options[:custom_prefabs_path]

  if prefab.nil?
    # TODO: do not support not prefabs yet
    raise "No prefab defined, bailing"
  else
    @prefab = RSpecSystem::Prefab.prefab(prefab, custom_prefabs_path)
    @facts = @prefab.facts
    @provider_specifics = @prefab.provider_specifics
  end
end