# Problems using resources

**URL:** <https://discourse.chef.io/t/problems-using-resources/2109>\
**Category:** Chef Infra (archive)\
**Created:** [October 17, 2011, 2:22pm UTC](https://discourse.chef.io/t/problems-using-resources/2109 "2011-10-17T14:22:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Steeves](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/michael_steeves/32/556_2.png) [@Michael\_Steeves](https://discourse.chef.io/u/Michael_Steeves)\
**Post date:** [October 17, 2011, 2:22pm UTC](https://discourse.chef.io/t/problems-using-resources/2109/1 "2011-10-17T14:22:35Z")

</div>

I’ve got a chef server installed on CentOS 6, and am trying to get a recipe  
working to configure NFS mounts on a client (also CentOS 6), and it keeps  
failing:

[root@client ~]# chef-client  
[Mon, 17 Oct 2011 10:12:56 -0400] INFO: \*\*\* Chef 0.10.4 \*\*\*  
[Mon, 17 Oct 2011 10:12:57 -0400] INFO: Run List is [recipe[nfs]]  
[Mon, 17 Oct 2011 10:12:57 -0400] INFO: Run List expands to [nfs]  
[Mon, 17 Oct 2011 10:12:57 -0400] INFO: Starting Chef Run for client  
[Mon, 17 Oct 2011 10:12:57 -0400] INFO: Loading cookbooks [nfs]  
[Mon, 17 Oct 2011 10:12:57 -0400] INFO: Storing updated  
cookbooks/nfs/resources/nfs1.rb in the cache.  
[Mon, 17 Oct 2011 10:12:57 -0400] INFO: Storing updated  
cookbooks/nfs/metadata.rb in the cache.  
[Mon, 17 Oct 2011 10:12:57 -0400] ERROR: Running exception handlers  
[Mon, 17 Oct 2011 10:12:57 -0400] FATAL: Saving node information to  
/var/chef/cache/failed-run-data.json  
[Mon, 17 Oct 2011 10:12:57 -0400] ERROR: Exception handlers complete  
[Mon, 17 Oct 2011 10:12:57 -0400] FATAL: Stacktrace dumped to  
/var/chef/cache/chef-stacktrace.out  
[Mon, 17 Oct 2011 10:12:57 -0400] FATAL: NoMethodError: undefined method  
`mount’ for #Class:0x7fa423126398

The contents of my nfs1.rb resource are

[~/Library/Chef/chef-repo/cookbooks/] % egrep -v ‘^#’ ./nfs/resources/nfs1.rb

mount “/nfsdir” do  
device "[nfs1.dom.ain.com](http://nfs1.dom.ain.com):/ifs/nfs1"  
fstype "nfs"  
options "rw"  
action [:mount, :enable]  
end

The stack trace on the client is

Generated at Mon Oct 17 10:12:57 -0400 2011  
NoMethodError: undefined method `mount' for #<Class:0x7fa423126398> /var/chef/cache/cookbooks/nfs/resources/nfs1.rb:8:in`class\_from\_file’  
/usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/…/lib/chef/resource.rb:533:in  
`build_from_file' /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource.rb:500:in`initialize’  
/usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/…/lib/chef/resource.rb:500:in  
`new' /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource.rb:500:in`build\_from\_file’  
/usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/…/lib/chef/run\_context.rb:96:in  
`load_lwrp_resources' /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/run_context.rb:120:in`call’  
/usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/…/lib/chef/run\_context.rb:120:in  
`foreach_cookbook_load_segment' /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/run_context.rb:119:in`each’  
/usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/…/lib/chef/run\_context.rb:119:in  
`foreach_cookbook_load_segment' /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/run_context.rb:117:in`each’  
/usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/…/lib/chef/run\_context.rb:117:in  
`foreach_cookbook_load_segment' /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/run_context.rb:94:in`load\_lwrp\_resources’  
/usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/…/lib/chef/run\_context.rb:59:in  
`load' /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/client.rb:195:in`setup\_run\_context’  
/usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/…/lib/chef/client.rb:159:in  
`run' /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:239:in`run\_application’  
/usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/…/lib/chef/application/client.rb:229:in  
`loop' /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:229:in`run\_application’  
/usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/…/lib/chef/application.rb:67:in  
`run' /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/chef-client:26 /usr/bin/chef-client:19:in`load’  
/usr/bin/chef-client:19

I also get the same sort of error when I try to use the “directory” directive.  
Any thoughts on what I’m doing wrong, here?

## -Mike

[steeves@raingods.net](mailto:steeves@raingods.net)

---

<div class="post-metadata">

**Author:** ![kallistec](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/kallistec/32/23_2.png) [@kallistec](https://discourse.chef.io/u/kallistec)\
**Post date:** [October 17, 2011, 3:23pm UTC](https://discourse.chef.io/t/problems-using-resources/2109/2 "2011-10-17T15:23:22Z")

</div>

On Monday, October 17, 2011 at 7:22 AM, [steeves@raingods.net](mailto:steeves@raingods.net) wrote:

> I've got a chef server installed on CentOS 6, and am trying to get a recipe  
> working to configure NFS mounts on a client (also CentOS 6), and it keeps  
> failing:
> 
> [root@client ~]# chef-client  
> [Mon, 17 Oct 2011 10:12:56 -0400] INFO: \*\*\* Chef 0.10.4 \*\*\*  
> [Mon, 17 Oct 2011 10:12:57 -0400] INFO: Run List is [recipe[nfs]]  
> [Mon, 17 Oct 2011 10:12:57 -0400] INFO: Run List expands to [nfs]  
> [Mon, 17 Oct 2011 10:12:57 -0400] INFO: Starting Chef Run for client  
> [Mon, 17 Oct 2011 10:12:57 -0400] INFO: Loading cookbooks [nfs]  
> [Mon, 17 Oct 2011 10:12:57 -0400] INFO: Storing updated  
> cookbooks/nfs/resources/nfs1.rb in the cache.  
> [Mon, 17 Oct 2011 10:12:57 -0400] INFO: Storing updated  
> cookbooks/nfs/metadata.rb in the cache.  
> [Mon, 17 Oct 2011 10:12:57 -0400] ERROR: Running exception handlers  
> [Mon, 17 Oct 2011 10:12:57 -0400] FATAL: Saving node information to  
> /var/chef/cache/failed-run-data.json  
> [Mon, 17 Oct 2011 10:12:57 -0400] ERROR: Exception handlers complete  
> [Mon, 17 Oct 2011 10:12:57 -0400] FATAL: Stacktrace dumped to  
> /var/chef/cache/chef-stacktrace.out  
> [Mon, 17 Oct 2011 10:12:57 -0400] FATAL: NoMethodError: undefined method  
> `mount' for #Class:0x7fa423126398
> 
> The contents of my nfs1.rb resource are
> 
> [~/Library/Chef/chef-repo/cookbooks/] % egrep -v '^#' ./nfs/resources/nfs1.rb
> 
> mount "/nfsdir" do  
> device "[nfs1.dom.ain.com](http://nfs1.dom.ain.com) ([http://nfs1.dom.ain.com](http://nfs1.dom.ain.com)):/ifs/nfs1"  
> fstype "nfs"  
> options "rw"  
> action [:mount, :enable]  
> end
> 
> The stack trace on the client is
> 
> Generated at Mon Oct 17 10:12:57 -0400 2011  
> NoMethodError: undefined method `mount' for #<Class:0x7fa423126398> /var/chef/cache/cookbooks/nfs/resources/nfs1.rb:8:in `class\_from\_file'  
> /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource.rb:533:in  
> `build_from_file' /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource.rb:500:in `initialize'  
> /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource.rb:500:in  
> `new' /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/resource.rb:500:in `build\_from\_file'  
> /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/run\_context.rb:96:in  
> `load_lwrp_resources' /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/run_context.rb:120:in `call'  
> /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/run\_context.rb:120:in  
> `foreach_cookbook_load_segment' /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/run_context.rb:119:in `each'  
> /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/run\_context.rb:119:in  
> `foreach_cookbook_load_segment' /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/run_context.rb:117:in `each'  
> /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/run\_context.rb:117:in  
> `foreach_cookbook_load_segment' /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/run_context.rb:94:in `load\_lwrp\_resources'  
> /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/run\_context.rb:59:in  
> `load' /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/client.rb:195:in `setup\_run\_context'  
> /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/client.rb:159:in  
> `run' /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:239:in `run\_application'  
> /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:229:in  
> `loop' /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application/client.rb:229:in `run\_application'  
> /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/../lib/chef/application.rb:67:in  
> `run' /usr/lib64/ruby/gems/1.8/gems/chef-0.10.4/bin/chef-client:26 /usr/bin/chef-client:19:in `load'  
> /usr/bin/chef-client:19
> 
> I also get the same sort of error when I try to use the "directory" directive.  
> Any thoughts on what I'm doing wrong, here?
> 
> ## -Mike
> 
> [steeves@raingods.net](mailto:steeves@raingods.net) ([mailto:steeves@raingods.net](mailto:steeves@raingods.net))  
> Files in the resources directory are for LWRPs: [http://wiki.opscode.com/display/chef/Lightweight+Resources+and+Providers+(LWRP)](http://wiki.opscode.com/display/chef/Lightweight+Resources+and+Providers+%28LWRP%29) (tl;dr: DSL for creating your own resource types and provider back-ends)

If you're looking to use existing types to configure a system, you want a recipe instead. You might find this page handy: [http://wiki.opscode.com/display/chef/Chef+Basics](http://wiki.opscode.com/display/chef/Chef+Basics) and this one: [http://wiki.opscode.com/display/chef/Recipes](http://wiki.opscode.com/display/chef/Recipes)

HTH,

--  
Dan DeLeo
