subakva / haproxy-tools

Ruby tools for HAProxy, including config file management.
MIT License
32 stars 14 forks source link

add_server with weight #12

Closed scottrobertson closed 9 years ago

scottrobertson commented 9 years ago

Hey,

How would I go about adding a server with weight?

I have the following, but it ignores weight:

config  = HAProxy::Config.parse_file('haproxy-starter.cfg')
listen = config.listener('http')
listen.add_server(blah, blah, port: 80, weight: 128)

Thanks Scott

scottrobertson commented 9 years ago

If i do:

listen.add_server(blah, blah, port: 80, attributes: { weight: 128 })

I get:

no implicit conversion of Symbol into String

subakva commented 9 years ago

If you add the attribute names and values as strings, it should work. I'll update the renderer to convert name and value to strings.

scottrobertson commented 9 years ago

Perfect, thank you.