It now automatically switches values depending on server type,
while still allowing overriding.
Signed-off-by: Luke Kanies <[EMAIL PROTECTED]>
---
lib/puppet/defaults.rb | 9 ++++++---
spec/integration/defaults.rb | 20 ++++++++++++++++++++
2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb
index ba47dcd..d0c2eff 100644
--- a/lib/puppet/defaults.rb
+++ b/lib/puppet/defaults.rb
@@ -313,12 +313,15 @@ module Puppet
:config => ["$confdir/puppet.conf",
"The configuration file for #{Puppet[:name]}."],
:pidfile => ["$rundir/$name.pid", "The pid file"],
- :bindaddress => ["", "The address to bind to. Mongrel servers
+ :bindaddress => ["", "The address a listening server should bind to.
Mongrel servers
default to 127.0.0.1 and WEBrick defaults to 0.0.0.0."],
- :servertype => ["webrick", "The type of server to use. Currently
supported
+ :servertype => {:default => "webrick", :desc => "The type of server to
use. Currently supported
options are webrick and mongrel. If you use mongrel, you will need
a proxy in front of the process or processes, since Mongrel cannot
- speak SSL."]
+ speak SSL.",
+ :call_on_define => true, # Call our hook with the default value,
so we always get the correct bind address set.
+ :hook => proc { |value| value == "webrick" ? parent[:bindaddress]
= "0.0.0.0" : parent[:bindaddress] = "127.0.0.1" if parent[:bindaddress] == "" }
+ }
)
self.setdefaults(:puppetmasterd,
diff --git a/spec/integration/defaults.rb b/spec/integration/defaults.rb
index fcf8ccf..efe6db1 100755
--- a/spec/integration/defaults.rb
+++ b/spec/integration/defaults.rb
@@ -51,4 +51,24 @@ describe "Puppet defaults" do
it "should default to yaml as the catalog format" do
Puppet.settings[:catalog_format].should == "yaml"
end
+
+ it "should default to 0.0.0.0 for its bind address and 'webrick' for its
server type" do
+ Puppet.settings[:servertype] = "webrick"
+ Puppet.settings[:bindaddress].should == "0.0.0.0"
+ end
+
+ it "should default to 0.0.0.0 for its bind address if the server is
webrick" do
+ Puppet.settings[:servertype] = "webrick"
+ Puppet.settings[:bindaddress].should == "0.0.0.0"
+ end
+
+ it "should default to 127.0.0.1 for its bind address if the server is
mongrel" do
+ Puppet.settings[:servertype] = "mongrel"
+ Puppet.settings[:bindaddress].should == "127.0.0.1"
+ end
+
+ it "should allow specification of a different bind address" do
+ Puppet.settings[:bindaddress] = "192.168.0.1"
+ Puppet.settings[:bindaddress].should == "192.168.0.1"
+ end
end
--
1.5.3.7
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---