Merge "Autodeployer support for ODL Plugin installation + Fuel 6.1"
[genesis.git] / fuel / build / f_l23network / puppet / modules / l23network / lib / puppet / parser / functions / extras_to_hosts.rb
1 #
2 # array_or_string_to_array.rb
3 #
4
5 module Puppet::Parser::Functions
6   newfunction(:extras_to_hosts, :type => :rvalue, :doc => <<-EOS
7               convert extras array passed from Astute into
8               hash for puppet `host` create_resources call
9     EOS
10   ) do |args|
11     hosts=Hash.new
12     extras=args[0]
13     extras.each do |extras|
14       hosts[extras['name']]={:ip=>extras['address'],:host_aliases=>[extras['fqdn']]}
15       notice("Generating extras host entry #{extras['name']} #{extras['address']} #{extras['fqdn']}")
16     end
17     return hosts
18   end
19 end
20
21 # vim: set ts=2 sw=2 et :