diff --git a/lib/octocatalog-diff/catalog-diff/differ.rb b/lib/octocatalog-diff/catalog-diff/differ.rb index 3d959fa0..997c8a71 100644 --- a/lib/octocatalog-diff/catalog-diff/differ.rb +++ b/lib/octocatalog-diff/catalog-diff/differ.rb @@ -412,7 +412,7 @@ def ignore_match?(rule_in, diff_type, hsh, old_val, new_val) end # Special 'attributes': Ignore specific diff types (+ add, - remove, ~ and ! change) - if rule[:attr] =~ /\A[\-\+~!]+\Z/ + if rule[:attr].is_a?(String) && rule[:attr] =~ /\A[\-\+~!]+\Z/ return ignore_match_true(hsh, rule) if rule[:attr].include?(diff_type) return false end diff --git a/lib/octocatalog-diff/catalog-diff/display/text.rb b/lib/octocatalog-diff/catalog-diff/display/text.rb index 923f665b..6c522f02 100644 --- a/lib/octocatalog-diff/catalog-diff/display/text.rb +++ b/lib/octocatalog-diff/catalog-diff/display/text.rb @@ -367,12 +367,13 @@ def self.addition_only_no_truncation(depth, hash) # Single line strings hash.keys.sort.map do |key| - next if hash[key] =~ /\n/ + next if hash[key].kind_of?(String) && hash[key] =~ /\n/ result << left_pad(2 * depth + 4, [key.inspect, ': ', hash[key].inspect].join('')).green end # Multi-line strings hash.keys.sort.map do |key| + next if !hash[key].kind_of?(String) next if hash[key] !~ /\n/ result << left_pad(2 * depth + 4, [key.inspect, ': >>>'].join('')).green result.concat hash[key].split(/\n/).map(&:green) diff --git a/lib/octocatalog-diff/catalog-diff/filter/compilation_dir.rb b/lib/octocatalog-diff/catalog-diff/filter/compilation_dir.rb index 5e2747dd..cba3d4dc 100644 --- a/lib/octocatalog-diff/catalog-diff/filter/compilation_dir.rb +++ b/lib/octocatalog-diff/catalog-diff/filter/compilation_dir.rb @@ -66,12 +66,12 @@ def remove_compilation_dir(v, dir) value end - def traverse(a) + def traverse(a, &p) case a when Array - a.map { |v| traverse(v, &Proc.new) } + a.map { |v| traverse(v, &p) } when Hash - traverse(a.values, &Proc.new) + traverse(a.values, &p) else yield a end diff --git a/lib/octocatalog-diff/facts/yaml.rb b/lib/octocatalog-diff/facts/yaml.rb index 35c03342..9879221b 100644 --- a/lib/octocatalog-diff/facts/yaml.rb +++ b/lib/octocatalog-diff/facts/yaml.rb @@ -22,7 +22,7 @@ def self.fact_retriever(options = {}, node = '') fact_file_data[0] = '---' if fact_file_data[0] =~ /^---/ # Load the parsed fact file. - parsed = YAML.load(fact_file_data.join("\n")) + parsed = YAML.load(fact_file_data.join("\n"), permitted_classes: [Time]) # This is a handler for a YAML file that has just the facts and none of the # structure. For example if you saved the output of `facter -y` to a file and diff --git a/spec/octocatalog-diff/tests/catalog-diff/display/text_spec.rb b/spec/octocatalog-diff/tests/catalog-diff/display/text_spec.rb index f05f491c..9d9069d4 100644 --- a/spec/octocatalog-diff/tests/catalog-diff/display/text_spec.rb +++ b/spec/octocatalog-diff/tests/catalog-diff/display/text_spec.rb @@ -254,7 +254,8 @@ 'mode' => '0644', 'content' => 'x' * 150, 'owner' => 'root', - 'group' => 'wheel' + 'group' => 'wheel', + 'force' => true, } } ]