From ee818a96233e62d9c37a117265c6d68f78095689 Mon Sep 17 00:00:00 2001 From: luke Date: Sat, 25 Feb 2006 00:31:34 +0000 Subject: Adding some debugging to list the states being changed when in debug mode git-svn-id: https://reductivelabs.com/svn/puppet/trunk@949 980ebf18-57e1-0310-9a29-db15c13687c0 --- lib/puppet/type.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb index 9a80f18bb..a8cfe592a 100644 --- a/lib/puppet/type.rb +++ b/lib/puppet/type.rb @@ -1655,10 +1655,11 @@ class Type < Puppet::Element def statechanges # If we are changing the existence of the object, then none of # the other states matter. + changes = nil if @states.include?(:ensure) and ! @states[:ensure].insync? #self.info "ensuring %s from %s" % # [@states[:ensure].should, @states[:ensure].is] - return [Puppet::StateChange.new(@states[:ensure])] + changes = [Puppet::StateChange.new(@states[:ensure])] # Else, if the 'ensure' state is correctly absent, then do # nothing elsif @states.include?(:ensure) and @states[:ensure].is == :absent @@ -1671,12 +1672,22 @@ class Type < Puppet::Element #else # self.info "no ensure state" #end - return states().find_all { |state| + changes = states().find_all { |state| ! state.insync? }.collect { |state| Puppet::StateChange.new(state) } end + + if Puppet[:debug] and changes.length > 0 + self.debug("Changing " + changes.collect { |ch| + self.info ch.state.class + ch.state.name + }.join(",") + ) + end + + changes end # this method is responsible for collecting state changes -- cgit