summaryrefslogtreecommitdiffstats
path: root/spec/unit/configurer
diff options
context:
space:
mode:
authorNick Lewis <nick@puppetlabs.com>2011-06-02 16:24:16 -0700
committerNick Lewis <nick@puppetlabs.com>2011-06-06 15:49:38 -0700
commit1c70f0ce54022b55119b9e2d6d60cd1ae9bc019e (patch)
tree35a7c2372773859c688cc4778a7c5507221553fa /spec/unit/configurer
parentc629958fb45f9ae3581f01835bf89654dd7967b7 (diff)
downloadpuppet-1c70f0ce54022b55119b9e2d6d60cd1ae9bc019e.tar.gz
puppet-1c70f0ce54022b55119b9e2d6d60cd1ae9bc019e.tar.xz
puppet-1c70f0ce54022b55119b9e2d6d60cd1ae9bc019e.zip
(#2128) Add support for setting node name based on a fact
This adds the node_name_fact setting, which specifies a fact to use to determine the node name. This allows dynamically determining the node name without having to modify puppet.conf or command line options. Using this setting requires modifying auth.conf to allow nodes to request catalogs not matching their certnames. For example, this would allow any authenticated node to retrieve any catalog: # $confdir/auth.conf path ~ /catalog/.+ allow * The node_name_fact and node_name_value options are mutually exclusive, because it is ambiguous which setting should take precedence. Paired-With: Jacob Helwig <jacob@puppetlabs.com>
Diffstat (limited to 'spec/unit/configurer')
-rwxr-xr-xspec/unit/configurer/fact_handler_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/unit/configurer/fact_handler_spec.rb b/spec/unit/configurer/fact_handler_spec.rb
index ddb541174..ced743ea6 100755
--- a/spec/unit/configurer/fact_handler_spec.rb
+++ b/spec/unit/configurer/fact_handler_spec.rb
@@ -61,6 +61,22 @@ describe Puppet::Configurer::FactHandler do
@facthandler.find_facts.should == bar_facts
end
+ it "should set the facts name based on the node_name_fact" do
+ Puppet::Node::Facts.new(Puppet[:node_name_value], 'my_name_fact' => 'other_node_name').save
+ Puppet[:node_name_fact] = 'my_name_fact'
+
+ @facthandler.find_facts.name.should == 'other_node_name'
+ end
+
+ it "should set the node_name_value based on the node_name_fact" do
+ Puppet::Node::Facts.new(Puppet[:node_name_value], 'my_name_fact' => 'other_node_name').save
+ Puppet[:node_name_fact] = 'my_name_fact'
+
+ @facthandler.find_facts
+
+ Puppet[:node_name_value].should == 'other_node_name'
+ end
+
it "should reload Facter before finding facts" do
@facthandler.expects(:reload_facter)