HomePhorge

(#11988) Don't overwrite symlinks in augeas provider
dfefc23b744bUnpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

(#11988) Don't overwrite symlinks in augeas provider

Previously, if not running with force set, we would try to write the
file in SAVE_NEWFILE mode to create a <filename>.augnew file with the
changes. We determined whether there were changes to be made based on
that file (and used it to show a diff). When it came time to actually
make the changes, we would simply move the .augnew file over the file
being managed. Unfortunately, if the file being managed were a symlink,
this would clobber it.

There was a fallback path in the case of force (or older versions of
augeas not supporting SAVE_NEWFILE) in which we would make the
changes in SAVE_OVERWRITE mode as normal. Now, the behavior is a
combination of the two; we still use SAVE_NEWFILE to determine whether
changes need to be made and to show a diff, but then remove the .augnew
file and always run again in SAVE_OVERWRITE mode to save the changes.
This effectively delegates the behavior of preserving the file, etc.
to augeas, so we don't duplicate effort or bugs.

Details

Provenance
Nick Lewis <nick@puppetlabs.com>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPUcce6dbfea0b8: Merge pull request #477 from kelseyhightower/ticket/2.7.
Branches
Unknown
Tags
Unknown

Event Timeline

Nick Lewis <nick@puppetlabs.com> committed rPUdfefc23b744b: (#11988) Don't overwrite symlinks in augeas provider (authored by Nick Lewis <nick@puppetlabs.com>).Mar 1 2012, 12:04 AM