Paired-With: Nick Lewis <[email protected]>
Signed-off-by: Jesse Wolfe <[email protected]>
---
Local-branch: ticket/next/5174-part2
app/controllers/reports_controller.rb | 6 +++---
app/models/report.rb | 6 +-----
spec/models/report_spec.rb | 4 ++--
3 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/app/controllers/reports_controller.rb
b/app/controllers/reports_controller.rb
index c18dc8b..0e32183 100644
--- a/app/controllers/reports_controller.rb
+++ b/app/controllers/reports_controller.rb
@@ -33,9 +33,9 @@ class ReportsController < InheritedResources::Base
def diff_summary
diff
@resources = {}
- @baseline_report.resources.each do |resource|
- if @diff[resource]
- @resources[resource] = :failed
+ @diff.each do |resource, differences|
+ if ! differences.empty?
+ @resources[resource] = :failure
else
@resources[resource] = :pass
end
diff --git a/app/models/report.rb b/app/models/report.rb
index 953b296..fa12ecd 100644
--- a/app/models/report.rb
+++ b/app/models/report.rb
@@ -69,8 +69,8 @@ class Report < ActiveRecord::Base
comparison_resource = comparison_resources[resource_name] || {}
our_resource = our_resources[resource_name] || {}
(comparison_resource.keys | our_resource.keys).each do |property|
+ diff_stuff[resource_name] ||= {}
if our_resource[property] != comparison_resource[property]
- diff_stuff[resource_name] ||= {}
diff_stuff[resource_name][property.to_sym] = [
our_resource[property], comparison_resource[property] ]
end
end
@@ -78,10 +78,6 @@ class Report < ActiveRecord::Base
diff_stuff
end
- def resources
- self.report.resource_statuses.keys
- end
-
def self.attribute_hash_from(report_hash)
attribute_hash = report_hash.dup
attribute_hash["logs_attributes"] = attribute_hash.delete("logs")
diff --git a/spec/models/report_spec.rb b/spec/models/report_spec.rb
index 5c0c86b..bc9550e 100644
--- a/spec/models/report_spec.rb
+++ b/spec/models/report_spec.rb
@@ -191,10 +191,10 @@ HEREDOC
Report.create_from_yaml report_yaml
end
- it "should produce an empty diff for the same report twice" do
+ it "should produce a diff with no changes for the same report twice" do
report1 = generate_report(Time.now, "file", "foo")
report2 = generate_report(1.week.ago, "file", "foo")
- report1.diff(report2).should == {}
+ report1.diff(report2).should == { "File[/tmp/foo]" => {} }
end
it "should show diff for the different reports" do
--
1.7.0.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.