Limit to the number of files copied to a remote machine using cookbook_file resource?



I’m hoping someone can help…

I’ve got this code in a recipe:

Metrics =, :name, :command)
metrics = ["metrics-marketo-daily-count.rb", "metrics_marketo_daily_count", ""),
       "check-redis-list-length.rb", "check_redis_list_length", "-h #{redis_host} -w  1000 -c     2000)

metrics .each do |check|
    cookbook_file "/opt/sensu/embedded/bin/#{check[:plugin]}" do
      source "#{check[:plugin]}"
      action :create

It’s supposed to copy over the file to the remote machine. The problem is that after a chef run, it reports that file created. However when I search for this file, I can’t find it. The cookbook_file resource is used quite a few times in my cookbook and I’m wondering is there a limit to the number of files that can be copied across ro a remote machine using cookbook_file?

Is there another resource that can be used to copy files across to a remote machine?



Hi Angela,

I’ve never come across a limit to the number of cookbook files that can be included as part of a cookbook but I’ve come across problems with size of files - if they are too large Chef is unhappy!

The code you supplied SHOULD work, were are your cookbook files located? Are they in files/default or a specific folder for the platform? What does the Chef log say for the resources beginning with /opt/sensu/embedded/bin

One comment I would make, your using string interpolation for setting the cookbook_file source when there is no need

metrics.each do |check|
    cookbook_file "/opt/sensu/embedded/bin/#{check[:plugin]}" do
        source check[:plugin]
        action :create