Sha256: 05255213b5d79f2c58008af56a7934ed563eebf3f1fe877022d72275c23cef3c

Contents?: true

Size: 927 Bytes

Versions: 20

Compression:

Stored size: 927 Bytes

Contents

require 'onceover/controlrepo'

class Onceover
  class Node
    @@all = []


    attr_accessor :name
    attr_accessor :beaker_node
    attr_accessor :fact_set

    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
        @fact_set = Onceover::Controlrepo.facts[Onceover::Controlrepo.facts_files.index{|facts_file| File.basename(facts_file,'.json') == name}]
      rescue TypeError
        @fact_set = nil
      end
      @@all << self

    end

    def self.find(node_name)
      @@all.each do |node|
        if node_name.is_a?(Onceover::Node)
          if node = node_name
            return node
          end
        elsif node.name == node_name
          return node
        end
      end
      logger.warn "Node #{node_name} not found"
      nil
    end

    def self.all
      @@all
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
onceover-3.2.5 lib/onceover/node.rb
onceover-3.2.4 lib/onceover/node.rb
onceover-3.2.3 lib/onceover/node.rb
onceover-3.2.2 lib/onceover/node.rb
onceover-3.2.1 lib/onceover/node.rb
onceover-3.2.0 lib/onceover/node.rb
onceover-3.1.1 lib/onceover/node.rb
onceover-3.1.0 lib/onceover/node.rb
onceover-3.0.11 lib/onceover/node.rb
onceover-3.0.10 lib/onceover/node.rb
onceover-3.0.9 lib/onceover/node.rb
onceover-3.0.8 lib/onceover/node.rb
onceover-3.0.7 lib/onceover/node.rb
onceover-3.0.6 lib/onceover/node.rb
onceover-3.0.5 lib/onceover/node.rb
onceover-3.0.4 lib/onceover/node.rb
onceover-3.0.3 lib/onceover/node.rb
onceover-3.0.2 lib/onceover/node.rb
onceover-3.0.1 lib/onceover/node.rb
onceover-3.0.0 lib/onceover/node.rb