chef 11.12.0-x86-mingw32 → 11.12.2-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chef/cookbook/syntax_check.rb +6 -1
- data/lib/chef/http.rb +7 -9
- data/lib/chef/http/basic_client.rb +9 -0
- data/lib/chef/version.rb +1 -1
- data/spec/data/cookbooks/openldap/recipes/default.rb +1 -0
- data/spec/data/cookbooks/openldap/recipes/return.rb +2 -0
- data/spec/unit/cookbook/syntax_check_spec.rb +5 -4
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8569627190d2efc4f966d9a016c1816bc865826
|
4
|
+
data.tar.gz: 158cc0a37657509979c45c548fc62554a9819444
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca943559b89c38f60aec250a527ce38f7d2aac0f76e4c1dab2de78986b7612660aa614d7f3cc4f09803446520d7f2698cd4aa7a705708e7585c8f2c77c71b13c
|
7
|
+
data.tar.gz: 00b109ada95a45d2782b105fd6c596aab4597638e8ae04c556c34b22a12c63630377ee80389841581b3aa8f90defff897f0e6d97c8166058d552af4cecb54c0f
|
@@ -247,7 +247,12 @@ class Chef
|
|
247
247
|
tmp_stderr = $stderr = StringIO.new
|
248
248
|
abs_path = File.expand_path(ruby_file)
|
249
249
|
file_content = IO.read(abs_path)
|
250
|
-
|
250
|
+
# We have to wrap this in a block so the user code evaluates in a
|
251
|
+
# similar context as what Chef does normally. Otherwise RubyVM
|
252
|
+
# will reject some common idioms, like using `return` to end evaluation
|
253
|
+
# of a recipe. See also CHEF-5199
|
254
|
+
wrapped_content = "Object.new.instance_eval do\n#{file_content}\nend\n"
|
255
|
+
RubyVM::InstructionSequence.new(wrapped_content, ruby_file, abs_path, 0)
|
251
256
|
true
|
252
257
|
rescue SyntaxError
|
253
258
|
$stderr = old_stderr
|
data/lib/chef/http.rb
CHANGED
@@ -50,7 +50,10 @@ class Chef
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def handle_chunk(next_chunk)
|
53
|
-
|
53
|
+
# stream handlers handle responses so must be applied in reverse order
|
54
|
+
# (same as #apply_stream_complete_middleware or #apply_response_midddleware)
|
55
|
+
@stream_handlers.reverse.inject(next_chunk) do |chunk, handler|
|
56
|
+
Chef::Log.debug("Chef::HTTP::StreamHandler calling #{handler.class}#handle_chunk")
|
54
57
|
handler.handle_chunk(chunk)
|
55
58
|
end
|
56
59
|
end
|
@@ -210,18 +213,21 @@ class Chef
|
|
210
213
|
|
211
214
|
def apply_request_middleware(method, url, headers, data)
|
212
215
|
middlewares.inject([method, url, headers, data]) do |req_data, middleware|
|
216
|
+
Chef::Log.debug("Chef::HTTP calling #{middleware.class}#handle_request")
|
213
217
|
middleware.handle_request(*req_data)
|
214
218
|
end
|
215
219
|
end
|
216
220
|
|
217
221
|
def apply_response_middleware(response, rest_request, return_value)
|
218
222
|
middlewares.reverse.inject([response, rest_request, return_value]) do |res_data, middleware|
|
223
|
+
Chef::Log.debug("Chef::HTTP calling #{middleware.class}#handle_response")
|
219
224
|
middleware.handle_response(*res_data)
|
220
225
|
end
|
221
226
|
end
|
222
227
|
|
223
228
|
def apply_stream_complete_middleware(response, rest_request, return_value)
|
224
229
|
middlewares.reverse.inject([response, rest_request, return_value]) do |res_data, middleware|
|
230
|
+
Chef::Log.debug("Chef::HTTP calling #{middleware.class}#handle_stream_complete")
|
225
231
|
middleware.handle_stream_complete(*res_data)
|
226
232
|
end
|
227
233
|
end
|
@@ -253,14 +259,6 @@ class Chef
|
|
253
259
|
end
|
254
260
|
@last_response = response
|
255
261
|
|
256
|
-
Chef::Log.debug("---- HTTP Status and Header Data: ----")
|
257
|
-
Chef::Log.debug("HTTP #{response.http_version} #{response.code} #{response.msg}")
|
258
|
-
|
259
|
-
response.each do |header, value|
|
260
|
-
Chef::Log.debug("#{header}: #{value}")
|
261
|
-
end
|
262
|
-
Chef::Log.debug("---- End HTTP Status/Header Data ----")
|
263
|
-
|
264
262
|
if response.kind_of?(Net::HTTPSuccess)
|
265
263
|
[response, request, return_value]
|
266
264
|
elsif response.kind_of?(Net::HTTPNotModified) # Must be tested before Net::HTTPRedirection because it's subclass.
|
@@ -61,7 +61,16 @@ class Chef
|
|
61
61
|
base_headers.each do |name, value|
|
62
62
|
Chef::Log.debug("#{name}: #{value}")
|
63
63
|
end
|
64
|
+
Chef::Log.debug("---- End HTTP Request Header Data ----")
|
64
65
|
http_client.request(http_request) do |response|
|
66
|
+
Chef::Log.debug("---- HTTP Status and Header Data: ----")
|
67
|
+
Chef::Log.debug("HTTP #{response.http_version} #{response.code} #{response.msg}")
|
68
|
+
|
69
|
+
response.each do |header, value|
|
70
|
+
Chef::Log.debug("#{header}: #{value}")
|
71
|
+
end
|
72
|
+
Chef::Log.debug("---- End HTTP Status/Header Data ----")
|
73
|
+
|
65
74
|
yield response if block_given?
|
66
75
|
# http_client.request may not have the return signature we want, so
|
67
76
|
# force the issue:
|
data/lib/chef/version.rb
CHANGED
@@ -24,7 +24,7 @@ describe Chef::Cookbook::SyntaxCheck do
|
|
24
24
|
let(:cookbook_path) { File.join(CHEF_SPEC_DATA, 'cookbooks', 'openldap') }
|
25
25
|
let(:syntax_check) { Chef::Cookbook::SyntaxCheck.new(cookbook_path) }
|
26
26
|
|
27
|
-
let(:open_ldap_cookbook_files)
|
27
|
+
let(:open_ldap_cookbook_files) do
|
28
28
|
%w{ attributes/default.rb
|
29
29
|
attributes/smokey.rb
|
30
30
|
definitions/client.rb
|
@@ -32,8 +32,9 @@ describe Chef::Cookbook::SyntaxCheck do
|
|
32
32
|
metadata.rb
|
33
33
|
recipes/default.rb
|
34
34
|
recipes/gigantor.rb
|
35
|
-
recipes/one.rb
|
36
|
-
}
|
35
|
+
recipes/one.rb
|
36
|
+
recipes/return.rb }.map{ |f| File.join(cookbook_path, f) }
|
37
|
+
end
|
37
38
|
|
38
39
|
before do
|
39
40
|
Chef::Log.logger = Logger.new(StringIO.new)
|
@@ -41,7 +42,7 @@ describe Chef::Cookbook::SyntaxCheck do
|
|
41
42
|
|
42
43
|
@attr_files = %w{default.rb smokey.rb}.map { |f| File.join(cookbook_path, 'attributes', f) }
|
43
44
|
@defn_files = %w{client.rb server.rb}.map { |f| File.join(cookbook_path, 'definitions', f)}
|
44
|
-
@recipes = %w{default.rb gigantor.rb one.rb}.map { |f| File.join(cookbook_path, 'recipes', f) }
|
45
|
+
@recipes = %w{default.rb gigantor.rb one.rb return.rb}.map { |f| File.join(cookbook_path, 'recipes', f) }
|
45
46
|
@ruby_files = @attr_files + @defn_files + @recipes + [File.join(cookbook_path, "metadata.rb")]
|
46
47
|
basenames = %w{ helpers_via_partial_test.erb
|
47
48
|
helper_test.erb
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 11.12.
|
4
|
+
version: 11.12.2
|
5
5
|
platform: x86-mingw32
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-config
|
@@ -1401,6 +1401,7 @@ files:
|
|
1401
1401
|
- spec/data/cookbooks/openldap/recipes/default.rb
|
1402
1402
|
- spec/data/cookbooks/openldap/recipes/gigantor.rb
|
1403
1403
|
- spec/data/cookbooks/openldap/recipes/one.rb
|
1404
|
+
- spec/data/cookbooks/openldap/recipes/return.rb
|
1404
1405
|
- spec/data/cookbooks/openldap/templates/default/all_windows_line_endings.erb
|
1405
1406
|
- spec/data/cookbooks/openldap/templates/default/helper_test.erb
|
1406
1407
|
- spec/data/cookbooks/openldap/templates/default/helpers_via_partial_test.erb
|