diff options
| author | Rick Bradley <rick@rickbradley.com> | 2007-10-15 14:47:25 -0500 |
|---|---|---|
| committer | Rick Bradley <rick@rickbradley.com> | 2007-10-15 14:47:25 -0500 |
| commit | c34efbccf1eec9957253d4fcdcb4ea9c79837ad8 (patch) | |
| tree | ae04acf64b2b2a772c9d7d113fccf994fc6c71a3 /lib/puppet/network/http | |
| parent | 9a179ec3a9df62c6179e7151831c4f07197cfbce (diff) | |
| download | puppet-c34efbccf1eec9957253d4fcdcb4ea9c79837ad8.tar.gz puppet-c34efbccf1eec9957253d4fcdcb4ea9c79837ad8.tar.xz puppet-c34efbccf1eec9957253d4fcdcb4ea9c79837ad8.zip | |
Hooking up address/port support for the various servers w/ specs. Still need to start up a webrick server w/ address + port (this is far too incestuous with Puppet lib & Puppet.start at the moment).
Diffstat (limited to 'lib/puppet/network/http')
| -rw-r--r-- | lib/puppet/network/http/mongrel.rb | 6 | ||||
| -rw-r--r-- | lib/puppet/network/http/webrick.rb | 5 |
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/puppet/network/http/mongrel.rb b/lib/puppet/network/http/mongrel.rb index 49449cf59..bbba69fe3 100644 --- a/lib/puppet/network/http/mongrel.rb +++ b/lib/puppet/network/http/mongrel.rb @@ -6,9 +6,11 @@ class Puppet::Network::HTTP::Mongrel end def listen(args = {}) - raise ArgumentError if args.keys.empty? + raise ArgumentError, ":handlers must be specified." if !args[:handlers] or args[:handlers].keys.empty? + raise ArgumentError, ":address must be specified." unless args[:address] + raise ArgumentError, ":port must be specified." unless args[:port] raise "Mongrel server is already listening" if listening? - @server = Mongrel::HttpServer.new("0.0.0.0", "3000") + @server = Mongrel::HttpServer.new(args[:address], args[:port]) @server.run @listening = true end diff --git a/lib/puppet/network/http/webrick.rb b/lib/puppet/network/http/webrick.rb index 85a329454..c22bce938 100644 --- a/lib/puppet/network/http/webrick.rb +++ b/lib/puppet/network/http/webrick.rb @@ -7,8 +7,11 @@ class Puppet::Network::HTTP::WEBrick < WEBrick::HTTPServer end def listen(args = {}) - raise ArgumentError if args.keys.empty? + raise ArgumentError, ":handlers must be specified." if !args[:handlers] or args[:handlers].keys.empty? + raise ArgumentError, ":address must be specified." unless args[:address] + raise ArgumentError, ":port must be specified." unless args[:port] raise "WEBrick server is already listening" if listening? + # TODO / FIXME: this should be moved out of the wacky Puppet global namespace! Puppet.start @listening = true |
