diff options
| author | Jesse Wolfe <jes5199@gmail.com> | 2011-04-19 14:58:22 -0700 |
|---|---|---|
| committer | Jesse Wolfe <jes5199@gmail.com> | 2011-04-21 18:08:07 -0700 |
| commit | 5c245418115396df655f86065d2d1d3af62e39ee (patch) | |
| tree | f73749f970b3b6358015a523a1d770cda7f5bd9c /lib | |
| parent | 311e3ec762bc6863367d5d6ac6548d02a2d78e03 (diff) | |
| download | puppet-5c245418115396df655f86065d2d1d3af62e39ee.tar.gz puppet-5c245418115396df655f86065d2d1d3af62e39ee.tar.xz puppet-5c245418115396df655f86065d2d1d3af62e39ee.zip | |
Fix #7084 Make the log messages produced by whits less confusing
This patch changes the logging behavior of Whits so that instead of
talking about whits directly, we refer to the Class, Stage, or recursive
resource that they are sentinals for.
In the case where a "completion" Whit is notified by a resource, getting
a notification at all is counterinutitive, so I've changed the output to
a "debug"-priority message that describes what's happening.
Reviewed-By: Nick Lewis <nick@puppetlabs.com>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/puppet/resource/catalog.rb | 14 | ||||
| -rw-r--r-- | lib/puppet/transaction/event_manager.rb | 17 | ||||
| -rw-r--r-- | lib/puppet/type/whit.rb | 8 |
3 files changed, 29 insertions, 10 deletions
diff --git a/lib/puppet/resource/catalog.rb b/lib/puppet/resource/catalog.rb index a6cff9bdc..b742d283f 100644 --- a/lib/puppet/resource/catalog.rb +++ b/lib/puppet/resource/catalog.rb @@ -74,7 +74,7 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph raise ArgumentError, "Can only add objects that respond to :ref, not instances of #{resource.class}" unless resource.respond_to?(:ref) fail_on_duplicate_type_and_title(resource) title_key = title_key_for_ref(resource.ref) - + @transient_resources << resource if applying? @resource_table[title_key] = resource @@ -339,8 +339,8 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph @relationship_graph end - # Impose our container information on another graph by using it - # to replace any container vertices X with a pair of verticies + # Impose our container information on another graph by using it + # to replace any container vertices X with a pair of verticies # { admissible_X and completed_X } such that that # # 0) completed_X depends on admissible_X @@ -353,8 +353,8 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph # Note that this requires attention to the possible case of containers # which contain or depend on other containers, but has the advantage # that the number of new edges created scales linearly with the number - # of contained verticies regardless of how containers are related; - # alternatives such as replacing container-edges with content-edges + # of contained verticies regardless of how containers are related; + # alternatives such as replacing container-edges with content-edges # scale as the product of the number of external dependences, which is # to say geometrically in the case of nested / chained containers. # @@ -374,8 +374,8 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph admissible = Hash.new { |h,k| k } completed = Hash.new { |h,k| k } containers.each { |x| - admissible[x] = whit_class.new(:name => "admissible_#{x.name}", :catalog => self) - completed[x] = whit_class.new(:name => "completed_#{x.name}", :catalog => self) + admissible[x] = whit_class.new(:name => "admissible_#{x.ref}", :catalog => self) + completed[x] = whit_class.new(:name => "completed_#{x.ref}", :catalog => self) } # # Implement the six requierments listed above diff --git a/lib/puppet/transaction/event_manager.rb b/lib/puppet/transaction/event_manager.rb index f5da870ed..8f1a695af 100644 --- a/lib/puppet/transaction/event_manager.rb +++ b/lib/puppet/transaction/event_manager.rb @@ -62,7 +62,18 @@ class Puppet::Transaction::EventManager end def queue_events_for_resource(source, target, callback, events) - source.info "Scheduling #{callback} of #{target}" + whit = Puppet::Type.type(:whit) + + # The message that a resource is refreshing the completed-whit for its own class + # is extremely counter-intuitive. Basically everything else is easy to understand, + # if you suppress the whit-lookingness of the whit resources + refreshing_c_whit = target.is_a?(whit) && target.name =~ /^completed_/ + + if refreshing_c_whit + source.debug "The container #{target} will propagate my #{callback} event" + else + source.info "Scheduling #{callback} of #{target}" + end @event_queues[target] ||= {} @event_queues[target][callback] ||= [] @@ -82,7 +93,9 @@ class Puppet::Transaction::EventManager 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" + if not resource.is_a?(Puppet::Type.type(:whit)) + resource.notice "Triggered '#{callback}' from #{events.length} events" + end return true rescue => detail resource.err "Failed to call #{callback}: #{detail}" diff --git a/lib/puppet/type/whit.rb b/lib/puppet/type/whit.rb index 55ed0386e..4c77915b3 100644 --- a/lib/puppet/type/whit.rb +++ b/lib/puppet/type/whit.rb @@ -5,8 +5,14 @@ Puppet::Type.newtype(:whit) do desc "The name of the whit, because it must have one." end + + # Hide the fact that we're a whit from logs def to_s - "(#{name})" + name.sub(/^completed_|^admissible_/, "") + end + + def path + to_s end def refresh |
