[chef-dev] Re: Re: Re: local file copy resource?


Chronological Thread 
  • From: Bryan McLellan < >
  • To: Jesse Campbell < >
  • Cc: Chef Dev < >
  • Subject: [chef-dev] Re: Re: Re: local file copy resource?
  • Date: Mon, 10 Dec 2012 13:07:40 -0500

On Sun, Dec 9, 2012 at 1:44 PM, Jesse Campbell 
< >
 wrote:
> Take a look here:
> https://github.com/jcam/chef/commits/expanded_file_resource

You could create pull request for this sort of patch, even if you're
not done. That would allow people to comment in the PR against the
specific parts of the code.

It looks like #action_create no longer differentiates between creating
a file that doesn't exist and updating the content of a file that does
exist. This seems minor, but my gut tells me it is important for Chef
to know the difference so we can be completely honest with the user
about what we did or are going to do, for purposes like whyrun,
auditing, reporting, etc.

I don't think I like overloading the 'create' action to also be a
'copy' action, differing on if a source file exists or not, as we're
not really creating a file.

In #action_move, you remote the source file if it already matches the
destination file. Conceptually this makes sense, but I'd be pretty
surprised if I asked Chef to move a file and it told me that it
deleted it instead.

#copy reports "create a new cookbook_file 
"
 but
is used in both Chef::File#action_move and Chef::File#action_create
(when copying a file). Again, we need to be accurate in what we're
reporting.

Personally the 'to' attribute made more sense to me than 'source.'
When I think about what I'm copying or what I'm moving, I think what I
am describing is the source, not the destination. But I can totally
see how this is possibly personal preference. We see this in
remote_file, cookbook_file and template today. The resource manages
the destination and there is a source attribute. In link, where we
already deal with two files on disk, we use 'to' since we realized
this made more sense in CHEF-30 [1].

Bryan

[1] http://tickets.opscode.com/browse/CHEF-30



Archive powered by MHonArc 2.6.16.

§