On 04/10/2011 17:28, no-re...@cfengine.com wrote:
> Forum: CFEngine Help
> Subject: Re: "expand_scalars" in "copy_from"?
> Author: davidlee
> Link to topic: https://cfengine.com/forum/read.php?3,23643,23671#msg-23671
>
> Neil, your point about locally caching the template file (separating copy and 
> edit stages) is worth consideration.
>
> But in the other direction there is an as yet unmentioned point in favour of 
> a single "copy-then-edit".  With "copy_from", sites can make extensive use of 
> "preserve" to maintain the permissions of the master file onto the copy on 
> the clients.  When there is a set of several files, needing a variety of 
> different permissions, using "preserve" is both very clean and very clear.
>
> Sadly, forcing apart the copy and the edit phases of this suggested 
> "copy-and-edit" into two separate stages makes that more awkward. Yes, it can 
> be achieved by specifying the mode as an explicit number  in the cfengine 
> promises.  But for a set of files, all that has to be spelt out explicitly by 
> a mode clause per file; one is, alas, unable to use that clean, clear  
> "preserve" clause.
>
> The existing mechanism denies this possibility.  It would be very nice if 
> this were available to use.
>
The problem of copy-and-edit is that the agent will have to copy the 
remote file at each execution, and then expand the scalar to compare 
with the content of the file; it is not possible to keep a track of what 
was the file before the editing ... I means that each time, the file 
would need to be sent over the network (if the server is unreachable, it 
is a problem, if the file is big, it is a problem), and detect 
modification on the template file would be more complex

On the other hand, first copying the template on a local location then 
editing a file based on this template is less resource-eater :
- the template on the remote and the local are the same, it's easy to 
check for difference.
- if the server is down or unreachable, it would still work
- it's easy to expand the scalar on a local file to check if the content 
is the same than the file to be edited

You rule out most of the issues, and you will know if :
- the template change (reparation of the first promise)
- the file has been tampered with (reparation of the second, but not the 
first one)

Regards
Nicolas
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to