summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-06-15 16:33:48 -0500
committerLuke Kanies <luke@madstop.com>2008-06-15 16:33:48 -0500
commit5f600ddc04efd1c4faac9f63b3a07af5282be707 (patch)
tree8b50d852445bdce96be411726c8d778847231d77
parent575f37a0656f5a1f94fe6fb1b189d1701a98cadc (diff)
downloadpuppet-5f600ddc04efd1c4faac9f63b3a07af5282be707.tar.gz
puppet-5f600ddc04efd1c4faac9f63b3a07af5282be707.tar.xz
puppet-5f600ddc04efd1c4faac9f63b3a07af5282be707.zip
Fixing #1168 (for 0.24.x) -- automatically downcasing the fqdn.
Also requiring that passed in certnames be downcased; the setting system isn't currently flexible enough to automatically downcase it for the user.
-rw-r--r--CHANGELOG5
-rw-r--r--lib/puppet/defaults.rb8
-rwxr-xr-xspec/integration/defaults.rb8
3 files changed, 18 insertions, 3 deletions
diff --git a/CHANGELOG b/CHANGELOG
index d51e3f0b6..8f670a417 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,8 @@
+ Fixing #1168 (for 0.24.x) -- automatically downcasing the fqdn.
+ Also requiring that passed in certnames be downcased; the setting
+ system isn't currently flexible enough to automatically downcase
+ it for the user.
+
Adding a ResourceTemplate class for using templates directly
within resources (i.e., client-side templates). This would really
only be used for composite resources that pass the results of the
diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb
index 57299b7e7..472d98c4f 100644
--- a/lib/puppet/defaults.rb
+++ b/lib/puppet/defaults.rb
@@ -160,8 +160,12 @@ module Puppet
end
Puppet.setdefaults(:ssl,
- :certname => [fqdn, "The name to use when handling certificates. Defaults
- to the fully qualified domain name."],
+ # We have to downcase the fqdn, because the current ssl stuff (as oppsed to in master) doesn't have good facilities for
+ # manipulating naming.
+ :certname => {:default => fqdn.downcase, :desc => "The name to use when handling certificates. Defaults
+ to the fully qualified domain name.",
+ :call_on_define => true, # Call our hook with the default value, so we're always downcased
+ :hook => proc { |value| raise(ArgumentError, "Certificate names must be lower case; see #1168") unless value == value.downcase }},
:certdnsnames => ['', "The DNS names on the Server certificate as a colon-separated list.
If it's anything other than an empty string, it will be used as an alias in the created
certificate. By default, only the server gets an alias set up, and only for 'puppet'."],
diff --git a/spec/integration/defaults.rb b/spec/integration/defaults.rb
index b14a141fb..a07743679 100755
--- a/spec/integration/defaults.rb
+++ b/spec/integration/defaults.rb
@@ -5,8 +5,9 @@ require File.dirname(__FILE__) + '/../spec_helper'
require 'puppet/defaults'
describe "Puppet defaults" do
+ after { Puppet.settings.clear }
+
describe "when setting the :factpath" do
- after { Puppet.settings.clear }
it "should add the :factpath to Facter's search paths" do
Facter.expects(:search).with("/my/fact/path")
@@ -14,4 +15,9 @@ describe "Puppet defaults" do
Puppet.settings[:factpath] = "/my/fact/path"
end
end
+ describe "when setting the :certname" do
+ it "should fail if the certname is not downcased" do
+ lambda { Puppet.settings[:certname] = "Host.Domain.Com" }.should raise_error(ArgumentError)
+ end
+ end
end