chef 12.4.0.rc.2-universal-mingw32 → 12.4.0-universal-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/distro/powershell/chef/chef.psm1 +327 -0
  3. data/lib/chef/chef_class.rb +4 -4
  4. data/lib/chef/client.rb +12 -6
  5. data/lib/chef/node_map.rb +63 -38
  6. data/lib/chef/platform/priority_map.rb +54 -0
  7. data/lib/chef/platform/provider_mapping.rb +2 -2
  8. data/lib/chef/platform/provider_priority_map.rb +3 -21
  9. data/lib/chef/platform/resource_priority_map.rb +5 -22
  10. data/lib/chef/provider.rb +1 -1
  11. data/lib/chef/provider/package/rpm.rb +2 -2
  12. data/lib/chef/provider/service/debian.rb +0 -2
  13. data/lib/chef/provider/service/insserv.rb +0 -2
  14. data/lib/chef/provider/service/invokercd.rb +0 -2
  15. data/lib/chef/provider/service/redhat.rb +0 -2
  16. data/lib/chef/provider/service/upstart.rb +0 -2
  17. data/lib/chef/provider/user.rb +0 -2
  18. data/lib/chef/resource.rb +23 -24
  19. data/lib/chef/resource/lwrp_base.rb +2 -1
  20. data/lib/chef/resource/macports_package.rb +2 -1
  21. data/lib/chef/resource/package.rb +0 -5
  22. data/lib/chef/resource_resolver.rb +1 -0
  23. data/lib/chef/version.rb +1 -1
  24. data/spec/integration/recipes/lwrp_spec.rb +2 -6
  25. data/spec/integration/recipes/recipe_dsl_spec.rb +254 -39
  26. data/spec/support/shared/shared_examples.rb +1 -1
  27. data/spec/unit/api_client_spec.rb +1 -1
  28. data/spec/unit/client_spec.rb +35 -19
  29. data/spec/unit/cookbook_version_spec.rb +1 -1
  30. data/spec/unit/data_bag_item_spec.rb +1 -1
  31. data/spec/unit/data_bag_spec.rb +1 -1
  32. data/spec/unit/environment_spec.rb +1 -1
  33. data/spec/unit/exceptions_spec.rb +1 -1
  34. data/spec/unit/json_compat_spec.rb +1 -1
  35. data/spec/unit/lwrp_spec.rb +43 -4
  36. data/spec/unit/node_spec.rb +1 -1
  37. data/spec/unit/osc_user_spec.rb +1 -1
  38. data/spec/unit/provider/package/rpm_spec.rb +335 -124
  39. data/spec/unit/provider_resolver_spec.rb +0 -1
  40. data/spec/unit/recipe_spec.rb +12 -8
  41. data/spec/unit/resource_collection_spec.rb +1 -1
  42. data/spec/unit/resource_resolver_spec.rb +49 -0
  43. data/spec/unit/resource_spec.rb +19 -4
  44. data/spec/unit/role_spec.rb +1 -1
  45. data/spec/unit/run_list_spec.rb +1 -1
  46. data/spec/unit/runner_spec.rb +2 -2
  47. data/spec/unit/user_spec.rb +1 -1
  48. metadata +10 -8
  49. data/spec/support/pedant/Gemfile.lock +0 -67
@@ -482,7 +482,6 @@ describe Chef::ProviderResolver do
482
482
  python: Chef::Provider::Script,
483
483
  remote_directory: Chef::Provider::RemoteDirectory,
484
484
  route: Chef::Provider::Route,
485
- rpm_package: Chef::Provider::Package::Rpm,
486
485
  ruby: Chef::Provider::Script,
487
486
  ruby_block: Chef::Provider::RubyBlock,
488
487
  script: Chef::Provider::Script,
@@ -121,6 +121,7 @@ describe Chef::Recipe do
121
121
 
122
122
  it "locate resource for particular platform" do
