Skip to content

Commit

Permalink
Proper handling for array of arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
rhamon committed Jun 23, 2016
1 parent 2523a41 commit 64628a2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions templates/corosync.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ quorum {
two_node: 1
<% end -%>
<% else -%>
<% if [@quorum_members].flatten.count == 2 -%>
<% if Array(@quorum_members).length == 2 -%>
two_node: 1
<% end -%>
<% end -%>
}

<% unless @votequorum_expected_votes -%>
nodelist {
<% [@quorum_members].flatten.each_index do |i| -%>
<% Array(@quorum_members).each_index do |i| -%>
node {
<% Array(Array(@quorum_members.map{|node| Array(node).flatten})[i]).each_with_index do |addr,ring| -%>
ring<%= ring %>_addr: <%= addr %>
Expand Down
10 changes: 5 additions & 5 deletions templates/corosync.conf.udpu.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ totem {
secauth: <%= @enable_secauth_real %>
threads: <%= @threads %>
transport: udpu
<% (0..Array(@unicast_addresses.first).length-1).each do |interface| -%>
<% Array(@unicast_addresses.first).each_index do |interface| -%>
interface {
<% @unicast_addresses.each do |addr| -%>
<% Array(Array(@unicast_addresses.map{|x| Array(x).flatten}).transpose[interface]).each do |addr| -%>
member {
memberaddr: <%= Array(addr)[interface] %>
memberaddr: <%= addr %>
}
<% end -%>
ringnumber: <%= interface %>
Expand Down Expand Up @@ -86,15 +86,15 @@ quorum {
two_node: 1
<% end -%>
<% else -%>
<% if [@quorum_members].flatten.count == 2 -%>
<% if Array(@quorum_members).length == 2 -%>
two_node: 1
<% end -%>
<% end -%>
}

<% unless @votequorum_expected_votes -%>
nodelist {
<% [@quorum_members].flatten.each_index do |i| -%>
<% Array(@quorum_members).each_index do |i| -%>
node {
<% Array(Array(@quorum_members.map{|node| Array(node).flatten})[i]).each_with_index do |addr,ring| -%>
ring<%= ring %>_addr: <%= addr %>
Expand Down

0 comments on commit 64628a2

Please sign in to comment.