I have written a custom function that returns a hash of data to be used by 
the *create_resources* function. 

class network::multiroute::mhpeers (
) {
  $routes = gen_ip_routes("gw.uk")
  create_resources(network::multiroute::mhpeer, $routes)
}

However, on the puppet client I get "err: Could not retrieve catalog from 
remote server: Error 400 on SERVER: can't convert Array into Hash"

My custom function <https://gist.github.com/796ad5b9d81c01d1dced> returns 
the following data structure:

{"10.100.0.9"=>{"dstip"=>"10.100.0.10", "dsthost"=>"gw1.uk"}, 
"10.100.0.46"=>{"dstip"=>"10.100.0.45", "dsthost"=>"gw1.fr"}, 
"10.100.0.17"=>{"dstip"=>"10.100.0.18", "dsthost"=>"gw2.us"}, 
"10.100.0.13"=>{"dstip"=>"10.100.0.14", "dsthost"=>"gw1.us"}}

Based on the puppet 
source<https://github.com/puppetlabs/puppet/blob/master/lib/puppet/parser/functions/create_resources.rb>
  
the rdoc states:

The hash should be in the form `{title => {parameters} }`

I believe I am returning the hash in the correct format so I am confused as 
to what the problem could be. I've been stuck on this issue for quite some 
time, any pointers would be really appreciated!

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/h4EyleCsPLsJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to