| I did some investigation into this issue and it seems like the change would be relatively easy to implement, however, I am not sure on the scope of the impact on implementing the change. To make a change to the logging, we can determine if the change is corrective or intentional prior to sending the log at https://github.com/puppetlabs/puppet/blob/5.5.x/lib/puppet/transaction/resource_harness.rb#L161-L163. A simple edit to this on an agent with the following ternary enabled this change. However, if we were to implement this, we may want it to be optional with a config option to minimize the impact.
if event |
name = param.name.to_s |
event.message ||= _("could not create change error message for %{name}") % { name: name } |
event.calculate_corrective_change(@persistence.get_system_value(context.resource.ref, name)) |
event.message = event.corrective_change ? event.message + ' (corrective)' : event.message + ' (intentional)' |
context.record(event) |
event.send_log |
context.synced_params << param.name |
end
|
The resulting output is as follows.
Notice: /Stage[main]/Test/File[/tmp/test]/ensure: defined content as '{md5}d96f3a8a11eebb06a99e8127833f5d1e' (intentional)
|
Notice: /Stage[main]/Test/File[/tmp/test]/ensure: defined content as '{md5}d96f3a8a11eebb06a99e8127833f5d1e' (corrective)
|
I ran the change through spec tests and at least 42 tests are now failing. I am uncertain what other acceptance tests would depend on the logging, and if there is a better place and way to make this change. An alternative implementation would be to log differently on corrective changes, which is less impactful.
event.calculate_corrective_change(@persistence.get_system_value(context.resource.ref, name)) |
event.message << ' (corrective)' if event.corrective_change
|
The code above results in no failed tests, so it may be an easy change given we add tests for corrective changes. |