chef 12.2.1-x86-mingw32 → 12.3.0.rc.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/ext/win32-eventlog/Rakefile +10 -6
  3. data/lib/chef.rb +1 -0
  4. data/lib/chef/application/apply.rb +5 -0
  5. data/lib/chef/application/client.rb +10 -0
  6. data/lib/chef/application/knife.rb +5 -1
  7. data/lib/chef/application/solo.rb +5 -0
  8. data/lib/chef/chef_class.rb +130 -0
  9. data/lib/chef/client.rb +15 -7
  10. data/lib/chef/config.rb +13 -0
  11. data/lib/chef/event_loggers/windows_eventlog.rb +11 -5
  12. data/lib/chef/http.rb +13 -3
  13. data/lib/chef/http/basic_client.rb +21 -4
  14. data/lib/chef/http/socketless_chef_zero_client.rb +207 -0
  15. data/lib/chef/knife.rb +3 -0
  16. data/lib/chef/knife/bootstrap.rb +1 -1
  17. data/lib/chef/knife/core/status_presenter.rb +12 -11
  18. data/lib/chef/knife/ssh.rb +3 -1
  19. data/lib/chef/knife/status.rb +32 -7
  20. data/lib/chef/local_mode.rb +13 -3
  21. data/lib/chef/mixin/provides.rb +32 -0
  22. data/lib/chef/platform/provider_priority_map.rb +16 -7
  23. data/lib/chef/platform/resource_priority_map.rb +37 -0
  24. data/lib/chef/policy_builder/expand_node_object.rb +14 -0
  25. data/lib/chef/policy_builder/policyfile.rb +0 -1
  26. data/lib/chef/provider.rb +5 -20
  27. data/lib/chef/provider/package/rubygems.rb +4 -1
  28. data/lib/chef/provider/service/macosx.rb +66 -30
  29. data/lib/chef/provider_resolver.rb +10 -5
  30. data/lib/chef/resource.rb +5 -39
  31. data/lib/chef/resource/gem_package.rb +5 -0
  32. data/lib/chef/resource/link.rb +1 -1
  33. data/lib/chef/resource/macosx_service.rb +59 -0
  34. data/lib/chef/resource/remote_file.rb +0 -4
  35. data/lib/chef/resource_resolver.rb +101 -0
  36. data/lib/chef/rest.rb +4 -5
  37. data/lib/chef/search/query.rb +1 -1
  38. data/lib/chef/server_api.rb +1 -0
  39. data/lib/chef/version.rb +1 -1
  40. data/spec/data/lwrp/providers/buck_passer.rb +2 -1
  41. data/spec/data/lwrp/resources/bar.rb +1 -1
  42. data/spec/data/{big_json.json → nested.json} +2 -2
  43. data/spec/functional/event_loggers/windows_eventlog_spec.rb +14 -0
  44. data/spec/functional/resource/execute_spec.rb +1 -1
  45. data/spec/integration/client/client_spec.rb +12 -1
  46. data/spec/integration/client/ipv6_spec.rb +1 -1
  47. data/spec/integration/knife/common_options_spec.rb +3 -3
  48. data/spec/integration/recipes/lwrp_inline_resources_spec.rb +1 -1
  49. data/spec/integration/solo/solo_spec.rb +7 -5
  50. data/spec/unit/application/client_spec.rb +10 -0
  51. data/spec/unit/chef_class_spec.rb +91 -0
  52. data/spec/unit/client_spec.rb +13 -0
  53. data/spec/unit/http/basic_client_spec.rb +43 -6
  54. data/spec/unit/http/socketless_chef_zero_client_spec.rb +174 -0
  55. data/spec/unit/http_spec.rb +14 -0
  56. data/spec/unit/json_compat_spec.rb +7 -20
  57. data/spec/unit/knife/ssh_spec.rb +18 -0
  58. data/spec/unit/knife/status_spec.rb +69 -3
  59. data/spec/unit/knife_spec.rb +5 -0
  60. data/spec/unit/provider/package/rubygems_spec.rb +19 -0
  61. data/spec/unit/provider/service/macosx_spec.rb +230 -203
  62. data/spec/unit/provider_resolver_spec.rb +1 -0
  63. data/spec/unit/recipe_spec.rb +48 -0
  64. data/spec/unit/resource/link_spec.rb +15 -0
  65. data/spec/unit/resource_spec.rb +6 -6
  66. data/spec/unit/rest_spec.rb +9 -0
  67. data/spec/unit/search/query_spec.rb +24 -0
  68. data/spec/unit/shell_spec.rb +3 -1
  69. metadata +16 -9
  70. data/spec/data/big_json_plus_one.json +0 -2
