- From: Ringo De Smet <
>
- To:
- Subject: [chef] Re: Re: making a library global?
- Date: Mon, 19 Jul 2010 13:02:08 +0200
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=AH0dcVHAV1aYxVciO6YGYKSAw7jWTC+Z5GJWIlh8LWiQhGc9USbn9HiMFgaHmoL5Mf eE+XA39pKVEdozIK1r9r/zyEOFiYUwgPxVG3fYuC8z5BumeIWhM4xL1jX+lgzGUT1zY8 kBx0UkYWyK4YO//NiljUqHt2srmTD1ecIGfmI=
Joshua,
On 17 July 2010 00:42, Joshua Timberman
<
>
wrote:
>
>
Two ways.
>
>
1. Include the cookbook in the run list of the node, or a role on the node.
>
It doesn't have to do anything - the default.rb can be blank. E.g.,
>
>
{ "run_list": [ "recipe[your_library_cookbook]" ] }
>
>
That will cause it to be downloaded, and its libraries loaded on the node.
>
>
2. Put the cookbook in the metadata of any cookbooks you want to use the
>
library in. E.g.,
>
>
depends "your_library_cookbook"
>
>
In metadata.rb of another cookbook where you want to use the library.
I have put cookbook "dss" in a role definition and put the role in the
node run list. "dss" depends on "pylabs" (via metadata) and in
"pylabs" I have a library defining an additional type of script
resource:
-- START --
require 'chef/resource/script'
class Chef
class Resource
class QShell < Chef::Resource::Script
def initialize(name, run_context=nil)
super
@resource_name = :pylabs_qshell
@interpreter = "/opt/qbase3/qshell -f"
end
end
end
end
-- END --
All required files are in my client cache, but still I get a
NoMethodError on "pylabs_qshell", which is the @resource_name.
2010-07-19_09:41:42.73142 [Mon, 19 Jul 2010 11:41:42 +0200] ERROR:
NoMethodError
2010-07-19_09:41:42.73143 [Mon, 19 Jul 2010 11:41:42 +0200] FATAL:
undefined method `pylabs_qshell' for #<Chef::Recipe:0x7fc7e53f9aa8>
2010-07-19_09:41:42.73143
/usr/lib/ruby/gems/1.8/gems/chef-0.9.6/bin/../lib/chef/mixin/recipe_definition_dsl_core.rb:55:in
`method_missing'
2010-07-19_09:41:42.73143
/srv/chef/cache/cookbooks/dss/recipes/pylabs.rb:23:in `from_file'
2010-07-19_09:41:42.73144
/usr/lib/ruby/gems/1.8/gems/chef-0.9.6/bin/../lib/chef/cookbook_version.rb:316:in
`load_recipe'
What am I missing here?
Ringo
Archive powered by MHonArc 2.6.16.