Skip to content

Commit 09527c2

Browse files
committed
Merge pull request acidprime#8 from raphink/dev/version
Add dating information
2 parents fe29e26 + 25155ee commit 09527c2

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/puppet/catalog-diff/differ.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ def initialize(from, to)
2424

2525
def diff(options = {})
2626
from = []
27+
from_meta = {}
2728
to = []
28-
{ from_file => from, to_file => to}.each do |r,v|
29+
to_meta = {}
30+
{ from_file => [ from, from_meta ], to_file => [ to, to_meta ]}.each do |r,a|
31+
v, m = a
2932
unless File.exist?(r)
3033
raise "Cannot find resources in #{r}"
3134
end
@@ -43,6 +46,8 @@ def diff(options = {})
4346
raise "Provide catalog with the approprtiate file extension, valid extensions are pson, yaml and marshal"
4447
end
4548

49+
m[:version] = tmp.version
50+
4651
if @version == "0.24"
4752
convert24(tmp, v)
4853
else
@@ -63,6 +68,8 @@ def diff(options = {})
6368
titles[:from] = extract_titles(from)
6469

6570
output = {}
71+
output[:old_version] = from_meta[:version]
72+
output[:new_version] = to_meta[:version]
6673
output[:total_resources_in_old] = titles[:from].size
6774
output[:total_resources_in_new] = titles[:to].size
6875

lib/puppet/face/catalog/diff.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@
154154
nodes[:most_changed] = most_changed.reverse.take((options.has_key?(:changed_depth) && options[:changed_depth].to_i || 10))
155155
nodes[:most_differences] = most_differences.reverse.take((options.has_key?(:changed_depth) && options[:changed_depth].to_i || 10))
156156
nodes[:total_nodes] = total_nodes
157+
nodes[:date] = Time.new.to_s
157158
nodes
158159
end
159160

@@ -162,7 +163,7 @@
162163

163164
format = Puppet::CatalogDiff::Formater.new()
164165
nodes.collect do |node,summary|
165-
next if node == :total_percentage or node == :total_nodes or node == :most_changed or node == :with_changes or node == :most_differences or node == :pull_output
166+
next if node == :total_percentage or node == :total_nodes or node == :most_changed or node == :with_changes or node == :most_differences or node == :pull_output or node == :date
166167
format.node_summary_header(node,summary,:node_percentage) + summary.collect do |header,value|
167168
next if value.nil?
168169
if value.is_a?(Hash)

0 commit comments

Comments
 (0)