Using a definition in another recipe


#1

I searched the docs/wiki and this list but didn’t find anything.

I have created a definition in one recipe that i want to use in another recipe.
Can this be done? Or, how should I accomplish my goal - which is to have the
functionality of a definition available across multiple recipes?

If it makes a difference I am running via chef-solo. And, to reference a
definition named foo in recipe bar, i have tried Bar::foo and bar::foo. In
both cases i get an error message: “Original: (eval):1:in `method_missing’:
uninitialized constant Chef::Resource::Bar”

thanks in advance!
rich


#2

Definitions are global - just do:

foo “something” do
end

And you are good to go. (from any recipe)

Adam

On Wed, Aug 5, 2009 at 2:02 PM, rich@shopittome.com wrote:

I searched the docs/wiki and this list but didn’t find anything.

I have created a definition in one recipe that i want to use in another recipe.
Can this be done? Or, how should I accomplish my goal - which is to have the
functionality of a definition available across multiple recipes?

If it makes a difference I am running via chef-solo. And, to reference a
definition named foo in recipe bar, i have tried Bar::foo and bar::foo. In
both cases i get an error message: “Original: (eval):1:in `method_missing’:
uninitialized constant Chef::Resource::Bar”

thanks in advance!
rich


Opscode, Inc.
Adam Jacob, CTO
T: (206) 508-7449 E: adam@opscode.com