@@ -18,6 +18,7 @@
18
18
 
19
19
  require 'spec_helper'
20
20
  require 'chef/mixin/convert_to_class_name'
21
+ require 'chef/provider_resolver'
21
22
 
22
23
  include Chef::Mixin::ConvertToClassName
23
24
 
@@ -20,6 +20,7 @@
20
20
  #
21
21
 
22
22
  require 'spec_helper'
23
+ require 'chef/platform/resource_priority_map'
23
24
 
24
25
  describe Chef::Recipe do
25
26
 
@@ -136,6 +137,44 @@ describe Chef::Recipe do
136
137
  res.kind_of?(YourMom)
137
138
  end
138
139
 
140
+ describe "when there is more than one resource that resolves on a node" do
141
+ before do
142
+ node.automatic[:platform] = "nbc_sports"
143
+ Sounders = Class.new(Chef::Resource)
144
+ Sounders.provides :football, platform: "nbc_sports"
145
+ TottenhamHotspur = Class.new(Chef::Resource)
146
+ TottenhamHotspur.provides :football, platform: "nbc_sports"
147
+ end
148
+
149
+ after do
150
+ Object.send(:remove_const, :Sounders)
151
+ Object.send(:remove_const, :TottenhamHotspur)
152
+ end
153
+
154
+ it "warns if resolution of the two resources is ambiguous" do
155
+ expect(Chef::Log).to receive(:warn).at_least(:once).with(/Ambiguous resource precedence/)
156
+ res1 = recipe.football "club world cup"
157
+ expect(res1.name).to eql("club world cup")
158
+ # the class of res1 is not defined.
159
+ end
160
+
161
+ it "selects one if it is given priority" do
162
+ expect(Chef::Log).not_to receive(:warn)
163
+ Chef::Platform::ResourcePriorityMap.instance.send(:priority, :football, TottenhamHotspur, platform: "nbc_sports")
164
+ res1 = recipe.football "club world cup"
165
+ expect(res1.name).to eql("club world cup")
166
+ expect(res1).to be_a_kind_of(TottenhamHotspur)
167
+ end
168
+
169
+ it "selects the other one if it is given priority" do
170
+ expect(Chef::Log).not_to receive(:warn)
171
+ Chef::Platform::ResourcePriorityMap.instance.send(:priority, :football, Sounders, platform: "nbc_sports")
172
+ res1 = recipe.football "club world cup"
173
+ expect(res1.name).to eql("club world cup")
174
+ expect(res1).to be_a_kind_of(Sounders)
175
+ end
176
+ end
177
+
139
178
  end
140
179
  end
141
180
 
@@ -237,8 +276,17 @@ describe Chef::Recipe do
237
276
  action :nothing
238
277
  end
239
278
  end
279
+
280
+ it "validating resources via build_resource" do
281
+ expect {recipe.build_resource(:remote_file, "klopp") do
282
+ source Chef::DelayedEvaluator.new {"http://chef.io"}
283
+ end}.to_not raise_error
284
+ end
285
+
240
286
  end
241
287
 
288
+
289
+
242
290
  describe "creating resources via declare_resource" do
243
291
  let(:zm_resource) do
244
292
  recipe.declare_resource(:zen_master, "klopp") do
@@ -53,6 +53,21 @@ describe Chef::Resource::Link do
53
53
  expect(@resource.target_file).to eql("fakey_fakerton")
54
54
  end
55
55
 
