Chef server refusing to provide some files


#1

We’re having a problem with our Chef (10.12) server where it’s
refusing to provide some files to clients. For example, I have a
"collectd" cookbook with a files/default/redis_info.py, but when I try
to run the recipe that requires it, the Chef server refuses to give me
the file. I keep getting

[2012-10-09T14:03:00-04:00] FATAL: NoMethodError: undefined method
`source’ for Chef::Resource::File

and inspecting the cookbook cache on the client, I see no "files"
directory under the relevant cookbook.

Downloading the cookbook by hand using “knife cookbook download” from
the Chef server works fine. What could be wrong?

  • Julian

#2

You mean to use the cookbook_file resource, not file (which is for touching/chmoding local files generally).

–Noah

On Oct 9, 2012, at 11:11 AM, Julian C. Dunn wrote:

We’re having a problem with our Chef (10.12) server where it’s
refusing to provide some files to clients. For example, I have a
"collectd" cookbook with a files/default/redis_info.py, but when I try
to run the recipe that requires it, the Chef server refuses to give me
the file. I keep getting

[2012-10-09T14:03:00-04:00] FATAL: NoMethodError: undefined method
`source’ for Chef::Resource::File

and inspecting the cookbook cache on the client, I see no "files"
directory under the relevant cookbook.

Downloading the cookbook by hand using “knife cookbook download” from
the Chef server works fine. What could be wrong?

  • Julian

#3

Sounds like a syntax error in your cookbook to me. Any chance you could post a gist of that section please?

Joshua

On Oct 9, 2012, at 11:11 AM, “Julian C. Dunn” lists@aquezada.com wrote:

We’re having a problem with our Chef (10.12) server where it’s
refusing to provide some files to clients. For example, I have a
"collectd" cookbook with a files/default/redis_info.py, but when I try
to run the recipe that requires it, the Chef server refuses to give me
the file. I keep getting

[2012-10-09T14:03:00-04:00] FATAL: NoMethodError: undefined method
`source’ for Chef::Resource::File

and inspecting the cookbook cache on the client, I see no "files"
directory under the relevant cookbook.

Downloading the cookbook by hand using “knife cookbook download” from
the Chef server works fine. What could be wrong?

  • Julian

#4

The error means that the Chef::Resource::File resource that you’re using doesn’t have a method called “source”.
Are you using the “file” resource instead of the cookbook_file resource?

On 10/9/12 11:11 AM, “Julian C. Dunn” <lists@aquezada.commailto:lists@aquezada.com> wrote:

We’re having a problem with our Chef (10.12) server where it’s
refusing to provide some files to clients. For example, I have a
"collectd" cookbook with a files/default/redis_info.py, but when I try
to run the recipe that requires it, the Chef server refuses to give me
the file. I keep getting

[2012-10-09T14:03:00-04:00] FATAL: NoMethodError: undefined method
`source’ for Chef::Resource::File

and inspecting the cookbook cache on the client, I see no "files"
directory under the relevant cookbook.

Downloading the cookbook by hand using “knife cookbook download” from
the Chef server works fine. What could be wrong?

  • Julian

#5

On Tue, Oct 9, 2012 at 2:20 PM, Nguyen, Dang Dang.Nguyen@disney.com wrote:

The error means that the Chef::Resource::File resource that you’re using
doesn’t have a method called “source”.
Are you using the “file” resource instead of the cookbook_file resource?

Thanks all… that was the problem. Clearly I need another cup of coffee :slight_smile:

  • Julian