Paired-with: Jesse Wolfe <[email protected]>
Signed-off-by: Paul Berry <[email protected]>
---
Local-branch: ticket/next/5743
...2_add_out_of_sync_count_to_resource_statuses.rb | 9 +++++++++
db/schema.rb | 3 ++-
lib/report_transformer.rb | 1 +
spec/lib/report_transformer_spec.rb | 7 +++++++
4 files changed, 19 insertions(+), 1 deletions(-)
create mode 100644
db/migrate/20110105015322_add_out_of_sync_count_to_resource_statuses.rb
diff --git
a/db/migrate/20110105015322_add_out_of_sync_count_to_resource_statuses.rb
b/db/migrate/20110105015322_add_out_of_sync_count_to_resource_statuses.rb
new file mode 100644
index 0000000..bac6806
--- /dev/null
+++ b/db/migrate/20110105015322_add_out_of_sync_count_to_resource_statuses.rb
@@ -0,0 +1,9 @@
+class AddOutOfSyncCountToResourceStatuses < ActiveRecord::Migration
+ def self.up
+ add_column :resource_statuses, :out_of_sync_count, :integer
+ end
+
+ def self.down
+ remove_column :resource_statuses, :out_of_sync_count
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index f1ab6ed..89aebe8 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control
system.
-ActiveRecord::Schema.define(:version => 20101230054456) do
+ActiveRecord::Schema.define(:version => 20110105015322) do
create_table "assignments", :force => true do |t|
t.integer "node_id"
@@ -152,6 +152,7 @@ ActiveRecord::Schema.define(:version => 20101230054456) do
t.datetime "time"
t.integer "change_count"
t.boolean "out_of_sync"
+ t.integer "out_of_sync_count"
end
add_index "resource_statuses", ["report_id"], :name =>
"index_resource_statuses_on_report_id"
diff --git a/lib/report_transformer.rb b/lib/report_transformer.rb
index 3ac44fa..7d0554f 100644
--- a/lib/report_transformer.rb
+++ b/lib/report_transformer.rb
@@ -54,6 +54,7 @@ class ReportTransformer::OneToTwo <
ReportTransformer::ReportTransformation
report["kind"] = "apply"
report["puppet_version"] ||= puppet_version(report) # If it started as a
v0 report, we've already filled in puppet_version
report["resource_statuses"].values.each do |resource_status|
+ resource_status["out_of_sync_count"] = resource_status["change_count"]
resource_status.delete("version")
end
report["logs"].each do |log|
diff --git a/spec/lib/report_transformer_spec.rb
b/spec/lib/report_transformer_spec.rb
index 4bd67a5..88a20bb 100644
--- a/spec/lib/report_transformer_spec.rb
+++ b/spec/lib/report_transformer_spec.rb
@@ -147,5 +147,12 @@ describe ReportTransformer do
report = ReportTransformer::OneToTwo.apply(@report)
@report['kind'].should == 'apply'
end
+
+ it "should set resource out_of_sync_counts based on change_counts" do
+ report = ReportTransformer::OneToTwo.apply(@report)
+ @report["resource_statuses"].values.each do |resource_status|
+ resource_status["out_of_sync_count"].should ==
resource_status["change_count"]
+ end
+ end
end
end
--
1.7.2
--
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.