Feature #5400
Augeas resources should print changes to the tree during a --noop -t run
| Status: | Duplicate | Start date: | 11/26/2010 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | augeas | |||
| Target version: | - | |||
| Affected Puppet version: | Branch: | |||
| Keywords: | augeas dry-run noop | |||
| Votes: | 2 |
Description
I often use puppetd --environment=test --noop -t to sanity check a change, and the output is generally helpful. I appreciate that Exec resources are too open-ended and unpredictable, but it seems that Augeas resources present an opportunity for dry-run feedback.
It should be possible to get the tree for a resource, apply the changes list, and then diff the new tree against the old one. Then you can bail out without saving, and report the results back to the summary.
This won’t tell you exactly what changes will happen on disk, to be sure, but you’ll learn which entries are being replaced with what in the tree. That’s incredibly valuable.
History
Updated by James Turnbull over 1 year ago
- Status changed from Unreviewed to Needs Decision
- Assignee set to Bryan Kearney
Updated by Bryan Kearney over 1 year ago
We do this already to see if we need to run. James, does the engine take care of not calling execute_changes in a no-op or does the provider need to do that?
Updated by James Turnbull over 1 year ago
It should be the engine.
Updated by Nick Moffitt over 1 year ago
I have just noticed augtool’s -n switch, and wonder if a similar approach might make actual file diffs feasible.
Updated by Michael Knox about 1 year ago
This seems to be very similar to feature request #2728.
I’ve create a patch for #2728 which may also address this issue.
https://github.com/mikeknox/puppet/commit/33301966d4c803640cb9aaed13b81bd7fd285484
Sample output:
info: Augeas[my.cnf/mysqld](provider=augeas): --- /etc/my.cnf 2011-03-18 18:09:46.343264543 +1100 +++ /etc/my.cnf.augnew 2011-03-18 21:29:39.706254147 +1100 @@ -133,7 +133,7 @@ character-set-server=utf8 log-warnings=1 skip-external-locking=1 -log-error=/var/log/mysql.log +log-error=/var/log/mysql.err set=log-slow-queries key_buffer=16M table_cache=64 notice: /Stage[main]/Mysql::Server/Augeas[my.cnf/mysqld]/returns: is need_to_run, should be 0 (noop)
Updated by Josh Cooper 12 months ago
We merged in changes for #2728 yesterday (in 2.7.x), which displays file diffs in noop mode. Can you confirm that this satisfies your requirements and we can mark this as a duplicate?
Updated by Nick Moffitt 12 months ago
Josh Cooper wrote:
We merged in changes for #2728 yesterday (in 2.7.x), which displays file diffs in noop mode. Can you confirm that this satisfies your requirements and we can mark this as a duplicate?
It’s difficult to tell, as the lack of noop diffs helped us rule out augeas for our needs. On the face of it, I’d say these two tickets can be merged completely.
Updated by Dominic Cleal 6 months ago
- Status changed from Needs Decision to Duplicate
The fix for #2728 should cover this as it implements the diff of the file contents.