chef 11.12.0 → 11.12.2

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: 829790278adb839ad7d668ef5a257314bac6454d
4
- data.tar.gz: 814e2692f845803a88cca7d3dc7dcd1838dbd132
3
+ metadata.gz: 449cee80fe86f7cf38cec91a1fa6fd5819e0dd8e
4
+ data.tar.gz: db2d1079c61c5729a797a2ff206d21f1d153a464
5
5
  SHA512:
6
- metadata.gz: 08e3371e0f9d2cddb8ceae27163b2e5d311547c9e3bc32ed40ad6a3cc7becc50980d4ea777cb2623519162602edcba53cba2d297fa1b661344e76c262c8a1a32
7
- data.tar.gz: 14dab9fde00fadf1e1c24b89fc9f43740874115d97f04676f3013bec8ae1ddb057b4081f05253a6a3cfc078bbd0320d4112002b341404c6b3106b4c25c4f8de4
6
+ metadata.gz: 4ea1b4d2a4000773b48e3fab9fa7cdf4c3c9d310dcc3ab7b00556de4e80d281c845c352fe4c9a4863fcf3c822daff1f3bd954e0913c1eade582838c855eb6f83
7
+ data.tar.gz: 0dac4b7f9168ec295bd427d3a701288fd1ed2692e08bc778c138419fbf98b884ba7f998286e6185e855af0d0f7d7665e54983ee2e1d659427bb3343c6f933c97
@@ -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
- RubyVM::InstructionSequence.new(file_content, ruby_file, abs_path, 0)
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
@@ -50,7 +50,10 @@ class Chef
50
50
  end
51
51
 
52
52
  def handle_chunk(next_chunk)
53
- @stream_handlers.inject(next_chunk) do |chunk, handler|
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:
@@ -17,7 +17,7 @@
17
17
 
18
18
  class Chef
19
19
  CHEF_ROOT = File.dirname(File.expand_path(File.dirname(__FILE__)))
20
- VERSION = '11.12.0'
20
+ VERSION = '11.12.2'
21
21
  end
22
22
 
23
23
  # NOTE: the Chef::Version class is defined in version_class.rb
@@ -1,3 +1,4 @@
1
+
1
2
  cat "blanket" do
2
3
  pretty_kitty true
3
4
  end
@@ -0,0 +1,2 @@
1
+ # CHEF-5199 regression test.
2
+ return nil
@@ -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 }.map{ |f| File.join(cookbook_path, f) }
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.0
4
+ version: 11.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-08 00:00:00.000000000 Z
11
+ date: 2014-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-config
@@ -1247,6 +1247,7 @@ files:
1247
1247
  - spec/data/cookbooks/openldap/recipes/default.rb
1248
1248
  - spec/data/cookbooks/openldap/recipes/gigantor.rb
1249
1249
  - spec/data/cookbooks/openldap/recipes/one.rb
1250
+ - spec/data/cookbooks/openldap/recipes/return.rb
1250
1251
  - spec/data/cookbooks/openldap/templates/default/all_windows_line_endings.erb
1251
1252
  - spec/data/cookbooks/openldap/templates/default/helper_test.erb
1252
1253
  - spec/data/cookbooks/openldap/templates/default/helpers_via_partial_test.erb