summaryrefslogtreecommitdiffstats
path: root/lib/puppet/indirector/node/plain.rb
blob: 8058563e6e91a50fc631dfa1600f2bbd6b0b8e1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
require 'puppet/node'
require 'puppet/indirector/plain'

class Puppet::Node::Plain < Puppet::Indirector::Plain
    desc "Always return an empty node object. Assumes you keep track of nodes
        in flat file manifests.  You should use it when you don't have some other,
        functional source you want to use, as the compiler will not work without a
        valid node terminus.

        Note that class is responsible for merging the node's facts into the
        node instance before it is returned."

    # Just return an empty node.
    def find(name)
        node = super
        node.fact_merge
        node
    end

    # Use the version of the facts, since we assume that's the main thing
    # that changes.  If someone wants their own way of defining version,
    # they can easily provide their own, um, version of this class.
    def version(name)
        Puppet::Node::Facts.version(name)
    end
end