56
+ it "should accept a delayed evaluator as the target path" do
57
+ @resource.target_file Chef::DelayedEvaluator.new { "my_lazy_name" }
58
+ expect(@resource.target_file).to eql("my_lazy_name")
59
+ end
60
+
61
+ it "should accept a delayed evaluator when accessing via 'path'" do
62
+ @resource.target_file Chef::DelayedEvaluator.new { "my_lazy_name" }
63
+ expect(@resource.path).to eql("my_lazy_name")
64
+ end
65
+
66
+ it "should accept a delayed evaluator via 'to'" do
67
+ @resource.to Chef::DelayedEvaluator.new { "my_lazy_name" }
68
+ expect(@resource.to).to eql("my_lazy_name")
69
+ end
70
+
56
71
  it "should accept a string as the link source via 'to'" do
57
72
  expect { @resource.to "/tmp" }.not_to raise_error
58
73
  end
@@ -709,22 +709,22 @@ describe Chef::Resource do
709
709
  end
710
710
 
711
711
  it 'adds mappings for a single platform' do
712
- expect(Chef::Resource.node_map).to receive(:set).with(
713
- :dinobot, Chef::Resource::Klz, { platform: ['autobots'] }
712
+ expect(Chef::Resource::Klz.node_map).to receive(:set).with(
713
+ :dinobot, true, { platform: ['autobots'] }
714
714
  )
715
715
  klz.provides :dinobot, platform: ['autobots']
716
716
  end
717
717
 
718
718
  it 'adds mappings for multiple platforms' do
719
- expect(Chef::Resource.node_map).to receive(:set).with(
720
- :energy, Chef::Resource::Klz, { platform: ['autobots', 'decepticons']}
719
+ expect(Chef::Resource::Klz.node_map).to receive(:set).with(
720
+ :energy, true, { platform: ['autobots', 'decepticons']}
721
721
  )
722
722
  klz.provides :energy, platform: ['autobots', 'decepticons']
723
723
  end
724
724
 
725
725
  it 'adds mappings for all platforms' do
726
- expect(Chef::Resource.node_map).to receive(:set).with(
727
- :tape_deck, Chef::Resource::Klz, {}
726
+ expect(Chef::Resource::Klz.node_map).to receive(:set).with(
727
+ :tape_deck, true, {}
728
728
  )
729
729
  klz.provides :tape_deck
730
730
  end
@@ -92,6 +92,15 @@ describe Chef::REST do
92
92
  Chef::REST.new(base_url, nil, nil, options)
93
93
  end
94
94
 
95
+ context 'when created with a chef zero URL' do
96
+
97
+ let(:url) { "chefzero://localhost:1" }
98
+
99
+ it "does not load the signing key" do
100
+ expect { Chef::REST.new(url) }.to_not raise_error
101
+ end
102
+ end
103
+
95
104
  describe "calling an HTTP verb on a path or absolute URL" do
96
105
  it "adds a relative URL to the base url it was initialized with" do
97
106
  expect(rest.create_url("foo/bar/baz")).to eq(URI.parse(base_url + "/foo/bar/baz"))
@@ -81,6 +81,9 @@ describe Chef::Search::Query do
81
81
  end
82
82
 
83
83
  describe "search" do
84
+ let(:query_string) { "search/node?q=platform:rhel&sort=X_CHEF_id_CHEF_X%20asc&start=0" }
85
+ let(:query_string_continue) { "search/node?q=platform:rhel&sort=X_CHEF_id_CHEF_X%20asc&start=4" }
86
+
84
87
  let(:response) { {
85
88
  "rows" => [
86
89
  { "name" => "my-name-is-node",
@@ -140,6 +143,19 @@ describe Chef::Search::Query do
140
143
  "total" => 4
141
144
  } }
142
145
 
146
+ let(:big_response) {
147
+ r = response.dup
148
+ r["total"] = 8
149
+ r
150
+ }
151
+
152
+ let(:big_response_end) {
153
+ r = response.dup
154
+ r["start"] = 4
155
+ r["total"] = 8
156
+ r
157
+ }
158
+
143
159
  it "accepts a type as the first argument" do
144
160
  expect { query.search("node") }.not_to raise_error
145
161
  expect { query.search(:node) }.not_to raise_error
@@ -195,6 +211,14 @@ describe Chef::Search::Query do
195
211
  query.search(:node, "*:*", sort: nil, start: 0, rows: 1) { |r| @call_me.do(r) }
196
212
  end
197
213
 
214
+ it "sends multiple API requests when the server indicates there is more data" do
215
+ expect(rest).to receive(:get_rest).with(query_string).and_return(big_response)
216
+ expect(rest).to receive(:get_rest).with(query_string_continue).and_return(big_response_end)
217
+ query.search(:node, "platform:rhel") do |r|
218
+ nil
219
+ end
220
+ end
221
+
198
222
  context "when :filter_result is provided as a result" do
199
223
  include_context "filtered search" do
200
224
  let(:filter_key) { :filter_result }
@@ -43,6 +43,8 @@ describe Shell do
43
43
  before do
44
44
  Shell.irb_conf = {}
45
45
  allow(Shell::ShellSession.instance).to receive(:reset!)
46
+ allow(Chef::Platform).to receive(:windows?).and_return(false)
47
+ allow(Chef::Util::PathHelper).to receive(:home).and_return('/home/foo')
46
48
  end
47
49
 
48
50
  describe "reporting its status" do
@@ -56,7 +58,7 @@ describe Shell do
56
58
  describe "configuring IRB" do
57
59
  it "configures irb history" do
58
60
  Shell.configure_irb
59
- expect(Shell.irb_conf[:HISTORY_FILE]).to eq("#{ENV['HOME']}/.chef/chef_shell_history")
61
+ expect(Shell.irb_conf[:HISTORY_FILE]).to eq(Chef::Util::PathHelper.home('.chef', 'chef_shell_history'))
60
62
  expect(Shell.irb_conf[:SAVE_HISTORY]).to eq(1000)
61
63
  end
62
64
 
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: 12.2.1
4
+ version: 12.3.0.rc.0
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: 2015-03-30 00:00:00.000000000 Z
11
+ date: 2015-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-config
@@ -208,14 +208,14 @@ dependencies:
208
208
  requirements:
209
209
  - - "~>"
210
210
  - !ruby/object:Gem::Version
211
- version: '4.0'
211
+ version: '4.1'
212
212
  type: :runtime
213
213
  prerelease: false
214
214
  version_requirements: !ruby/object:Gem::Requirement
215
215
  requirements:
216
216
  - - "~>"
217
217
  - !ruby/object:Gem::Version
218
- version: '4.0'
218
+ version: '4.1'
219
219
  - !ruby/object:Gem::Dependency
220
220
  name: pry
221
221
  requirement: !ruby/object:Gem::Requirement
@@ -734,6 +734,7 @@ files:
734
734
  - lib/chef/audit/control_group_data.rb
735
735
  - lib/chef/audit/rspec_formatter.rb
736
736
  - lib/chef/audit/runner.rb
737
+ - lib/chef/chef_class.rb
737
738
  - lib/chef/chef_fs.rb
738
739
  - lib/chef/chef_fs/chef_fs_data_store.rb
739
740
  - lib/chef/chef_fs/command_line.rb
@@ -902,6 +903,7 @@ files:
902
903
  - lib/chef/http/json_to_model_output.rb
903
904
  - lib/chef/http/remote_request_id.rb
904
905
  - lib/chef/http/simple.rb
906
+ - lib/chef/http/socketless_chef_zero_client.rb
905
907
  - lib/chef/http/ssl_policies.rb
906
908
  - lib/chef/http/validate_content_length.rb
907
909
  - lib/chef/json_compat.rb
@@ -1045,6 +1047,7 @@ files:
1045
1047
  - lib/chef/mixin/params_validate.rb
1046
1048
  - lib/chef/mixin/path_sanity.rb
1047
1049
  - lib/chef/mixin/powershell_type_coercions.rb
1050
+ - lib/chef/mixin/provides.rb
1048
1051
  - lib/chef/mixin/recipe_definition_dsl_core.rb
1049
1052
  - lib/chef/mixin/securable.rb
1050
1053
  - lib/chef/mixin/shell_out.rb
@@ -1071,6 +1074,7 @@ files:
1071
1074
  - lib/chef/platform/provider_priority_map.rb
1072
1075
  - lib/chef/platform/query_helpers.rb
1073
1076
  - lib/chef/platform/rebooter.rb
1077
+ - lib/chef/platform/resource_priority_map.rb
1074
1078
  - lib/chef/platform/service_helpers.rb
1075
1079
  - lib/chef/policy_builder.rb
1076
1080
  - lib/chef/policy_builder/expand_node_object.rb
@@ -1233,6 +1237,7 @@ files:
1233
1237
  - lib/chef/resource/link.rb
1234
1238
  - lib/chef/resource/log.rb
1235
1239
  - lib/chef/resource/lwrp_base.rb
1240
+ - lib/chef/resource/macosx_service.rb
1236
1241
  - lib/chef/resource/macports_package.rb
1237
1242
  - lib/chef/resource/mdadm.rb
1238
1243
  - lib/chef/resource/mount.rb
@@ -1277,6 +1282,7 @@ files:
1277
1282
  - lib/chef/resource_definition.rb
1278
1283
  - lib/chef/resource_definition_list.rb
1279
1284
  - lib/chef/resource_reporter.rb
1285
+ - lib/chef/resource_resolver.rb
1280
1286
  - lib/chef/resources.rb
1281
1287
  - lib/chef/rest.rb
1282
1288
  - lib/chef/role.rb
@@ -1396,8 +1402,6 @@ files:
1396
1402
  - spec/data/apt/var/www/apt/pool/main/c/chef-integration-test/chef-integration-test_1.0-1_amd64.deb
1397
1403
  - spec/data/apt/var/www/apt/pool/main/c/chef-integration-test/chef-integration-test_1.1-1_amd64.deb
1398
1404
  - spec/data/bad-config.rb
1399
- - spec/data/big_json.json
1400
- - spec/data/big_json_plus_one.json
1401
1405
  - spec/data/bootstrap/encrypted_data_bag_secret
1402
1406
  - spec/data/bootstrap/no_proxy.erb
1403
1407
  - spec/data/bootstrap/secret.erb
@@ -1537,6 +1541,7 @@ files:
1537
1541
  - spec/data/mac_users/10.9.plist.xml
1538
1542
  - spec/data/mac_users/10.9.shadow.xml
1539
1543
  - spec/data/metadata/quick_start/metadata.rb
1544
+ - spec/data/nested.json
1540
1545
  - spec/data/nodes/default.rb
1541
1546
  - spec/data/nodes/test.example.com.rb
1542
1547
  - spec/data/nodes/test.rb
@@ -1791,6 +1796,7 @@ files:
1791
1796
  - spec/unit/audit/control_group_data_spec.rb
1792
1797
  - spec/unit/audit/rspec_formatter_spec.rb
1793
1798
  - spec/unit/audit/runner_spec.rb
1799
+ - spec/unit/chef_class_spec.rb
1794
1800
  - spec/unit/chef_fs/config_spec.rb
1795
1801
  - spec/unit/chef_fs/data_handler/group_handler_spec.rb
1796
1802
  - spec/unit/chef_fs/diff_spec.rb
@@ -1851,6 +1857,7 @@ files:
1851
1857
  - spec/unit/http/http_request_spec.rb
1852
1858
  - spec/unit/http/json_input_spec.rb
1853
1859
  - spec/unit/http/simple_spec.rb
1860
+ - spec/unit/http/socketless_chef_zero_client_spec.rb
1854
1861
  - spec/unit/http/ssl_policies_spec.rb
1855
1862
  - spec/unit/http/validate_content_length_spec.rb
1856
1863
  - spec/unit/http_spec.rb
@@ -2208,12 +2215,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
2208
2215
  version: 2.0.0
2209
2216
  required_rubygems_version: !ruby/object:Gem::Requirement
2210
2217
  requirements:
2211
- - - ">="
2218
+ - - ">"
2212
2219
  - !ruby/object:Gem::Version
2213
- version: '0'
2220
+ version: 1.3.1
2214
2221
  requirements: []
2215
2222
  rubyforge_project:
2216
- rubygems_version: 2.4.4
2223
+ rubygems_version: 2.4.5
2217
2224
  signing_key:
2218
2225
  specification_version: 4
2219
2226
  summary: A systems integration framework, built to bring the benefits of configuration
@@ -1,2 +0,0 @@
1
- {"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":{"key":"test"
2
- }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}