On Sep 16, 2008, at 3:01 PM, Steve McIntosh wrote:

>
> Does anybody have an example of how to let a custom type call custom
> ruby code? For example inside an "insync" block of an "ensure"
> property you would call:
>
>   myDB = CellDB.new()
>   myDB.sync(resource[:cells])
>
> The CellDB class and it's methods are defined in CellDB.rb which works
> stand-alone so I know the problem isn't a syntax error or anything.
>
> I've tried *everything* I can think of. I've got the typical
> /var/lib.puppet/lib/puppet/...  setup. My custom type is in type
> and comes over fine, I've put the code for the utility everywhere
> I can think of. I've even made it part of Module puppet. I've tried
> includes and requires and even slotting the code (CellDB.rb) into
> site_ruby. Nothing works.
>
> Either the server chokes and says it can't find Constant CellDB or it
> just chokes on the client with no error message - you just don't get
> the "ensure changing from outofsync to insync" message.
>
> Somebody has to have something similar working. What am I missing?
> Where do you need to put the files and what's the magic to making them
> visible and executable to puppet???

Can you be specific on what kinds of errors you're seeing?

You should be able to just put the code into $site_ruby/celldb.rb, and  
then use 'require "celldb"' in your custom type.  That should make the  
class available in the type.

You should also be able to put celldb.rb in a module and use  
pluginsync, but you have to either put it outside the 'puppet'  
directory or use 'require "puppet/celldb"'.

-- 
The great thing about television is that if something important
happens anywhere in the world, day or night, you can always change
the channel. -- From "Taxi"
---------------------------------------------------------------------
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 [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-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to