chef-zero 1.2 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
data/lib/chef_zero.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
module ChefZero
|
2
|
-
require 'chef_zero/core_ext'
|
3
2
|
require 'chef_zero/log'
|
4
3
|
|
5
4
|
CERTIFICATE = "-----BEGIN CERTIFICATE-----\nMIIDMzCCApygAwIBAgIBATANBgkqhkiG9w0BAQUFADCBnjELMAkGA1UEBhMCVVMx\nEzARBgNVBAgMCldhc2hpbmd0b24xEDAOBgNVBAcMB1NlYXR0bGUxFjAUBgNVBAoM\nDU9wc2NvZGUsIEluYy4xHDAaBgNVBAsME0NlcnRpZmljYXRlIFNlcnZpY2UxMjAw\nBgNVBAMMKW9wc2NvZGUuY29tL2VtYWlsQWRkcmVzcz1hdXRoQG9wc2NvZGUuY29t\nMB4XDTEyMTEyMTAwMzQyMVoXDTIyMTExOTAwMzQyMVowgZsxEDAOBgNVBAcTB1Nl\nYXR0bGUxEzARBgNVBAgTCldhc2hpbmd0b24xCzAJBgNVBAYTAlVTMRwwGgYDVQQL\nExNDZXJ0aWZpY2F0ZSBTZXJ2aWNlMRYwFAYDVQQKEw1PcHNjb2RlLCBJbmMuMS8w\nLQYDVQQDFCZVUkk6aHR0cDovL29wc2NvZGUuY29tL0dVSURTL3VzZXJfZ3VpZDCC\nASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANLDmPbR71bS2esZlZh/HfC6\n0azXFjl2677wq2ovk9xrUb0Ui4ZLC66TqQ9C/RBzOjXU4TRf3hgPTqvlCgHusl0d\nIcLCrsSl6kPEhJpYWWfRoroIAwf82A9yLQekhqXZEXu5EKkwoUMqyF6m0ZCasaE1\ny8niQxdLAsk3ady/CGQlFqHTPKFfU5UASR2LRtYC1MCIvJHDFRKAp9kPJbQo9P37\nZ8IU7cDudkZFgNLmDixlWsh7C0ghX8fgAlj1P6FgsFufygam973k79GhIP54dELB\nc0S6E8ekkRSOXU9jX/IoiXuFglBvFihAdhvED58bMXzj2AwXUyeAlxItnvs+NVUC\nAwEAATANBgkqhkiG9w0BAQUFAAOBgQBkFZRbMoywK3hb0/X7MXmPYa7nlfnd5UXq\nr2n32ettzZNmEPaI2d1j+//nL5qqhOlrWPS88eKEPnBOX/jZpUWOuAAddnrvFzgw\nrp/C2H7oMT+29F+5ezeViLKbzoFYb4yECHBoi66IFXNae13yj7taMboBeUmE664G\nTB/MZpRr8g==\n-----END CERTIFICATE-----\n"
|
@@ -63,10 +63,10 @@ module ChefZero
|
|
63
63
|
def expand_for_indexing(value, index, id)
|
64
64
|
if index == 'node'
|
65
65
|
result = {}
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
66
|
+
deep_merge!(value['default'] || {}, result)
|
67
|
+
deep_merge!(value['normal'] || {}, result)
|
68
|
+
deep_merge!(value['override'] || {}, result)
|
69
|
+
deep_merge!(value['automatic'] || {}, result)
|
70
70
|
result['recipe'] = []
|
71
71
|
result['role'] = []
|
72
72
|
if value['run_list']
|
@@ -131,6 +131,58 @@ module ChefZero
|
|
131
131
|
'total' => total
|
132
132
|
}
|
133
133
|
end
|
134
|
+
|
135
|
+
private
|
136
|
+
|
137
|
+
# Deep Merge core documentation.
|
138
|
+
# deep_merge! method permits merging of arbitrary child elements. The two top level
|
139
|
+
# elements must be hashes. These hashes can contain unlimited (to stack limit) levels
|
140
|
+
# of child elements. These child elements to not have to be of the same types.
|
141
|
+
# Where child elements are of the same type, deep_merge will attempt to merge them together.
|
142
|
+
# Where child elements are not of the same type, deep_merge will skip or optionally overwrite
|
143
|
+
# the destination element with the contents of the source element at that level.
|
144
|
+
# So if you have two hashes like this:
|
145
|
+
# source = {:x => [1,2,3], :y => 2}
|
146
|
+
# dest = {:x => [4,5,'6'], :y => [7,8,9]}
|
147
|
+
# dest.deep_merge!(source)
|
148
|
+
# Results: {:x => [1,2,3,4,5,'6'], :y => 2}
|
149
|
+
# By default, "deep_merge!" will overwrite any unmergeables and merge everything else.
|
150
|
+
# To avoid this, use "deep_merge" (no bang/exclamation mark)
|
151
|
+
def deep_merge!(source, dest)
|
152
|
+
# if dest doesn't exist, then simply copy source to it
|
153
|
+
if dest.nil?
|
154
|
+
dest = source; return dest
|
155
|
+
end
|
156
|
+
|
157
|
+
case source
|
158
|
+
when nil
|
159
|
+
dest
|
160
|
+
when Hash
|
161
|
+
source.each do |src_key, src_value|
|
162
|
+
if dest.kind_of?(Hash)
|
163
|
+
if dest[src_key]
|
164
|
+
dest[src_key] = deep_merge!(src_value, dest[src_key])
|
165
|
+
else # dest[src_key] doesn't exist so we take whatever source has
|
166
|
+
dest[src_key] = src_value
|
167
|
+
end
|
168
|
+
else # dest isn't a hash, so we overwrite it completely
|
169
|
+
dest = source
|
170
|
+
end
|
171
|
+
end
|
172
|
+
when Array
|
173
|
+
if dest.kind_of?(Array)
|
174
|
+
dest = dest | source
|
175
|
+
else
|
176
|
+
dest = source
|
177
|
+
end
|
178
|
+
when String
|
179
|
+
dest = source
|
180
|
+
else # src_hash is not an array or hash, so we'll have to overwrite dest
|
181
|
+
dest = source
|
182
|
+
end
|
183
|
+
dest
|
184
|
+
end # deep_merge!
|
185
|
+
|
134
186
|
end
|
135
187
|
end
|
136
188
|
end
|
data/lib/chef_zero/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-zero
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: puma
|
@@ -103,8 +103,6 @@ files:
|
|
103
103
|
- README.md
|
104
104
|
- Rakefile
|
105
105
|
- lib/chef_zero/cookbook_data.rb
|
106
|
-
- lib/chef_zero/core_ext/hash.rb
|
107
|
-
- lib/chef_zero/core_ext.rb
|
108
106
|
- lib/chef_zero/data_normalizer.rb
|
109
107
|
- lib/chef_zero/data_store/chef_fs_store.rb
|
110
108
|
- lib/chef_zero/data_store/data_already_exists_error.rb
|
data/lib/chef_zero/core_ext.rb
DELETED