Method: Onceover::Node#initialize

Defined in:
lib/onceover/node.rb

#initialize(name) ⇒ Node

Returns a new instance of Node.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/onceover/node.rb', line 13

def initialize(name)
  @name = name
  @beaker_node = nil

  # If we can't find the factset it will fail, so just catch that error and ignore it
  begin
    facts_file_index = Onceover::Controlrepo.facts_files.index {|facts_file|
      File.basename(facts_file, '.json') == name
    }
    @fact_set = Onceover::Controlrepo.facts[facts_file_index]
    @trusted_set = Onceover::Controlrepo.trusted_facts[facts_file_index]
  rescue TypeError
    @fact_set = nil
    @trusted_set = nil
  end

  @@all << self

end