Skip to content

Commit

Permalink
Ignore parameters (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphink authored May 5, 2020
1 parent 798829b commit f5cc348
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
11 changes: 11 additions & 0 deletions lib/puppet/catalog-diff/comparer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ def compare_resources(old, new, options)
#resource[:parameters].delete(:command) unless new_resource[:parameters].include?(:command)
#resource[:parameters].delete(:path) unless new_resource[:parameters].include?(:path)

if options[:ignore_parameters]
blacklist = options[:ignore_parameters].split(',')
filter_parameters!(new_resource[:parameters], blacklist)
filter_parameters!(resource[:parameters], blacklist)
end

sort_dependencies!(new_resource[:parameters])
sort_dependencies!(resource[:parameters])

Expand Down Expand Up @@ -82,6 +88,11 @@ def compare_resources(old, new, options)
resource_differences
end

# filter parameters
def filter_parameters!(params, blacklist)
params.reject! { |p, k| blacklist.include?(p.to_s) }
end

# sort require/before/notify/subscribe before comparison
def sort_dependencies!(params)
params.each do |x|
Expand Down
1 change: 0 additions & 1 deletion lib/puppet/catalog-diff/differ.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def diff(options = {})
end
end


Puppet.debug("Processing: #{from_file}")
titles = {}
titles[:to] = extract_titles(to)
Expand Down
4 changes: 4 additions & 0 deletions lib/puppet/face/catalog/diff.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
summary 'Do not print classes in resource diffs'
end

option '--ignore_parameters=' do
summary 'A comma-separated list of resource parameters to ignore in diff'
end

option "--filter_local" do
summary "Use local YAML node files to filter out queried nodes"
end
Expand Down

0 comments on commit f5cc348

Please sign in to comment.