From ec478da93a03d0a9c5cd7b782d86deea6d3b4a8b Mon Sep 17 00:00:00 2001 From: Brice Figureau Date: Wed, 22 Apr 2009 19:30:09 +0200 Subject: Fix configurer to retrieve catalog with client certname Rationale: Before this change, the catalog was retrived with this uri: /catalog/hostname On the server side, the corresponding node was found by using the request node, then finding if this node also match hostname (which it does of course). But it is not possible to have an ACL matching the hostname part of the uri, because it: * it would be compared to the node name (certname), which obviously is not the same * it is not possible to create a dynamic allow/deny rule on a non-fqdn Signed-off-by: Brice Figureau --- lib/puppet/configurer.rb | 2 +- spec/unit/configurer.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/puppet/configurer.rb b/lib/puppet/configurer.rb index b74456de4..d9f207143 100644 --- a/lib/puppet/configurer.rb +++ b/lib/puppet/configurer.rb @@ -79,7 +79,7 @@ class Puppet::Configurer # Get the remote catalog, yo. Returns nil if no catalog can be found. def retrieve_catalog - name = Facter.value("hostname") + name = Puppet[:certname] catalog_class = Puppet::Resource::Catalog # This is a bit complicated. We need the serialized and escaped facts, diff --git a/spec/unit/configurer.rb b/spec/unit/configurer.rb index 712cbf715..fcc124d8e 100755 --- a/spec/unit/configurer.rb +++ b/spec/unit/configurer.rb @@ -84,10 +84,10 @@ describe Puppet::Configurer, "when retrieving a catalog" do @agent.retrieve_catalog end - it "should use its Facter name to retrieve the catalog" do + it "should use its certname to retrieve the catalog" do Facter.stubs(:value).returns "eh" - Facter.expects(:value).with("hostname").returns "myhost" - Puppet::Resource::Catalog.expects(:find).with { |name, options| name == "myhost" }.returns @catalog + Puppet.expects(:[]).with(:certname).returns "myhost.domain.com" + Puppet::Resource::Catalog.expects(:find).with { |name, options| name == "myhost.domain.com" }.returns @catalog @agent.retrieve_catalog end -- cgit