I'm attempting to include a class on certain hosts whose resources
will be different depending on which host it is.  I'm determining what
resources to include in the class on a per host basis by consuming
some JSON from another application.  I seem to be running up against
an issue where I can't use a definition that I have defined in my
module, within my Ruby DSL class.

So, my (heavily simplified) module looks like this:

module
-classifier
-files
-templates
-manifests
--definition.pp
--class.rb
--init.pp
--base.pp

In definition.pp I have:

define module::definition($var1, $var2) {
    file { "/tmp/$var1":
        content => $var2,
        ensure => file,
    }
}

And in class.rb I have something like:

require 'rubygems'
require 'json'

hostclass 'module::class' do
    include 'module::base'

# Do a bunch of stuff to get our vars

# Loop through and build out a number of resources using our custom
definitions
    foo.each do |bar|
        module::definition bar["baz"],
            :var1 => some_other_var,
            :var2 => another_var,
    end
end

However the catalog fails to compile:

err: Could not retrieve catalog from remote server: Error 400 on
SERVER: Puppet::Parser::Compiler failed with error NameError:
undefined local variable or method `module' for
#<Puppet::DSL::ResourceAPI:0x2aaaadbe9010> on node myhost.example.com

So I guess my question is, how do I use definitions written in the
Puppet DSL in classes that were written using the Ruby DSL?

I've consulted these resources but haven't been able to glean the
answer:
http://projects.puppetlabs.com/projects/1/wiki/Ruby_Dsl
http://www.puppetlabs.com/blog/ruby-dsl/

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

Reply via email to