knife-inspect 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5e648a13d315a3c1c9da0ec48d1560d7c4a4dabd
4
- data.tar.gz: 9ef1e150143ffff406ba9d667b01791215d91bb8
3
+ metadata.gz: c914c55c5bab76001d767fb579b224e41b440476
4
+ data.tar.gz: 837f0149b53a1c26a4966eace58a4be204e65992
5
5
  SHA512:
6
- metadata.gz: 0db7de2d55926ada9f92bc65571f8fa31310389d88abee342bec923f8b4545324a5b4a8b80ca997cb2ff96993259ecc7a5e60dda06a45369d6d912edf8ec248d
7
- data.tar.gz: 8c9a7d1fe7166a465b741e729c740da9bb4c761fcd2fb0dd681b2da2b7120ce9402c41984f41a4f4036226a8ee6a0d9b4b2fbf5bce77f9e69e2ba3653733fead
6
+ metadata.gz: 60e89b16ba9c72e8ebd04415fc6f7f582af5c7d939bfb6cec4a22ab1fe79d4b7b9cdcb90389403a8b69d6e3fb75aca0d82c9d0fd968011c5271b08840dbd0304
7
+ data.tar.gz: 0cd0462d49ac645f86f5c51c481779e6404f4a0de981b51fb54b884828f1a036a18b40ad0c93dee51bc38170c3c450f710906449b3d8d294f0b27fb84f4d49bf
data/.travis.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
- - 2.1.2
4
+ - 2.1
5
5
  env:
6
6
  - CHEF_VERSION=10.32.2
7
7
  - CHEF_VERSION=11.14.2
data/HISTORY.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.11.0 ( 2014-10-27 )
2
+
3
+ * Bug fix: recursive diff would stop if two keys were identical between local
4
+ and server ([#23][#23])
5
+
6
+
1
7
  ## 0.10.0 ( 2014-10-13 )
2
8
 
3
9
  * Feature: Support cookbooks that only have a `metadata.json` file but no
@@ -157,3 +163,4 @@ instead.
157
163
  [#25]: https://github.com/bmarini/knife-inspect/issues/25
158
164
  [#5]: https://github.com/bmarini/knife-inspect/issues/5
159
165
  [#27]: https://github.com/bmarini/knife-inspect/issues/27
166
+ [#23]: https://github.com/bmarini/knife-inspect/issues/23
@@ -1,5 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  require 'pathname'
3
+ require 'yajl'
3
4
  require 'parallel'
4
5
 
5
6
  module HealthInspector
@@ -1,4 +1,5 @@
1
1
  require 'chef/data_bag'
2
+ require 'yajl'
2
3
 
3
4
  module HealthInspector
4
5
  module Checklists
@@ -1,5 +1,4 @@
1
1
  require 'chef/role'
2
- require 'yajl'
3
2
 
4
3
  module HealthInspector
5
4
  module Checklists
@@ -53,13 +53,13 @@ module HealthInspector
53
53
 
54
54
  def recursive_diff(original, other)
55
55
  (original.keys + other.keys).uniq.reduce({}) do |memo, key|
56
- return memo if original[key] == other[key]
57
-
58
- if original[key].is_a?(Hash) && other[key].is_a?(Hash)
59
- diff = recursive_diff(original[key], other[key])
60
- memo[key] = diff unless diff.empty?
61
- else
62
- memo[key] = { 'server' => original[key], 'local' => other[key] }
56
+ unless original[key] == other[key]
57
+ if original[key].is_a?(Hash) && other[key].is_a?(Hash)
58
+ diff = recursive_diff(original[key], other[key])
59
+ memo[key] = diff unless diff.empty?
60
+ else
61
+ memo[key] = { 'server' => original[key], 'local' => other[key] }
62
+ end
63
63
  end
64
64
 
65
65
  memo
@@ -1,3 +1,3 @@
1
1
  module HealthInspector
2
- VERSION = '0.10.0'
2
+ VERSION = '0.11.0'
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -97,6 +97,21 @@ RSpec.shared_examples 'a chef model that can be represented in json' do
97
97
  expect(pairing.errors.first).to eq(expected_errors)
98
98
  end
99
99
 
100
+ it 'detects differences when the other keys are identical' do
101
+ pairing.server = { 'name' => 'bar', 'foo' => { 'bar' => { 'fizz' => 'buzz' } } }
102
+ pairing.local = { 'name' => 'bar', 'foo' => { 'baz' => { 'fizz' => 'buzz' } } }
103
+ pairing.validate
104
+
105
+ expect(pairing.errors).not_to be_empty
106
+ expected_errors = {
107
+ 'foo' => {
108
+ 'bar' => { 'server' => { 'fizz' => 'buzz' }, 'local' => nil },
109
+ 'baz' => { 'server' => nil, 'local' => { 'fizz' => 'buzz' } }
110
+ }
111
+ }
112
+ expect(pairing.errors.first).to eq(expected_errors)
113
+ end
114
+
100
115
  it 'detects if an item is the same' do
101
116
  pairing.server = { 'foo' => 'bar' }
102
117
  pairing.local = { 'foo' => 'bar' }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-inspect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Karékinian
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-13 00:00:00.000000000 Z
12
+ date: 2014-10-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake