# Chef Solo - Unknown error processing config file with error undefined method \`absolute\_path' for File:Class

**URL:** <https://discourse.chef.io/t/chef-solo-unknown-error-processing-config-file-with-error-undefined-method-absolute-path-for-file-class/4243>\
**Category:** Chef Infra (archive)\
**Created:** [July 25, 2013, 6:31am UTC](https://discourse.chef.io/t/chef-solo-unknown-error-processing-config-file-with-error-undefined-method-absolute-path-for-file-class/4243 "2013-07-25T06:31:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Montgomery](https://avatars.discourse-cdn.com/v4/letter/d/51bf81/32.png) [@David\_Montgomery](https://discourse.chef.io/u/David_Montgomery)\
**Post date:** [July 25, 2013, 6:31am UTC](https://discourse.chef.io/t/chef-solo-unknown-error-processing-config-file-with-error-undefined-method-absolute-path-for-file-class/4243/1 "2013-07-25T06:31:09Z")

</div>

Why wil chef solo not run? I am using ruby 1.9.3

My cookbooks are in

/home/ubuntu/workspace/predictivematch-chef/chef-repo/cookbooks

chef-solo -c /home/ubuntu/workspace/chef-repo/solo.rb -j  
/home/ubuntu/workspace/chef-repo/roles/local\_server.json  
[2013-07-25T14:24:36+08:00] FATAL: Unknown error processing config file  
with error undefined method `absolute\_path’ for File:Class

Below is my chef-solo file

root = File.absolute\_path(File.dirname( **FILE** ))  
file\_cache\_path root

cookbook\_path root + '/cookbooks’  
data\_bag\_path root + ‘/data\_bags’

file\_cache\_path = '/var/chef/cache’  
Chef::Config[:file\_cache\_path]= ‘/var/chef/cache’

---

<div class="post-metadata">

**Author:** ![werebus](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/werebus/32/24_2.png) [@werebus](https://discourse.chef.io/u/werebus)\
**Post date:** [July 25, 2013, 1:14pm UTC](https://discourse.chef.io/t/chef-solo-unknown-error-processing-config-file-with-error-undefined-method-absolute-path-for-file-class/4243/2 "2013-07-25T13:14:34Z")

</div>

Is there any chance that you aren't actually using ruby 1.9.3? I notice  
that the method `absolute_path` was added to `File` in ruby 1.9.1, and the  
error message seems to be saying that `File.absolute_path` isn't a defined  
method.

-Matt Moretti

On Thu, Jul 25, 2013 at 2:31 AM, David Montgomery \<[davidmontgomery@gmail.com](mailto:davidmontgomery@gmail.com)

> wrote:

> Why wil chef solo not run? I am using ruby 1.9.3
> 
> My cookbooks are in
> 
> /home/ubuntu/workspace/predictivematch-chef/chef-repo/cookbooks
> 
> chef-solo -c /home/ubuntu/workspace/chef-repo/solo.rb -j  
> /home/ubuntu/workspace/chef-repo/roles/local\_server.json  
> [2013-07-25T14:24:36+08:00] FATAL: Unknown error processing config file  
> with error undefined method `absolute\_path' for File:Class
> 
> Below is my chef-solo file
> 
> root = File.absolute\_path(File.dirname( **FILE** ))  
> file\_cache\_path root
> 
> cookbook\_path root + '/cookbooks'  
> data\_bag\_path root + '/data\_bags'
> 
> file\_cache\_path = '/var/chef/cache'  
> Chef::Config[:file\_cache\_path]= '/var/chef/cache'

---

<div class="post-metadata">

**Author:** ![Maciej\_Pasternacki1](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/maciej_pasternacki1/32/452_2.png) [@Maciej\_Pasternacki1](https://discourse.chef.io/u/Maciej_Pasternacki1)\
**Post date:** [July 25, 2013, 7:19pm UTC](https://discourse.chef.io/t/chef-solo-unknown-error-processing-config-file-with-error-undefined-method-absolute-path-for-file-class/4243/3 "2013-07-25T19:19:29Z")

</div>

David,

solo.rb (and other Chef configs) are executed inside an anonymous class, to  
improve isolation between configuration and Ruby world, and prevent  
conflicts between settings and methods on Kernel module and Object class.  
Try fully qualifying the File class:

```
root = ::File.absolute_path(::File.dirname( __FILE__ ))

```

I remember that when I was writing active code for knife.rb, solo.rb, etc,  
I always needed to fully qualify classes.

HTH,  
-- Maciej

On 25 July 2013 08:31, David Montgomery [davidmontgomery@gmail.com](mailto:davidmontgomery@gmail.com) wrote:

> Why wil chef solo not run? I am using ruby 1.9.3
> 
> My cookbooks are in
> 
> /home/ubuntu/workspace/predictivematch-chef/chef-repo/cookbooks
> 
> chef-solo -c /home/ubuntu/workspace/chef-repo/solo.rb -j  
> /home/ubuntu/workspace/chef-repo/roles/local\_server.json  
> [2013-07-25T14:24:36+08:00] FATAL: Unknown error processing config file  
> with error undefined method `absolute\_path' for File:Class
> 
> Below is my chef-solo file
> 
> root = File.absolute\_path(File.dirname( **FILE** ))  
> file\_cache\_path root
> 
> cookbook\_path root + '/cookbooks'  
> data\_bag\_path root + '/data\_bags'
> 
> file\_cache\_path = '/var/chef/cache'  
> Chef::Config[:file\_cache\_path]= '/var/chef/cache'
