With the new 'strict_hostname_checking' option enabled, the compiler will only search for the literal certificate name in its list of nodes.
Signed-off-by: Luke Kanies <[email protected]> --- lib/puppet/defaults.rb | 5 ++++- lib/puppet/node.rb | 4 ++++ spec/unit/node.rb | 9 +++++++++ 3 files changed, 17 insertions(+), 1 deletions(-) diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index fcd4346..9ec26ed 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -416,7 +416,10 @@ module Puppet }, :rrdgraph => [false, "Whether RRD information should be graphed."], :rrdinterval => ["$runinterval", "How often RRD should expect data. - This should match how often the hosts report back to the server."] + This should match how often the hosts report back to the server."], + :strict_hostname_checking => [false, "Whether to only search for the complete + hostname as it is in the certificate when searching for node information + in the catalogs."] ) self.setdefaults(:puppetd, diff --git a/lib/puppet/node.rb b/lib/puppet/node.rb index 5782c14..263aaf6 100644 --- a/lib/puppet/node.rb +++ b/lib/puppet/node.rb @@ -79,6 +79,10 @@ class Puppet::Node # Calculate the list of names we might use for looking # up our node. This is only used for AST nodes. def names + if Puppet.settings[:strict_hostname_checking] + return [name] + end + names = [] # First, get the fqdn diff --git a/spec/unit/node.rb b/spec/unit/node.rb index 99c53e0..fb7d363 100755 --- a/spec/unit/node.rb +++ b/spec/unit/node.rb @@ -168,16 +168,25 @@ describe Puppet::Node, "when generating the list of names to search through" do describe "and :node_name is set to 'cert'" do before do + Puppet.settings.stubs(:value).with(:strict_hostname_checking).returns false Puppet.settings.stubs(:value).with(:node_name).returns "cert" end it "should use the passed-in key as the first value" do @node.names[0].should == "foo.domain.com" end + + describe "and strict hostname checking is enabled" do + it "should only use the passed-in key" do + Puppet.settings.expects(:value).with(:strict_hostname_checking).returns true + @node.names.should == ["foo.domain.com"] + end + end end describe "and :node_name is set to 'facter'" do before do + Puppet.settings.stubs(:value).with(:strict_hostname_checking).returns false Puppet.settings.stubs(:value).with(:node_name).returns "facter" end -- 1.6.1 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
