Geeks With Blogs
Alex Hildyard
I just wanted to point out that if your Chef clients are running low on disk resources, it could be worth checking your chef/cache/backup directory for temporary artefacts. I was recently looking at a Visual Studio 2015 installation recipe, trying to work out why it seemed to need more than 12Gb of resources, when the actual media was only 3.8Gb ...

Both the "file" and "remote_file" resources have a backup property which by default is set to "true", meaning that every time you use one of these you will potentially end up with a further copy in the cache unless you explicitly set the backup property to false. The default setting is "5", meaning that you will get up to 5 backups of each file cached.

This is particularly insidious because, counter-intuitively, Chef will *also* create a backup of the file on a "delete" action, so if you really want to delete a file without making a backup in the process, you'll want to write something like:

  # Clean up the downloaded zip file
  file downloaded_file_path.to_s do
    action :delete
    backup false
    only_if { ::File.exist?(downloaded_file_path) }

Posted on Tuesday, July 26, 2016 12:45 PM | Back to top

Comments on this post: Chef: file, remote_file and default setting for "backup" property

# re: Chef: file, remote_file and default setting for "backup" property
Requesting Gravatar...
I respect your work , regards for all the good posts . read this post here
Left by Robinjack on Mar 18, 2018 7:04 AM

Your comment:
 (will show your gravatar)

Copyright © Alex Hildyard | Powered by: