On 21/03/11 04:00, Michael Knox wrote: > On 21/03/11 2:22 PM, Daniel Pittman wrote: >> On Sun, Mar 20, 2011 at 15:31, Michael >> Knox<michael.knox...@gmail.com> wrote: >>> On 21/03/11 5:56 AM, Daniel Pittman wrote: >>> Am I correct in understanding that we are writing a temporary copy >>> for the >>> diff, then rewriting the change to the real file separately? >>> >>> Yes >>> >>> If so, could we instead use "rename" to avoid the costly parse/write >>> cycle being run twice per file? >>> >>> Probably, my concern would be the maintenance of file permissions, >>> timestamps etc. >>> I'll have a look and see about reworking the patch to do a "rename" >> >> I kind of assumed that Augeus would do that for us, because it makes >> sense if they have a "write a new file" mode that it would by default >> match the old file. If not ... well, I guess either way would be >> fine, but I wouldn't fight to have it use rename if it was more >> complex. :)
Augeas does preserve file permissions when creating the .augnew file, so a rename make sense. Under the covers when in NOOP or not, Augeas does write out the .augnew file and then compares them to determine whether modifying the tree actually had an effect or not. If it's not in NOOP, it then does a rename back to the original filename (or copies the contents if that fails). So based on the current implementation of Augeas's NOOP mode, the cost of an operation would be the same. > Not in the Augeas's 4 save modes, noop, newfile, backup & overwrite. I > have a half written patch which does a rename of <file>.augnew exists > when executing the changes, but it's beginning to look quite complex (in > comparison) and ugly. If you can do the rename in the execute_changes from the .augnew generated in the need_to_run (within Daniel's bounds of not making it horrible!), I think you'd be making it more efficient and more consistent with Augeas itself. -- Dominic Cleal Red Hat Consulting m: +44 (0)7818 512168 -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to puppet-dev@googlegroups.com. To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.