123
123
  ShaunTheSheep = Class.new(Chef::Resource)
124
+ ShaunTheSheep.resource_name :shaun_the_sheep
124
125
  ShaunTheSheep.provides :laughter, :platform => ["television"]
125
126
  node.automatic[:platform] = "television"
126
127
  node.automatic[:platform_version] = "123"
@@ -131,6 +132,7 @@ describe Chef::Recipe do
131
132
 
132
133
  it "locate a resource for all platforms" do
133
134
  YourMom = Class.new(Chef::Resource)
135
+ YourMom.resource_name :your_mom
134
136
  YourMom.provides :love_and_caring
135
137
  res = recipe.love_and_caring "mommy"
136
138
  expect(res.name).to eql("mommy")
@@ -141,7 +143,9 @@ describe Chef::Recipe do
141
143
  before do
142
144
  node.automatic[:platform] = "nbc_sports"
143
145
  Sounders = Class.new(Chef::Resource)
146
+ Sounders.resource_name :sounders
144
147
  TottenhamHotspur = Class.new(Chef::Resource)
148
+ TottenhamHotspur.resource_name :tottenham_hotspur
145
149
  end
146
150
 
147
151
  after do
@@ -149,24 +153,24 @@ describe Chef::Recipe do
149
153
  Object.send(:remove_const, :TottenhamHotspur)
150
154
  end
151
155
 
152
- it "selects one if it is the last declared" do
153
- expect(Chef::Log).not_to receive(:warn)
156
+ it "selects the first one alphabetically" do
157
+ expect(Chef::Log).to receive(:warn).with("You declared a new resource TottenhamHotspur for resource football, but it comes alphabetically after Sounders and has the same filters ({:platform=>\"nbc_sports\"}), so it will not be used. Use override: true if you want to use it for football.")
154
158
 
155
159
  Sounders.provides :football, platform: "nbc_sports"
156
160
  TottenhamHotspur.provides :football, platform: "nbc_sports"
157
161
 
158
162
  res1 = recipe.football "club world cup"
159
163
  expect(res1.name).to eql("club world cup")
160
- expect(res1).to be_a_kind_of(TottenhamHotspur)
164
+ expect(res1).to be_a_kind_of(Sounders)
161
165
  end
162
166
 
163
- it "selects the other one if it is given priority" do
164
- expect(Chef::Log).not_to receive(:warn)
167
+ it "selects the first one alphabetically even if the declaration order is reversed" do
168
+ expect(Chef::Log).to receive(:warn).with("You are overriding football2 on {:platform=>\"nbc_sports\"} with Sounders: used to be TottenhamHotspur. Use override: true if this is what you intended.")
165
169
 
166
- TottenhamHotspur.provides :football, platform: "nbc_sports"
167
- Sounders.provides :football, platform: "nbc_sports"
170
+ TottenhamHotspur.provides :football2, platform: "nbc_sports"
171
+ Sounders.provides :football2, platform: "nbc_sports"
168
172
 
169
- res1 = recipe.football "club world cup"
173
+ res1 = recipe.football2 "club world cup"
170
174
  expect(res1.name).to eql("club world cup")
171
175
  expect(res1).to be_a_kind_of(Sounders)
172
176
  end
@@ -252,7 +252,7 @@ describe Chef::ResourceCollection do
252
252
  expect(json).to match(/instance_vars/)
253
253
  end
254
254
 
255
- include_examples "to_json equalivent to Chef::JSONCompat.to_json" do
255
+ include_examples "to_json equivalent to Chef::JSONCompat.to_json" do
256
256
  let(:jsonable) { rc }
257
257
  end
258
258
  end
