Skip to content
Browse files

Merge pull request #25 from brightbox/add-timeout-to-loadbalancer-lis…

…teners

Add timeout to load balancer listeners
  • Loading branch information...
2 parents 8ec2004 + ab4ee5e commit 25fec5e1cadc38d436ac8aed86753a9606f6f07b @gnufied gnufied committed Mar 20, 2012
View
8 lib/brightbox-cli/commands/lbs-create.rb
@@ -11,8 +11,8 @@ module Brightbox
c.default_value "least-connections"
c.flag [:p, :policy]
- c.desc "Listeners. Format: in-port:out-port:type. Comma separate multiple listeners."
- c.default_value "80:80:http,443:443:tcp"
+ c.desc "Listeners. Format: in-port:out-port:type:timeout. Comma separate multiple listeners. Protocols can be tcp, http or http+ws and timeouts are in milliseconds."
+ c.default_value "80:80:http:50000,443:443:tcp:50000"
c.flag [:l, :listeners]
c.desc "Healthcheck port. Defaults to first listener out port."
@@ -46,9 +46,9 @@ module Brightbox
raise "You must specify which servers to balance connections to" if args.empty?
listeners = options[:l].split(",").collect do |l|
- inport, outport, protocol = l.split ":"
+ inport, outport, protocol, timeout = l.split ":"
raise "listener '#{l}' is invalid" if inport.nil? or outport.nil? or protocol.nil?
- { :in => inport, :out => outport, :protocol => protocol }
+ { :in => inport, :out => outport, :protocol => protocol, :timeout => timeout }
end
raise "You must specify at least one listener" if listeners.empty?
View
6 lib/brightbox-cli/commands/lbs-update.rb
@@ -11,7 +11,7 @@ module Brightbox
c.desc "Load balancer policy"
c.flag [:p, :policy]
- c.desc "Listeners (in-port:out-port:protocol. Comma separate multiple listeners)"
+ c.desc "Listeners (in-port:out-port:protocol:timeout. Comma separate multiple listeners)"
c.flag [:l, :listeners]
c.desc "Healthcheck port"
@@ -64,8 +64,8 @@ module Brightbox
if options[:l]
lbopts[:listeners] = options[:l].split(",").collect do |l|
- inport, output, protocol = l.split ":"
- { :in => inport, :out => output, :protocol => protocol }
+ inport, output, protocol, timeout = l.split ":"
+ { :in => inport, :out => output, :protocol => protocol, :timeout => timeout }
end
end
View
2 lib/brightbox-cli/load_balancers.rb
@@ -35,7 +35,7 @@ def cloud_ips
def listeners
if attributes[:listeners]
- attributes[:listeners].collect { |l| [l["in"], l["out"], l["protocol"]].join(":") }
+ attributes[:listeners].collect { |l| [l["in"], l["out"], l["protocol"], l['timeout']].join(":") }
else
nil
end

0 comments on commit 25fec5e

Please sign in to comment.
Something went wrong with that request. Please try again.