summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/puppet/defaults.rb4
-rw-r--r--lib/puppet/network/handler/master.rb2
-rwxr-xr-xtest/network/handler/master.rb11
3 files changed, 13 insertions, 4 deletions
diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb
index e0225803a..407a47d07 100644
--- a/lib/puppet/defaults.rb
+++ b/lib/puppet/defaults.rb
@@ -327,8 +327,8 @@ module Puppet
:masterport => [8140, "Which port puppetmasterd listens on."],
:parseonly => [false, "Just check the syntax of the manifests."],
:node_name => ["cert", "How the puppetmaster determines the client's identity
- and sets the 'hostname' fact for use in the manifest, in particular
- for determining which 'node' statement applies to the client.
+ and sets the 'hostname', 'fqdn' and 'domain' facts for use in the manifest,
+ in particular for determining which 'node' statement applies to the client.
Possible values are 'cert' (use the subject's CN in the client's
certificate) and 'facter' (use the hostname that the client
reported in its facts)"],
diff --git a/lib/puppet/network/handler/master.rb b/lib/puppet/network/handler/master.rb
index 8d84fe8b8..3e004046e 100644
--- a/lib/puppet/network/handler/master.rb
+++ b/lib/puppet/network/handler/master.rb
@@ -81,6 +81,8 @@ class Puppet::Network::Handler
clientip = facts["ipaddress"]
if Puppet[:node_name] == 'cert'
if name
+ facts["fqdn"] = client
+ facts["hostname"], facts["domain"] = client.split('.', 2)
client = name
end
if ip
diff --git a/test/network/handler/master.rb b/test/network/handler/master.rb
index 25117030e..88bfe6b7e 100755
--- a/test/network/handler/master.rb
+++ b/test/network/handler/master.rb
@@ -76,8 +76,15 @@ class TestMaster < Test::Unit::TestCase
Puppet[:node_name] = "cert"
# Make sure we get the fact data back when nothing is set
- facts = {"hostname" => "fact_hostname", "ipaddress" => "fact_ip"}
- certname = "cert_hostname"
+ facts = {
+ "hostname" => "fact_hostname",
+ "domain" => "fact_domain",
+ "fqdn" => "fact_hostname.fact_domain",
+ "ipaddress" => "fact_ip"
+ }
+ certhostname = "cert_hostname"
+ certdomain = "cert_domain"
+ certname = certhostname + "." + certdomain
certip = "cert_ip"
resname, resip = master.send(:clientname, nil, nil, facts)