diff options
author | Luke Kanies <luke@madstop.com> | 2007-12-11 14:31:13 -0600 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2007-12-11 14:31:13 -0600 |
commit | 7ac3bd79621f6c66cd3b5b7041aeba83c27c3602 (patch) | |
tree | f0683599b09bb25e885f1f73bbf21e5b3275abe0 | |
parent | a21ee0059fbfc31988430e7e6bf0d102cb6f1d5a (diff) | |
download | puppet-7ac3bd79621f6c66cd3b5b7041aeba83c27c3602.tar.gz puppet-7ac3bd79621f6c66cd3b5b7041aeba83c27c3602.tar.xz puppet-7ac3bd79621f6c66cd3b5b7041aeba83c27c3602.zip |
Renaming the 'null' terminus type to 'plain', as
requested in #960.
-rw-r--r-- | lib/puppet/defaults.rb | 2 | ||||
-rw-r--r-- | lib/puppet/indirector/node/null.rb | 18 | ||||
-rw-r--r-- | lib/puppet/indirector/node/plain.rb | 19 | ||||
-rw-r--r-- | lib/puppet/indirector/plain.rb (renamed from lib/puppet/indirector/null.rb) | 2 | ||||
-rwxr-xr-x | spec/unit/indirector/node/plain.rb (renamed from spec/unit/indirector/node/null.rb) | 6 | ||||
-rwxr-xr-x | spec/unit/indirector/plain.rb (renamed from spec/unit/indirector/null.rb) | 8 | ||||
-rwxr-xr-x | spec/unit/node.rb | 4 |
7 files changed, 30 insertions, 29 deletions
diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index c5902cea9..ff3e70247 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -153,7 +153,7 @@ module Puppet but then ship with tools that do not know how to handle signed ints, so the UIDs show up as huge numbers that can then not be fed back into the system. This is a hackish way to fail in a slightly more useful way when that happens."], - :node_terminus => ["null", "Where to find information about nodes."] + :node_terminus => ["plain", "Where to find information about nodes."] ) hostname = Facter["hostname"].value diff --git a/lib/puppet/indirector/node/null.rb b/lib/puppet/indirector/node/null.rb deleted file mode 100644 index f7c4d25ea..000000000 --- a/lib/puppet/indirector/node/null.rb +++ /dev/null @@ -1,18 +0,0 @@ -require 'puppet/node' -require 'puppet/indirector/null' - -class Puppet::Node::Null < Puppet::Indirector::Null - desc "Always return an empty node object. This is the node source you should - use 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 -end diff --git a/lib/puppet/indirector/node/plain.rb b/lib/puppet/indirector/node/plain.rb new file mode 100644 index 000000000..d60cc3aa5 --- /dev/null +++ b/lib/puppet/indirector/node/plain.rb @@ -0,0 +1,19 @@ +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 +end diff --git a/lib/puppet/indirector/null.rb b/lib/puppet/indirector/plain.rb index db2b1db1c..8bdf8469c 100644 --- a/lib/puppet/indirector/null.rb +++ b/lib/puppet/indirector/plain.rb @@ -1,7 +1,7 @@ require 'puppet/indirector/terminus' # An empty terminus type, meant to just return empty objects. -class Puppet::Indirector::Null < Puppet::Indirector::Terminus +class Puppet::Indirector::Plain < Puppet::Indirector::Terminus # Just return nothing. def find(name) indirection.model.new(name) diff --git a/spec/unit/indirector/node/null.rb b/spec/unit/indirector/node/plain.rb index 8125e59a1..105d0ed63 100755 --- a/spec/unit/indirector/node/null.rb +++ b/spec/unit/indirector/node/plain.rb @@ -2,11 +2,11 @@ require File.dirname(__FILE__) + '/../../../spec_helper' -require 'puppet/indirector/node/null' +require 'puppet/indirector/node/plain' -describe Puppet::Node::Null do +describe Puppet::Node::Plain do before do - @searcher = Puppet::Node::Null.new + @searcher = Puppet::Node::Plain.new end it "should call node_merge() on the returned node" do diff --git a/spec/unit/indirector/null.rb b/spec/unit/indirector/plain.rb index fe3a382dc..1277739af 100755 --- a/spec/unit/indirector/null.rb +++ b/spec/unit/indirector/plain.rb @@ -1,22 +1,22 @@ #!/usr/bin/env ruby require File.dirname(__FILE__) + '/../../spec_helper' -require 'puppet/indirector/null' +require 'puppet/indirector/plain' -describe Puppet::Indirector::Null do +describe Puppet::Indirector::Plain do before do Puppet::Indirector::Terminus.stubs(:register_terminus_class) @model = mock 'model' @indirection = stub 'indirection', :name => :mystuff, :register_terminus_type => nil, :model => @model Puppet::Indirector::Indirection.stubs(:instance).returns(@indirection) - @null_class = Class.new(Puppet::Indirector::Null) do + @plain_class = Class.new(Puppet::Indirector::Plain) do def self.to_s "Mystuff::Testing" end end - @searcher = @null_class.new + @searcher = @plain_class.new end it "should return return an instance of the indirected model" do diff --git a/spec/unit/node.rb b/spec/unit/node.rb index 8aea6ef0b..0ce702936 100755 --- a/spec/unit/node.rb +++ b/spec/unit/node.rb @@ -123,8 +123,8 @@ describe Puppet::Node, " when indirecting" do Puppet::Node.find(:my_node.to_s) end - it "should default to the 'null' node terminus" do - Puppet::Node.indirection.terminus_class.should == :null + it "should default to the 'plain' node terminus" do + Puppet::Node.indirection.terminus_class.should == :plain end after do |