@@ -0,0 +1,49 @@
1
+ #
2
+ # Author:: Ranjib Dey
3
+ # Copyright:: Copyright (c) 2015 Ranjib Dey <ranjib@linux.com>.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'spec_helper'
20
+ require 'chef/resource_resolver'
21
+
22
+
23
+ describe Chef::ResourceResolver do
24
+ it '#resolve' do
25
+ expect(described_class.resolve(:execute)).to eq(Chef::Resource::Execute)
26
+ end
27
+
28
+ it '#list' do
29
+ expect(described_class.list(:package)).to_not be_empty
30
+ end
31
+
32
+ context 'instance methods' do
33
+ let(:resolver) do
34
+ described_class.new(Chef::Node.new, 'execute[echo]')
35
+ end
36
+
37
+ it '#resolve' do
38
+ expect(resolver.resolve).to be_nil
39
+ end
40
+
41
+ it '#list' do
42
+ expect(resolver.list).to be_empty
43
+ end
44
+
45
+ it '#provided_by?' do
46
+ expect(resolver.provided_by?(Chef::Resource::Execute)).to be_truthy
47
+ end
48
+ end
49
+ end
@@ -344,6 +344,7 @@ describe Chef::Resource do
344
344
  expect(r.resource_name).to be_nil
345
345
  expect(r.declared_type).to eq :d
346
346
  end
347
+
347
348
  it "and there are no provides lines, @resource_name is used" do
348
349
  c = Class.new(Chef::Resource) do
349
350
  def initialize(*args, &block)
@@ -358,6 +359,20 @@ describe Chef::Resource do
358
359
  expect(r.resource_name).to eq :blah
359
360
  expect(r.declared_type).to eq :d
360
361
  end
362
+
363
+ it "and the resource class gets a late-bound name, resource_name is nil" do
364
+ c = Class.new(Chef::Resource) do
365
+ def self.name
366
+ "ResourceSpecNameTest"
367
+ end
368
+ end
369
+
370
+ r = c.new('hi')
371
+ r.declared_type = :d
372
+ expect(c.resource_name).to be_nil
373
+ expect(r.resource_name).to be_nil
374
+ expect(r.declared_type).to eq :d
375
+ end
361
376
  end
362
377
 
363
378
  it "resource_name without provides is honored" do
@@ -416,7 +431,7 @@ describe Chef::Resource do
416
431
  expect(json).to match(/instance_vars/)
417
432
  end
418
433
 
419
- include_examples "to_json equalivent to Chef::JSONCompat.to_json" do
434
+ include_examples "to_json equivalent to Chef::JSONCompat.to_json" do
420
435
  let(:jsonable) { @resource }
421
436
  end
422
437
  end
@@ -795,21 +810,21 @@ describe Chef::Resource do
795
810
  end
796
811
 
797
812
  it 'adds mappings for a single platform' do
