The puppetlabs-haproxy module has a minor annoyance where by the
"bind" statements are sorted lexicographically instead of by IP
address. (Full description here:
https://tickets.puppetlabs.com/browse/MODULES-1919)
My attempt to fix this bug was to change the ERB template:
diff --git a/templates/fragments/_bind.erb b/templates/fragments/_bind.erb
index e60983a..a04d021 100644
--- a/templates/fragments/_bind.erb
+++ b/templates/fragments/_bind.erb
@@ -1,6 +1,6 @@
<% require 'ipaddr' -%>
<%- if @bind -%>
-<%- @bind.sort.map do |address_port, bind_params| -%>
+<%- @bind.sort_by { |address_port, bind_params|
address_port.split('.').map{ |octet| octet.to_i} }.map do
|address_port, bind_params| -%>
bind <%= address_port -%> <%= Array(bind_params).join(" ") %>
<%- end -%>
<%- else -%>
This works. However, the results are slightly different on old
versions of Ruby. If you look at the TravisCI output, you'll see
slightly different results for Ruby 1.8.7. It looks like something
changed in Ruby 1.9.
https://travis-ci.org/puppetlabs/puppetlabs-haproxy/builds/57502529
I don't have a lot of deep Ruby knowledge. Can anyone suggest either a
way to fix the code or the test?
Thanks!
Tom
--
Email: [email protected] Work: [email protected]
Skype: YesThatTom
Blog: http://EverythingSysadmin.com
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/CAHVFxgkUrMMV%3DcvSD69Z-%3DVbK%3Dd1pHnu8QK37uLAOpZ%3DJb53_A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.