Generate proper list of ovsdb managers

Currently we not iterate through array returned by flat_map method and
list of ovsdb managers is in the form:
  tcp:["192.168.0.3", "192.168.0.5"]:6640
Use flatten.map which produce:
  tcp:192.168.0.3:6640 tcp:192.168.0.5:6640

Change-Id: Ic09fea905cba3e532706d4a829b9670284a2ecbc
Signed-off-by: Michal Skalski <mskalski@mirantis.com>
This commit is contained in:
Michal Skalski 2016-07-05 16:47:55 +02:00
parent 32b3824f84
commit 5d80efce6d
1 changed files with 8 additions and 4 deletions

View File

@ -1,8 +1,12 @@
module Puppet::Parser::Functions
newfunction(:odl_ovsdb_managers, :arity => 1, :type => :rvalue) do |args|
managers = args.flat_map { |ip| "tcp:#{ip}:6640" }
newfunction(:odl_ovsdb_managers, :arity => 1, :type => :rvalue, :doc => <<-'EOS'
@desc Creates list of ovsdb managers used in ovs-vsctl set-manager command
@input ['192.168.1.7', ....]
@return 'tcp:192.168.1.7:6640 ....'
@example odl_ovsdb_managers($ovsdb_mng)
EOS
) do |args|
managers = args.flatten.map { |ip| "tcp:#{ip}:6640" }
managers.join(' ')
end
end