On Jul 31, 2009, at 1:35 PM, S H wrote:

> I'm writing a pretty complex type/provider combo that is now dumps  
> the following output when I test it:
>
> puppet# puppet --libdir "/usr/local/etc/puppet/modules/bacula/ 
> plugins" --trace --debug --verbose test.pp
> info: Loading fact fc_location
> /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:  
> command not found:
> debug: importing '/usr/local/etc/puppet/modules/bacula/manifests/ 
> init.pp'
> info: Autoloaded module bacula
> debug: Creating default schedules
> debug: Prefetching baculator resources for bacula_filedaemon
> /usr/local/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:396:in  
> `record_type'
> /usr/local/lib/ruby/site_ruby/1.8/puppet/util/fileparsing.rb:366:in  
> `valid_attr?'
> /usr/local/lib/ruby/site_ruby/1.8/puppet/provider/parsedfile.rb: 
> 151:in `target'
> /usr/local/lib/ruby/site_ruby/1.8/puppet/property.rb:337:in `send'
> /usr/local/lib/ruby/site_ruby/1.8/puppet/property.rb:337:in `retrieve'
> /usr/local/lib/ruby/site_ruby/1.8/puppet/type.rb:922:in  
> `currentpropvalues'
> /usr/local/lib/ruby/site_ruby/1.8/puppet/util/autoload.rb:77:in  
> `inject'
> /usr/local/lib/ruby/site_ruby/1.8/puppet/type.rb:914:in `each'
> /usr/local/lib/ruby/site_ruby/1.8/puppet/type.rb:914:in `inject'
> /usr/local/lib/ruby/site_ruby/1.8/puppet/type.rb:914:in  
> `currentpropvalues'
> /usr/local/lib/ruby/site_ruby/1.8/puppet/type.rb:902:in `retrieve'
> /usr/local/lib/ruby/site_ruby/1.8/puppet/type.rb:831:in `evaluate'
> /usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:60:in `apply'
> /usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:239:in  
> `eval_resource'
> /usr/local/lib/ruby/site_ruby/1.8/puppet/util.rb:425:in `thinmark'
> /usr/local/lib/ruby/1.8/benchmark.rb:308:in `realtime'
> /usr/local/lib/ruby/site_ruby/1.8/puppet/util.rb:424:in `thinmark'
> /usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:238:in  
> `eval_resource'
> /usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:310:in  
> `evaluate'
> /usr/local/lib/ruby/site_ruby/1.8/puppet/util.rb:425:in `thinmark'
> /usr/local/lib/ruby/1.8/benchmark.rb:308:in `realtime'
> /usr/local/lib/ruby/site_ruby/1.8/puppet/util.rb:424:in `thinmark'
> /usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:309:in  
> `evaluate'
> /usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:303:in  
> `collect'
> /usr/local/lib/ruby/site_ruby/1.8/puppet/transaction.rb:303:in  
> `evaluate'
> /usr/local/lib/ruby/site_ruby/1.8/puppet/node/catalog.rb:124:in  
> `apply'
> /usr/local/bin/puppet:233
> err: //bacula::test/Bacula_filedaemon[testbox-fd]: Failed to  
> retrieve current state of resource: undefined method `[]' for  
> nil:NilClass
> debug: Finishing transaction 345590850 with 0 changes
>
>
> I'm stumped. I understand the meaning of the error, but given that  
> I've got some 800 new lines of code in several files interacting  
> with Puppet in ways I don't entirely understand (or at all in many  
> cases), I've not been able to figure out why this is broken. The  
> relevant lines in fileparseing.rb:
>
> 394    # Retrieve the record object.
> 395    def record_type(type)
> 396        @record_types[symbolize(type)]
> 397    end
>
> Instead of asking exactly what is going on here (since that would  
> take pages of background and all my sorry-ass code), my question is:
>
> How have you real developers figured out Puppet's internals enough  
> to build complex providers/types?
>
> The documentation is extremely sparse, and the level of indirection/ 
> metaprogramming that's happening is bewildering to a ruby-neophyte.
>
> I know the answer is going to be, in part, "Just work with it."  
> Beyond that, I'm hoping for any unofficial documentation, any notes,  
> any off-the-cuff explanation of how providers function, types  
> function, what datatypes they're expecting to be updated where.

I have no problem agreeing that it's obtuse and poorly documented, but  
the best I can do is offer what help I can.

It looks a lot like you're not initializing the @record_types  
variable, which is normally done through declaring record types of  
some kind.

What does your provider look like right now?

-- 
The conception of two people living together for twenty-five years
without having a cross word suggests a lack of spirit only to be
admired in sheep. --Alan Patrick Herbert
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to puppet-dev@googlegroups.com
To unsubscribe from this group, send email to 
puppet-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to