798
- expect(Chef).to receive(:set_resource_priority_array).with(
813
+ expect(Chef.resource_priority_map).to receive(:set).with(
799
814
  :dinobot, Chef::Resource::Klz, { platform: ['autobots'] }
800
815
  )
801
816
  klz.provides :dinobot, platform: ['autobots']
802
817
  end
803
818
 
804
819
  it 'adds mappings for multiple platforms' do
805
- expect(Chef).to receive(:set_resource_priority_array).with(
820
+ expect(Chef.resource_priority_map).to receive(:set).with(
806
821
  :energy, Chef::Resource::Klz, { platform: ['autobots', 'decepticons']}
807
822
  )
808
823
  klz.provides :energy, platform: ['autobots', 'decepticons']
809
824
  end
810
825
 
811
826
  it 'adds mappings for all platforms' do
812
- expect(Chef).to receive(:set_resource_priority_array).with(
827
+ expect(Chef.resource_priority_map).to receive(:set).with(
813
828
  :tape_deck, Chef::Resource::Klz, {}
814
829
  )
815
830
  klz.provides :tape_deck
@@ -217,7 +217,7 @@ describe Chef::Role do
217
217
 
218
218
  end
219
219
 
220
- include_examples "to_json equalivent to Chef::JSONCompat.to_json" do
220
+ include_examples "to_json equivalent to Chef::JSONCompat.to_json" do
221
221
  let(:jsonable) { @role }
222
222
  end
223
223
  end
@@ -307,7 +307,7 @@ describe Chef::RunList do
307
307
  expect(Chef::JSONCompat.to_json(@run_list)).to eq(Chef::JSONCompat.to_json(["recipe[nagios::client]", "role[production]", "recipe[apache2]"]))
308
308
  end
309
309
 
310
- include_examples "to_json equalivent to Chef::JSONCompat.to_json" do
310
+ include_examples "to_json equivalent to Chef::JSONCompat.to_json" do
311
311
  let(:jsonable) { @run_list }
312
312
  end
313
313
 
@@ -273,8 +273,8 @@ describe Chef::Runner do
273
273
 
274
274
  expected_message =<<-E
275
275
  Multiple failures occurred:
276
- * FailureProvider::ChefClientFail occurred in delayed notification: failure_resource[explode] (dynamically defined) had an error: FailureProvider::ChefClientFail: chef had an error of some sort
277
- * FailureProvider::ChefClientFail occurred in delayed notification: failure_resource[explode again] (dynamically defined) had an error: FailureProvider::ChefClientFail: chef had an error of some sort
276
+ * FailureProvider::ChefClientFail occurred in delayed notification: [explode] (dynamically defined) had an error: FailureProvider::ChefClientFail: chef had an error of some sort
277
+ * FailureProvider::ChefClientFail occurred in delayed notification: [explode again] (dynamically defined) had an error: FailureProvider::ChefClientFail: chef had an error of some sort
278
278
  E
279
279
  expect(exception.message).to eq(expected_message)
280
280
 
@@ -244,7 +244,7 @@ describe Chef::User do
244
244
  expect(@json).not_to include("password")
245
245
  end
246
246
 
247
- include_examples "to_json equalivent to Chef::JSONCompat.to_json" do
247
+ include_examples "to_json equivalent to Chef::JSONCompat.to_json" do
248
248
  let(:jsonable) { @user }
249
249
  end
250
250
  end
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.4.0.rc.2
4
+ version: 12.4.0
5
5
  platform: universal-mingw32
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-10 00:00:00.000000000 Z
11
+ date: 2015-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-config
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 12.4.0.rc.2
19
+ version: 12.4.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 12.4.0.rc.2
26
+ version: 12.4.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mixlib-cli
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -744,6 +744,7 @@ files:
744
744
  - distro/common/markdown/man8/chef-server.mkd
745
745
  - distro/common/markdown/man8/chef-solo.mkd
746
746
  - distro/common/markdown/man8/chef-solr.mkd
747
+ - distro/powershell/chef/chef.psm1
747
748
  - ext/win32-eventlog/Rakefile
748
749
  - ext/win32-eventlog/chef-log.man
749
750
  - lib/chef.rb
@@ -1134,6 +1135,7 @@ files:
1134
1135
  - lib/chef/org.rb
1135
1136
  - lib/chef/osc_user.rb
1136
1137
  - lib/chef/platform.rb
1138
+ - lib/chef/platform/priority_map.rb
1137
1139
  - lib/chef/platform/provider_mapping.rb
1138
1140
  - lib/chef/platform/provider_priority_map.rb
1139
1141
  - lib/chef/platform/query_helpers.rb
@@ -1826,7 +1828,6 @@ files:
1826
1828
  - spec/support/mock/constant.rb
1827
1829
  - spec/support/mock/platform.rb
1828
1830
  - spec/support/pedant/Gemfile
1829
- - spec/support/pedant/Gemfile.lock
1830
1831
  - spec/support/pedant/pedant_config.rb
1831
1832
  - spec/support/pedant/run_pedant.rb
1832
1833
  - spec/support/pedant/stickywicket.pem
@@ -2268,6 +2269,7 @@ files:
2268
2269
  - spec/unit/resource_collection_spec.rb
2269
2270
  - spec/unit/resource_definition_spec.rb
2270
2271
  - spec/unit/resource_reporter_spec.rb
2272
+ - spec/unit/resource_resolver_spec.rb
2271
2273
  - spec/unit/resource_spec.rb
2272
2274
  - spec/unit/rest/auth_credentials_spec.rb
2273
2275
  - spec/unit/rest_spec.rb
@@ -2325,12 +2327,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
2325
2327
  version: 2.0.0
2326
2328
  required_rubygems_version: !ruby/object:Gem::Requirement
2327
2329
  requirements:
2328
- - - ">"
2330
+ - - ">="
2329
2331
  - !ruby/object:Gem::Version
2330
- version: 1.3.1
2332
+ version: '0'
2331
2333
  requirements: []
2332
2334
  rubyforge_project:
2333
- rubygems_version: 2.4.5
2335
+ rubygems_version: 2.4.4
2334
2336
  signing_key:
2335
2337
  specification_version: 4
2336
2338
  summary: A systems integration framework, built to bring the benefits of configuration
@@ -1,67 +0,0 @@
1
- GIT
2
- remote: git://github.com/opscode/chef-pedant.git
3
- revision: ddb71c24b33340c3f61fa7df7bc9adf85275d229
4
- ref: server-cli-option
5
- specs:
6
- chef-pedant (1.0.30)
7
- activesupport (~> 3.2.8)
8
- erubis (~> 2.7.0)
9
- mixlib-authentication (~> 1.3.0)
10
- mixlib-config (~> 2.0)
11
- mixlib-shellout (>= 1.1)
12
- net-http-spy (~> 0.2.1)
13
- rest-client (>= 1.6.7)
14
- rspec (~> 2.11)
15
- rspec-rerun (= 0.1.1)
16
- rspec_junit_formatter (~> 0.1.1)
17
-
18
- GEM
19
- remote: https://rubygems.org/
20
- specs:
21
- activesupport (3.2.21)
22
- i18n (~> 0.6, >= 0.6.4)
23
- multi_json (~> 1.0)
24
- builder (3.2.2)
25
- diff-lcs (1.2.5)
26
- domain_name (0.5.24)
27
- unf (>= 0.0.5, < 1.0.0)
28
- erubis (2.7.0)
29
- http-cookie (1.0.2)
30
- domain_name (~> 0.5)
31
- i18n (0.7.0)
32
- mime-types (2.5)
33
- mixlib-authentication (1.3.0)
34
- mixlib-log
35
- mixlib-config (2.2.1)
36
- mixlib-log (1.6.0)
37
- mixlib-shellout (2.1.0)
38
- multi_json (1.11.0)
39
- net-http-spy (0.2.1)
40
- netrc (0.10.3)
41
- rest-client (1.8.0)
42
- http-cookie (>= 1.0.2, < 2.0)
43
- mime-types (>= 1.16, < 3.0)
44
- netrc (~> 0.7)
45
- rspec (2.99.0)
46
- rspec-core (~> 2.99.0)
47
- rspec-expectations (~> 2.99.0)
48
- rspec-mocks (~> 2.99.0)
49
- rspec-core (2.99.2)
50
- rspec-expectations (2.99.2)
51
- diff-lcs (>= 1.1.3, < 2.0)
52
- rspec-mocks (2.99.3)
53
- rspec-rerun (0.1.1)
54
- rspec (>= 2.11.0)
55
- rspec_junit_formatter (0.1.6)
56
- builder
57
- rspec (~> 2.0)
58
- rspec-core (!= 2.12.0)
59
- unf (0.1.4)
60
- unf_ext
61
- unf_ext (0.0.7.1)
62
-
63
- PLATFORMS
64
- ruby
65
-
66
- DEPENDENCIES
67
- chef-pedant!