summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/property.rb5
-rw-r--r--lib/puppet/transaction.rb7
-rw-r--r--lib/puppet/type.rb6
3 files changed, 12 insertions, 6 deletions
diff --git a/lib/puppet/property.rb b/lib/puppet/property.rb
index bb58caf5e..9d50dcf6a 100644
--- a/lib/puppet/property.rb
+++ b/lib/puppet/property.rb
@@ -155,10 +155,9 @@ class Puppet::Property < Puppet::Parameter
end).to_sym
end
- # Create our event object.
+ # Return a modified form of the resource event.
def event
- Puppet::Transaction::Event.new(:name => event_name, :resource => resource.ref, :desired_value => should,
- :file => file, :line => line, :tags => tags, :property => name, :version => version)
+ resource.event :name => event_name, :desired_value => should, :property => name
end
attr_reader :shadow
diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb
index a5feecbc2..0a26e33fe 100644
--- a/lib/puppet/transaction.rb
+++ b/lib/puppet/transaction.rb
@@ -409,7 +409,7 @@ class Puppet::Transaction
end
if restarted
- queue_event(resource, Puppet::Transaction::Event.new(:restarted, resource))
+ queue_event(resource, resource.event(:name => :restarted, :status => "success"))
@resourcemetrics[:restarted] += 1
end
@@ -544,7 +544,8 @@ class Puppet::Transaction
end
def process_callback(resource, callback, events)
- process_noop_events(resource, callback, events) and return false if events.detect { |e| e.name == :noop }
+ # XXX Should it be any event, or all events?
+ process_noop_events(resource, callback, events) and return false unless events.detect { |e| e.status != "noop" }
resource.send(callback)
resource.notice "Triggered '#{callback}' from #{events.length} events"
@@ -561,7 +562,7 @@ class Puppet::Transaction
resource.notice "Would have triggered '#{callback}' from #{events.length} events"
# And then add an event for it.
- queue_event(resource, Puppet::Transaction::Event.new(:noop, resource))
+ queue_event(resource, resource.event(:status => "noop", :name => :noop_restart))
true # so the 'and if' works
end
end
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
index 84f0b93d0..2512c72d3 100644
--- a/lib/puppet/type.rb
+++ b/lib/puppet/type.rb
@@ -484,6 +484,12 @@ class Type
}
end
+ # Create a transaction event. Called by Transaction or by
+ # a property.
+ def event(options = {})
+ Puppet::Transaction::Event.new({:resource => ref, :file => file, :line => line, :tags => tags, :version => version}.merge(options))
+ end
+
# Let the catalog determine whether a given cached value is
# still valid or has expired.
def expirer