The problem was that the mechanism I was using for
passing the node to the compiler was conflicting with
the Indirector::Request's method of handling node
authentication.

Signed-off-by: Luke Kanies <[EMAIL PROTECTED]>
---
 bin/puppet                                |    2 +-
 lib/puppet/indirector/catalog/compiler.rb |    2 +-
 spec/integration/node/catalog.rb          |   10 ++++++++++
 spec/unit/indirector/catalog/compiler.rb  |    8 +++++---
 4 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/bin/puppet b/bin/puppet
index 5307668..0e64b1c 100755
--- a/bin/puppet
+++ b/bin/puppet
@@ -207,7 +207,7 @@ end
 
 begin
     # Compile our catalog
-    catalog = Puppet::Node::Catalog.find(node.name, :node => node)
+    catalog = Puppet::Node::Catalog.find(node.name, :use_node => node)
 
     # Translate it to a RAL catalog
     catalog = catalog.to_ral
diff --git a/lib/puppet/indirector/catalog/compiler.rb 
b/lib/puppet/indirector/catalog/compiler.rb
index 455a92c..a6a8128 100644
--- a/lib/puppet/indirector/catalog/compiler.rb
+++ b/lib/puppet/indirector/catalog/compiler.rb
@@ -14,7 +14,7 @@ class Puppet::Node::Catalog::Compiler < 
Puppet::Indirector::Code
 
     # Compile a node's catalog.
     def find(request)
-        unless node = request.options[:node] || find_node(request.key)
+        unless node = request.options[:use_node] || find_node(request.key)
             raise ArgumentError, "Could not find node '%s'; cannot compile" % 
request.key
         end
 
diff --git a/spec/integration/node/catalog.rb b/spec/integration/node/catalog.rb
index 1fa2afb..ed38ae9 100755
--- a/spec/integration/node/catalog.rb
+++ b/spec/integration/node/catalog.rb
@@ -40,5 +40,15 @@ describe Puppet::Node::Catalog do
 
             Puppet::Node::Catalog.find("me").should be_nil
         end
+
+        it "should pass provided node information directly to the terminus" do
+            terminus = mock 'terminus'
+
+            Puppet::Node::Catalog.indirection.stubs(:terminus).returns terminus
+
+            node = mock 'node'
+            terminus.expects(:find).with { |request| 
request.options[:use_node] == node }
+            Puppet::Node::Catalog.find("me", :use_node => node)
+        end
     end
 end
diff --git a/spec/unit/indirector/catalog/compiler.rb 
b/spec/unit/indirector/catalog/compiler.rb
index cf7186a..8cd3c72 100755
--- a/spec/unit/indirector/catalog/compiler.rb
+++ b/spec/unit/indirector/catalog/compiler.rb
@@ -114,13 +114,12 @@ 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).with(@name).returns(@node)
     end
 
     it "should directly use provided nodes" do
         Puppet::Node.expects(:find).never
-        @compiler.interpreter.expects(:compile).with(@node)
-        @request.stubs(:options).returns(:node => @node)
+        @compiler.expects(:compile).with(@node)
+        @request.stubs(:options).returns(:use_node => @node)
         @compiler.find(@request)
     end
 
@@ -130,12 +129,14 @@ describe Puppet::Node::Catalog::Compiler, " when creating 
catalogs" do
     end
 
     it "should pass the found node to the interpreter for compiling" do
+        Puppet::Node.expects(:find).with(@name).returns(@node)
         config = mock 'config'
         @compiler.interpreter.expects(:compile).with(@node)
         @compiler.find(@request)
     end
 
     it "should return the results of compiling as the catalog" do
+        Puppet::Node.stubs(:find).returns(@node)
         config = mock 'config'
         result = mock 'result'
 
@@ -144,6 +145,7 @@ describe Puppet::Node::Catalog::Compiler, " when creating 
catalogs" do
     end
 
     it "should benchmark the compile process" do
+        Puppet::Node.stubs(:find).returns(@node)
         @compiler.stubs(:networked?).returns(true)
         @compiler.expects(:benchmark).with do |level, message|
             level == :notice and message =~ /^Compiled catalog/
-- 
1.5.3.7


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to