diff options
author | Luke Kanies <luke@madstop.com> | 2009-05-02 20:05:19 +0200 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2009-05-03 17:37:02 +0200 |
commit | 1a2e1bcdd31e00a925e1e55693e9dbe241289950 (patch) | |
tree | 89b3cf16d7fbfa27b93f58eac2397f443ca09f91 /lib | |
parent | df3a8f67193c8c6089a84ea6023c84c52b3d3205 (diff) | |
download | puppet-1a2e1bcdd31e00a925e1e55693e9dbe241289950.tar.gz puppet-1a2e1bcdd31e00a925e1e55693e9dbe241289950.tar.xz puppet-1a2e1bcdd31e00a925e1e55693e9dbe241289950.zip |
Fixing #2195 - the Server class handles bindaddress
The Server class has all of the logic now,
instead of doing weird things in the defaults.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/network/server.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/puppet/network/server.rb b/lib/puppet/network/server.rb index de32db02f..701be54ca 100644 --- a/lib/puppet/network/server.rb +++ b/lib/puppet/network/server.rb @@ -55,11 +55,14 @@ class Puppet::Network::Server end def initialize(args = {}) + valid_args = [:handlers, :xmlrpc_handlers, :port] + bad_args = args.keys.find_all { |p| ! valid_args.include?(p) }.collect { |p| p.to_s }.join(",") + raise ArgumentError, "Invalid argument(s) %s" % bad_args unless bad_args == "" @server_type = Puppet[:servertype] or raise "No servertype configuration found." # e.g., WEBrick, Mongrel, etc. http_server_class || raise(ArgumentError, "Could not determine HTTP Server class for server type [#{@server_type}]") - @address = args[:address] || Puppet[:bindaddress] || raise(ArgumentError, "Must specify :address or configure Puppet :bindaddress.") @port = args[:port] || Puppet[:masterport] || raise(ArgumentError, "Must specify :port or configure Puppet :masterport") + @address = determine_bind_address() @protocols = [ :rest, :xmlrpc ] @listening = false @@ -157,5 +160,10 @@ class Puppet::Network::Server def http_server_class_by_type(kind) Puppet::Network::HTTP.server_class_by_type(kind) end -end + def determine_bind_address + tmp = Puppet[:bindaddress] + return tmp if tmp != "" + return server_type.to_s == "webrick" ? "0.0.0.0" : "127.0.0.1" + end +end |