diff options
| author | Paul Berry <paul@puppetlabs.com> | 2011-01-03 15:52:07 -0800 |
|---|---|---|
| committer | Paul Berry <paul@puppetlabs.com> | 2011-01-03 15:52:07 -0800 |
| commit | 68464b79070fdf28b623f1e11beb4908a7be81a7 (patch) | |
| tree | ec93757fc9833fee1e3bc51200499543e90c7396 /lib | |
| parent | 10f89de6e55429fcb055b15a513d01e6e20f03b9 (diff) | |
| parent | 80bfb541f06f36e37fe34d0c1635c317085ea333 (diff) | |
| download | puppet-68464b79070fdf28b623f1e11beb4908a7be81a7.tar.gz puppet-68464b79070fdf28b623f1e11beb4908a7be81a7.tar.xz puppet-68464b79070fdf28b623f1e11beb4908a7be81a7.zip | |
Merge branch 'ticket/2.6.next/5758' into 2.6.next
* ticket/2.6.next/5758:
(#5758) Verify that report events are correctly created
Prep work for #5758: set audited=true on all audit events
Prep work for #5758: clean up initializer for Puppet::Transaction::Event
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/puppet/transaction/event.rb | 5 | ||||
| -rw-r--r-- | lib/puppet/transaction/resource_harness.rb | 10 |
2 files changed, 8 insertions, 7 deletions
diff --git a/lib/puppet/transaction/event.rb b/lib/puppet/transaction/event.rb index 64980f1d9..cd695cff8 100644 --- a/lib/puppet/transaction/event.rb +++ b/lib/puppet/transaction/event.rb @@ -16,10 +16,9 @@ class Puppet::Transaction::Event EVENT_STATUSES = %w{noop success failure audit} - def initialize(*args) + def initialize(options = {}) @audited = false - options = args.last.is_a?(Hash) ? args.pop : ATTRIBUTES.inject({}) { |hash, attr| hash[attr] = args.pop; hash } - options.each { |attr, value| send(attr.to_s + "=", value) unless value.nil? } + options.each { |attr, value| send(attr.to_s + "=", value) } @time = Time.now end diff --git a/lib/puppet/transaction/resource_harness.rb b/lib/puppet/transaction/resource_harness.rb index cb9a193b9..c259d3e05 100644 --- a/lib/puppet/transaction/resource_harness.rb +++ b/lib/puppet/transaction/resource_harness.rb @@ -84,10 +84,12 @@ class Puppet::Transaction::ResourceHarness event.desired_value = property.should event.historical_value = historical_value - if do_audit and historical_value != current_value - event.message = "audit change: previously recorded value #{property.is_to_s(historical_value)} has been changed to #{property.is_to_s(current_value)}" - event.status = "audit" + if do_audit event.audited = true + event.status = "audit" + if historical_value != current_value + event.message = "audit change: previously recorded value #{property.is_to_s(historical_value)} has been changed to #{property.is_to_s(current_value)}" + end end event @@ -96,7 +98,7 @@ class Puppet::Transaction::ResourceHarness def apply_parameter(property, current_value, do_audit, historical_value) event = create_change_event(property, current_value, do_audit, historical_value) - if event.audited && historical_value + if do_audit && historical_value && historical_value != current_value brief_audit_message = " (previously recorded value was #{property.is_to_s(historical_value)})" else brief_audit_message = "" |
