Looking at CHEF 1716 and CHEF-3676, I’m trying to figure out the best
way to implement local file copies.
- The File resource is very simple, and that is a good thing, don’t
want to over load it doing too many things
- CookbookFile is specific to installing files from a cookbook, but is
almost identical to a local file copy. Adding a “local” option as for
1716 doesn’t make sense, simply based on the naming
Here’s a commit that adds the local option and would close 1716:
Here’s Dan DeLeo’s comments:
cookbook_file feels a bit wrong, since we’ve scoped it to have the
functionality of pulling down files from the files/ section of a
Putting it directly in the file resource also seems wrong, since it
doesn’t currently have a concept of a source where the file comes
This leaves two options I can think of:
Add a local option to remote_file. This seems weird, since it’s not
really remote, but it fits with the idea of pulling a file from one
place and putting it somewhere on the local system, just in this case
that somewhere happens to be a file system available to the local box.
Add a local_file resource and provider. This is the best conceptual
fit, and it shouldn’t be too bad to share functionality from other
resources and providers via inheritance and composition. An argument
against is that you’re creating “resource sprawl”.