On Wed, Sep 5, 2012 at 8:37 AM, JeremyCampbell
<[email protected]>wrote:

>
>
> On Wednesday, September 5, 2012 5:20:49 PM UTC+2, Dan Bode wrote:
>
>>
>>
>> On Wed, Sep 5, 2012 at 8:15 AM, JeremyCampbell <[email protected]>wrote:
>>
>>>
>>>
>>> On Wednesday, September 5, 2012 4:15:31 PM UTC+2, Dan Bode wrote:
>>>
>>>>
>>>>
>>>> On Wed, Sep 5, 2012 at 7:05 AM, JeremyCampbell 
>>>> <[email protected]>wrote:
>>>>
>>>>> 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::**mult**iroute::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"
>>>>>
>>>>
>>>> can you try this with --trace and post the output?
>>>>>
>>>>
>>> # puppet agent --test --server devbox --trace
>>> info: Retrieving plugin
>>> info: Loading facts in /var/lib/puppet/lib/facter/**defgw_ipv4.rb
>>> info: Loading facts in /var/lib/puppet/lib/facter/**puppet_vardir.rb
>>> info: Loading facts in /var/lib/puppet/lib/facter/**virtual.rb
>>> info: Loading facts in /var/lib/puppet/lib/facter/**root_home.rb
>>> /usr/lib/ruby/site_ruby/1.8/**puppet/indirector/rest.rb:56:**in
>>> `deserialize'
>>> /usr/lib/ruby/site_ruby/1.8/**puppet/indirector/rest.rb:126:**in `find'
>>> /usr/lib/ruby/site_ruby/1.8/**puppet/indirector/indirection.**rb:195:in
>>> `find'
>>> /usr/lib/ruby/site_ruby/1.8/**puppet/configurer.rb:239:in
>>> `retrieve_new_catalog'
>>> /usr/lib/ruby/site_ruby/1.8/**puppet/util.rb:493:in `thinmark'
>>> /usr/lib/ruby/1.8/benchmark.**rb:308:in `realtime'
>>> /usr/lib/ruby/site_ruby/1.8/**puppet/util.rb:492:in `thinmark'
>>> /usr/lib/ruby/site_ruby/1.8/**puppet/configurer.rb:238:in
>>> `retrieve_new_catalog'
>>> /usr/lib/ruby/site_ruby/1.8/**puppet/configurer.rb:86:in
>>> `retrieve_catalog'
>>> /usr/lib/ruby/site_ruby/1.8/**puppet/configurer.rb:112:in
>>> `retrieve_and_apply_catalog'
>>> /usr/lib/ruby/site_ruby/1.8/**puppet/configurer.rb:152:in `run'
>>> /usr/lib/ruby/site_ruby/1.8/**puppet/agent.rb:43:in `run'
>>> /usr/lib/ruby/site_ruby/1.8/**puppet/agent/locker.rb:21:in `lock'
>>> /usr/lib/ruby/site_ruby/1.8/**puppet/agent.rb:43:in `run'
>>> /usr/lib/ruby/1.8/sync.rb:230:**in `synchronize'
>>> /usr/lib/ruby/site_ruby/1.8/**puppet/agent.rb:43:in `run'
>>> /usr/lib/ruby/site_ruby/1.8/**puppet/agent.rb:95:in `with_client'
>>> /usr/lib/ruby/site_ruby/1.8/**puppet/agent.rb:41:in `run'
>>> /usr/lib/ruby/site_ruby/1.8/**puppet/application.rb:172:in `call'
>>> /usr/lib/ruby/site_ruby/1.8/**puppet/application.rb:172:in
>>> `controlled_run'
>>> /usr/lib/ruby/site_ruby/1.8/**puppet/agent.rb:39:in `run'
>>> /usr/lib/ruby/site_ruby/1.8/**puppet/application/agent.rb:**339:in
>>> `onetime'
>>> /usr/lib/ruby/site_ruby/1.8/**puppet/application/agent.rb:**313:in
>>> `run_command'
>>> /usr/lib/ruby/site_ruby/1.8/**puppet/application.rb:309:in `run'
>>> /usr/lib/ruby/site_ruby/1.8/**puppet/application.rb:416:in `hook'
>>> /usr/lib/ruby/site_ruby/1.8/**puppet/application.rb:309:in `run'
>>> /usr/lib/ruby/site_ruby/1.8/**puppet/application.rb:407:in
>>> `exit_on_fail'
>>> /usr/lib/ruby/site_ruby/1.8/**puppet/application.rb:309:in `run'
>>> /usr/lib/ruby/site_ruby/1.8/**puppet/util/command_line.rb:**69:in
>>> `execute'
>>> /usr/bin/puppet:4
>>> err: Could not retrieve catalog from remote server: Error 400 on SERVER:
>>> can't convert Array into Hash at /etc/puppet/puppet/modules/**
>>> network/manifests/multiroute/**mhpeers.pp:7 on node gw1.zz
>>> warning: Not using cache on failed catalog
>>> err: Could not retrieve catalog; skipping run
>>>
>>
>>
>> actually, I care way more about --trace on the master
>>>
>>
> Sorry Dan, I should have realized you meant on the master. See below - is
> this what you expected?
>

yep, although it looks completely valid.

Can you share the result of --trace from the master?


>
> $ sudo /usr/sbin/puppetmasterd --no-daemonize --trace
> {"10.100.0.10"=>{"dsthost"=>"gw1.nl", "dstip"=>"10.100.0.9"},
> "10.100.0.34"=>{"dsthost"=>"gw1.fr", "dstip"=>"10.100.0.33"},
> "10.100.0.6"=>{"dsthost"=>"gw2.us", "dstip"=>"10.100.0.5"},
> "10.100.0.2"=>{"dsthost"=>"gw1.us", "dstip"=>"10.100.0.1"},
> "10.100.0.22"=>{"dsthost"=>"gw2.nl", "dstip"=>"10.100.0.21"}}
>



>
>>>
>>>>> also,can you put the following line before the call to
>>>>> create_resources just to verify the data structure?
>>>>>
>>>>> $foo = inline_template("<% puts routes.inspect %>")
>>>>>
>>>>
>>> I've done that but I'm not sure where/what output you expect. Please
>>> advise.
>>>
>>
>> This should print the actual data structure in the masters logs. I would
>> recommend just running the master from the foreground and looking for this
>> output.
>>
>>
>>>
>>>> also, could you try quoting the name of the defined type?  'network::
>>>>> multiroute::mhpeer'
>>>>>
>>>>
>>> Ok, Ive done this, but it doesn't make any difference.
>>>
>>
>> ok, it was worth a try, that would have been easy :)
>>
>>
>>>
>>>>> My custom function <https://gist.github.com/796ad5b9d81c01d1dced>returns 
>>>>> the following data structure:
>>>>>
>>>>> {"10.100.0.9"=>{"dstip"=>"10.**1**00.0.10", "dsthost"=>"gw1.uk"},
>>>>> "10.100.0.46"=>{"dstip"=>"10.**1**00.0.45", "dsthost"=>"gw1.fr"},
>>>>> "10.100.0.17"=>{"dstip"=>"10.**1**00.0.18", "dsthost"=>"gw2.us"},
>>>>> "10.100.0.13"=>{"dstip"=>"10.**1**00.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/*
>>>>> *ms**g/puppet-users/-/**h4EyleCsPLsJ<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 puppet-users...@**
>>>>> googlegroups.**com.
>>>>>
>>>>> For more options, visit this group at http://groups.google.com/**group
>>>>> **/puppet-users?hl=en<http://groups.google.com/group/puppet-users?hl=en>
>>>>> .
>>>>>
>>>>
>>>>  --
>>> 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/-/**V4MvJx5TfXAJ<https://groups.google.com/d/msg/puppet-users/-/V4MvJx5TfXAJ>
>>> .
>>>
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to puppet-users...@**
>>> googlegroups.com.
>>> For more options, visit this group at http://groups.google.com/**
>>> group/puppet-users?hl=en<http://groups.google.com/group/puppet-users?hl=en>
>>> .
>>>
>>
>>  --
> 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/-/QLYzDRNyhxEJ.
>
> 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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
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