-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add function modified() to select nodes which are marked as dirty #691
Conversation
I remember talking about something similar a few years ago on the mailing list, but I do like this approach. |
I really like the idea of the It might be better to add a flag |
This change still passes The net result is that there is no additional effort required to find the nodes that have both ie. this PR does not increase the amount of processing required on a As a side-effect, when changing a single node, the corresponding It think this behaviour is 'fair' because the file will actually be written on a save, so it's fair to call the file "modified". This behaviour is shown in the example above, where Do you think this is desirable behaviour, or would you rather that the It would not be hard change the |
You are right - I had misread your PR the first time around, and so I don't have an objection anymore to this. |
This has caused a regression in Puppet's use case: voxpupuli/puppet-augeasproviders_sysctl#65 (comment) has a minimal reproducer. |
@ekohl Thanks fore reporting this, and identifying the commit that provoked the problem. FYI the problem can be reproduced from augtool, too, as follows:
|
Thanks for that and credits to @jay7x for diving into it. |
This Pull Request adds a new boolean function
modified()
to path-expressions.The function
modified()
reads the status if thedirty
flag of the context node,and returns this as a boolean value.
The allows the current tree to be interrogated, showing which nodes have been modified
since they where loaded.
eg:
This Pull Request alters the existing logic around the
dirty
flag in the tree, so that:dirty
, as beforedirty
flag has been preserved by adjusting the logic as required.eg
The 1st set command does not change the existing value, so the node is not marked as
dirty
The 2nd set command changes the node
alias[2]
and only this node and it's corresponding file-node/files/etc/hosts
are marked asdirty
Only nodes with the
dirty
flag set are selected by the functionmodified()