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


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

I like to think of the resource as the thing that is getting created,
not as where it is coming from (otherwise i'd be putting "source" in
the name attribute and in to I would put the destination file that i
want created.

I agree it may make sense to differentiate between create and
replace/update and i can start poking at that.

in my mind though, chef is creating a file, regardless of where the
content comes from, be it a string attribute, a local filesystem file,
a cookbook file, or a remote file. And whether to do template
processing on it should just be a true/false attribute

good to hear a different perspective on these things though, is why i
brought it up

On Mon, Dec 10, 2012 at 1:07 PM, Bryan McLellan 
< >
 wrote:
> 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.

§