Our latest migration to add resource status information to the metrics
tables was calling the munge method on reports before checking to see
whether the node actually had a report. This commit adds a sanity check
to make sure munge won't be called on a nil object.

Paired-with:Matt Robinson <[email protected]>
Signed-off-by: Max Martin <[email protected]>
---
 ...83820_add_status_column_to_resource_statuses.rb |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git 
a/db/migrate/20110603183820_add_status_column_to_resource_statuses.rb 
b/db/migrate/20110603183820_add_status_column_to_resource_statuses.rb
index 732ac97..58fa311 100644
--- a/db/migrate/20110603183820_add_status_column_to_resource_statuses.rb
+++ b/db/migrate/20110603183820_add_status_column_to_resource_statuses.rb
@@ -6,6 +6,7 @@ class AddStatusColumnToResourceStatuses < 
ActiveRecord::Migration
     # if users want all reports updated they can run the rake task
     Node.all.each do |n|
       last_report = n.last_apply_report
+      next unless last_report
       last_report.munge
       last_report.save!
     end
-- 
1.7.4

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to