summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-04-24 18:03:34 -0500
committerLuke Kanies <luke@madstop.com>2009-04-24 18:03:34 -0500
commit606a6891a5662a37f481cbada7cfd59c81cf9469 (patch)
tree66913b4c37a86ed86b6eab91862f1433ddbaa1db /lib
parentf489c30411e8fdee4e43a4f580d135acdaeae946 (diff)
downloadpuppet-606a6891a5662a37f481cbada7cfd59c81cf9469.tar.gz
puppet-606a6891a5662a37f481cbada7cfd59c81cf9469.tar.xz
puppet-606a6891a5662a37f481cbada7cfd59c81cf9469.zip
Making sure the cert name is searched first
The cert name should be searched first in default circumstances, even if it disagrees with the hostname. Brice's change to the way catalogs are searched for didn't quite work when the hostname and certname didn't agree *and* the certname was fully qualified. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/node.rb20
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/puppet/node.rb b/lib/puppet/node.rb
index 263aaf694..ad5a40b54 100644
--- a/lib/puppet/node.rb
+++ b/lib/puppet/node.rb
@@ -85,6 +85,10 @@ class Puppet::Node
names = []
+ if name.include?(".")
+ names += split_name(name)
+ end
+
# First, get the fqdn
unless fqdn = parameters["fqdn"]
if parameters["hostname"] and parameters["domain"]
@@ -97,12 +101,7 @@ class Puppet::Node
# Now that we (might) have the fqdn, add each piece to the name
# list to search, in order of longest to shortest.
if fqdn
- list = fqdn.split(".")
- tmp = []
- list.each_with_index do |short, i|
- tmp << list[0..i].join(".")
- end
- names += tmp.reverse
+ names += split_name(fqdn)
end
# And make sure the node name is first, since that's the most
@@ -116,4 +115,13 @@ class Puppet::Node
end
names.uniq
end
+
+ def split_name(name)
+ list = name.split(".")
+ tmp = []
+ list.each_with_index do |short, i|
+ tmp << list[0..i].join(".")
+ end
+ tmp.reverse
+ end
end