Search code examples
rubychef-infrachef-recipechef-solocookbook

Is remote_file Chef resource idempotent by default?


I want to ask if remote_file is idempotent by default.

In other words, can I use the remote_file resource such that the chef-client does not download the file if file size is same.

I was looking at documentation, its confusing at some places it says use_conditional_get , but again there are no examples on how to use it.


Solution

  • Yes, use_etags and use_last_modified (use_conditional_get is a shortcut for both of those) are both enabled by default: https://github.com/chef/chef/blob/master/lib/chef/resource/remote_file.rb#L34-L35