diff options
| author | Luke Kanies <luke@madstop.com> | 2008-06-15 13:58:37 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2008-06-15 13:58:37 -0500 |
| commit | 1f19453dddf0f3a7822c21157f6f8d06c388cdb8 (patch) | |
| tree | 758d40c4aa31021eaa40a849fe75d94ba1cbc010 | |
| parent | 51e1ba8c02f1bd9085ef15138c4828accbb29dec (diff) | |
Removing the Node.find_by_name method.
We just use the regular Node.find method now, since
the nodes don't need to do any magical naming.
| -rw-r--r-- | lib/puppet/indirector/catalog/compiler.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/node.rb | 7 | ||||
| -rwxr-xr-x | spec/unit/indirector/catalog/compiler.rb | 22 |
3 files changed, 8 insertions, 23 deletions
diff --git a/lib/puppet/indirector/catalog/compiler.rb b/lib/puppet/indirector/catalog/compiler.rb index 2b5e8d912..455a92cc7 100644 --- a/lib/puppet/indirector/catalog/compiler.rb +++ b/lib/puppet/indirector/catalog/compiler.rb @@ -89,7 +89,7 @@ class Puppet::Node::Catalog::Compiler < Puppet::Indirector::Code # key = client #end - return nil unless node = Puppet::Node.find_by_any_name(key) + return nil unless node = Puppet::Node.find(key) # Add any external data to the node. add_node_data(node) diff --git a/lib/puppet/node.rb b/lib/puppet/node.rb index 75b7197fd..14d0f6ac7 100644 --- a/lib/puppet/node.rb +++ b/lib/puppet/node.rb @@ -13,13 +13,6 @@ class Puppet::Node indirects :node, :terminus_setting => :node_terminus, :doc => "Where to find node information. A node is composed of its name, its facts, and its environment." - # Retrieve a node from the node source, with some additional munging - # thrown in for kicks. - def self.find_by_any_name(key) - return nil unless key - find(key) - end - attr_accessor :name, :classes, :parameters, :source, :ipaddress attr_reader :time diff --git a/spec/unit/indirector/catalog/compiler.rb b/spec/unit/indirector/catalog/compiler.rb index 083a9ced5..cf7186a5a 100755 --- a/spec/unit/indirector/catalog/compiler.rb +++ b/spec/unit/indirector/catalog/compiler.rb @@ -23,8 +23,8 @@ describe Puppet::Node::Catalog::Compiler do node1 = stub 'node1', :merge => nil node2 = stub 'node2', :merge => nil compiler.stubs(:compile) - Puppet::Node.stubs(:find_by_any_name).with('node1').returns(node1) - Puppet::Node.stubs(:find_by_any_name).with('node2').returns(node2) + Puppet::Node.stubs(:find).with('node1').returns(node1) + Puppet::Node.stubs(:find).with('node2').returns(node2) compiler.find(stub('request', :key => 'node1', :options => {})) compiler.find(stub('node2request', :key => 'node2', :options => {})) @@ -69,7 +69,7 @@ describe Puppet::Node::Catalog::Compiler, " when finding nodes" do it "should look node information up via the Node class with the provided key" do @node.stubs :merge - Puppet::Node.expects(:find_by_any_name).with(@name).returns(@node) + Puppet::Node.expects(:find).with(@name).returns(@node) @compiler.find(@request) end end @@ -77,7 +77,6 @@ end describe Puppet::Node::Catalog::Compiler, " after finding nodes" do before do Puppet.expects(:version).returns(1) - Puppet.settings.stubs(:value).with(:node_name).returns("cert") Facter.expects(:value).with('fqdn').returns("my.server.com") Facter.expects(:value).with('ipaddress').returns("my.ip.address") @compiler = Puppet::Node::Catalog::Compiler.new @@ -85,7 +84,7 @@ describe Puppet::Node::Catalog::Compiler, " after finding nodes" do @node = mock 'node' @request = stub 'request', :key => @name, :options => {} @compiler.stubs(:compile) - Puppet::Node.stubs(:find_by_any_name).with(@name).returns(@node) + Puppet::Node.stubs(:find).with(@name).returns(@node) end it "should add the server's Puppet version to the node's parameters as 'serverversion'" do @@ -102,13 +101,6 @@ describe Puppet::Node::Catalog::Compiler, " after finding nodes" do @node.expects(:merge).with { |args| args["serverip"] == "my.ip.address" } @compiler.find(@request) end - - # LAK:TODO This is going to be difficult, because this whole process is so - # far removed from the actual connection that the certificate information - # will be quite hard to come by, dum by, gum by. - it "should search for the name using the client certificate's DN if the :node_name setting is set to 'cert'" do - pending "Probably will end up in the REST work" - end end describe Puppet::Node::Catalog::Compiler, " when creating catalogs" do @@ -122,18 +114,18 @@ describe Puppet::Node::Catalog::Compiler, " when creating catalogs" do @node = Puppet::Node.new @name @node.stubs(:merge) @request = stub 'request', :key => @name, :options => {} - Puppet::Node.stubs(:find_by_any_name).with(@name).returns(@node) + Puppet::Node.stubs(:find).with(@name).returns(@node) end it "should directly use provided nodes" do - Puppet::Node.expects(:find_by_any_name).never + Puppet::Node.expects(:find).never @compiler.interpreter.expects(:compile).with(@node) @request.stubs(:options).returns(:node => @node) @compiler.find(@request) end it "should fail if no node is passed and none can be found" do - Puppet::Node.stubs(:find_by_any_name).with(@name).returns(nil) + Puppet::Node.stubs(:find).with(@name).returns(nil) proc { @compiler.find(@request) }.should raise_error(ArgumentError) end |
