chef 11.14.2-x86-mingw32 → 11.14.6-x86-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 (36) hide show
  1. checksums.yaml +4 -4
  2. data/lib/chef/application.rb +16 -8
  3. data/lib/chef/dsl/recipe.rb +14 -0
  4. data/lib/chef/exceptions.rb +1 -0
  5. data/lib/chef/provider/env/windows.rb +5 -9
  6. data/lib/chef/provider/group/dscl.rb +27 -9
  7. data/lib/chef/provider/package/rpm.rb +2 -2
  8. data/lib/chef/provider/user/dscl.rb +544 -157
  9. data/lib/chef/resource.rb +3 -0
  10. data/lib/chef/resource/freebsd_package.rb +10 -2
  11. data/lib/chef/resource/user.rb +18 -0
  12. data/lib/chef/resource_reporter.rb +7 -7
  13. data/lib/chef/role.rb +2 -2
  14. data/lib/chef/version.rb +1 -1
  15. data/spec/data/mac_users/10.7-8.plist.xml +559 -0
  16. data/spec/data/mac_users/10.7-8.shadow.xml +11 -0
  17. data/spec/data/mac_users/10.7.plist.xml +559 -0
  18. data/spec/data/mac_users/10.7.shadow.xml +11 -0
  19. data/spec/data/mac_users/10.8.plist.xml +559 -0
  20. data/spec/data/mac_users/10.8.shadow.xml +21 -0
  21. data/spec/data/mac_users/10.9.plist.xml +560 -0
  22. data/spec/data/mac_users/10.9.shadow.xml +21 -0
  23. data/spec/functional/resource/env_spec.rb +137 -0
  24. data/spec/functional/resource/user/dscl_spec.rb +198 -0
  25. data/spec/functional/resource/{user_spec.rb → user/useradd_spec.rb} +1 -1
  26. data/spec/support/lib/chef/resource/zen_follower.rb +46 -0
  27. data/spec/unit/application_spec.rb +32 -9
  28. data/spec/unit/provider/group/dscl_spec.rb +38 -1
  29. data/spec/unit/provider/package/rpm_spec.rb +12 -0
  30. data/spec/unit/provider/user/dscl_spec.rb +659 -264
  31. data/spec/unit/provider/user/useradd_spec.rb +1 -0
  32. data/spec/unit/recipe_spec.rb +41 -0
  33. data/spec/unit/resource_reporter_spec.rb +48 -0
  34. data/spec/unit/resource_spec.rb +9 -2
  35. data/spec/unit/role_spec.rb +6 -0
  36. metadata +28 -3
@@ -19,6 +19,7 @@
19
19
  #
20
20
 
21
21
  require 'spec_helper'
22
+ require 'chef/provider/user/useradd'
22
23
 
23
24
  describe Chef::Provider::User::Useradd do
24
25
 
@@ -182,7 +182,48 @@ describe Chef::Recipe do
182
182
  zm_resource # force let binding evaluation
183
183
  run_context.resource_collection.resources(:zen_master => "klopp").should == zm_resource
184
184
  end
185
+ end
186
+
187
+ describe "creating a resource with short name" do
188
+ # zen_follower resource has this:
189
+ # provides :follower, :on_platforms => ["zen"]
190
+ before do
191
+ node.stub(:[]) do |key|
192
+ case key
193
+ when :platform
194
+ :zen
195
+ when :platform_version
196
+ "1.0.0"
197
+ else
198
+ nil
199
+ end
200
+ end
201
+ end
202
+
203
+ let(:resource_follower) do
204
+ recipe.declare_resource(:follower, "srst") do
205
+ master "none"
206
+ end
207
+ end
185
208
 
209
+ it "defines the resource using the declaration name with short name" do
210
+ resource_follower
211
+ run_context.resource_collection.lookup("follower[srst]").should_not be_nil
212
+ end
213
+ end
214
+
215
+ describe "creating a resource with a long name" do
216
+ let(:resource_zn_follower) do
217
+ recipe.declare_resource(:zen_follower, "srst") do
218
+ master "none"
219
+ end
220
+ end
221
+
222
+
223
+ it "defines the resource using the declaration name with long name" do
224
+ resource_zn_follower
225
+ run_context.resource_collection.lookup("zen_follower[srst]").should_not be_nil
226
+ end
186
227
  end
187
228
 
188
229
  describe "when attempting to create a resource of an invalid type" do
@@ -21,6 +21,7 @@
21
21
 
22
22
  require File.expand_path("../../spec_helper", __FILE__)
23
23
  require 'chef/resource_reporter'
24
+ require 'socket'
24
25
 
25
26
  describe Chef::ResourceReporter do
26
27
  before(:all) do
@@ -707,5 +708,52 @@ describe Chef::ResourceReporter do
707
708
  @resource_reporter.run_completed(@node)
708
709
  end
709
710
  end
711
+
712
+ context "when data report post is enabled and the server response fails" do
713
+ before do
714
+ @enable_reporting_url_fatals = Chef::Config[:enable_reporting_url_fatals]
715
+ Chef::Config[:enable_reporting_url_fatals] = true
716
+ # this call doesn't matter for this context
717
+ @rest_client.stub(:create_url)
718
+ end
719
+
720
+ after do
721
+ Chef::Config[:enable_reporting_url_fatals] = @enable_reporting_url_fatals
722
+ end
723
+
724
+ it "should log 4xx errors" do
725
+ response = Net::HTTPClientError.new("forbidden", "403", "Forbidden")
726
+ error = Net::HTTPServerException.new("403 message", response)
727
+ @rest_client.stub(:raw_http_request).and_raise(error)
728
+ Chef::Log.should_receive(:error).with(/403/)
729
+
730
+ @resource_reporter.post_reporting_data
731
+ end
732
+
733
+ it "should log error 5xx errors" do
734
+ response = Net::HTTPServerError.new("internal error", "500", "Internal Server Error")
735
+ error = Net::HTTPFatalError.new("500 message", response)
736
+ @rest_client.stub(:raw_http_request).and_raise(error)
737
+ Chef::Log.should_receive(:error).with(/500/)
738
+
739
+ @resource_reporter.post_reporting_data
740
+ end
741
+
742
+ it "should log if a socket error happens" do
743
+ @rest_client.stub(:raw_http_request).and_raise(SocketError.new("test socket error"))
744
+ Chef::Log.should_receive(:error).with(/test socket error/)
745
+
746
+ @resource_reporter.post_reporting_data
747
+
748
+ end
749
+
750
+ it "should raise if an unkwown error happens" do
751
+ @rest_client.stub(:raw_http_request).and_raise(Exception.new)
752
+
753
+ lambda {
754
+ @resource_reporter.post_reporting_data
755
+ }.should raise_error(Exception)
756
+ end
757
+ end
710
758
  end
711
759
  end
@@ -344,7 +344,7 @@ describe Chef::Resource do
344
344
  expected_keys = [ :allowed_actions, :params, :provider, :updated,
345
345
  :updated_by_last_action, :before, :supports,
346
346
  :noop, :ignore_failure, :name, :source_line,
347
- :action, :retries, :retry_delay, :elapsed_time,
347
+ :action, :retries, :retry_delay, :elapsed_time,
348
348
  :guard_interpreter, :sensitive ]
349
349
  (hash.keys - expected_keys).should == []
350
350
  (expected_keys - hash.keys).should == []
@@ -527,6 +527,13 @@ describe Chef::Resource do
527
527
  snitch_var2.should be_false
528
528
  end
529
529
 
530
+ it "reports 0 elapsed time if actual elapsed time is < 0" do
531
+ expected = Time.now
532
+ Time.stub(:now).and_return(expected, expected - 1)
533
+ @resource.run_action(:purr)
534
+ @resource.elapsed_time.should == 0
535
+ end
536
+
530
537
  describe "guard_interpreter attribute" do
531
538
  let(:resource) { @resource }
532
539
 
@@ -788,7 +795,7 @@ describe Chef::Resource do
788
795
  before(:each) do
789
796
  @resource_file = Chef::Resource::File.new("/nonexistent/CHEF-5098/file", @run_context)
790
797
  @action = :create
791
- end
798
+ end
792
799
 
793
800
  def compiled_resource_data(resource, action, err)
794
801
  error_inspector = Chef::Formatters::ErrorInspectors::ResourceFailureInspector.new(resource, action, err)
@@ -296,6 +296,12 @@ EOR
296
296
  File.should_not_receive(:exists?)
297
297
  lambda {@role.class.from_disk("lolcat")}.should raise_error(Chef::Exceptions::DuplicateRole)
298
298
  end
299
+
300
+ it "should not raise an exception if two files exist with a similar name" do
301
+ Dir.should_receive(:glob).and_return(["#{Chef::Config[:role_path]}/memes/lolcat.rb", "#{Chef::Config[:role_path]}/super_lolcat.rb"])
302
+ File.should_not_receive(:exists?)
303
+ lambda {@role.class.from_disk("lolcat")}.should_not raise_error(Chef::Exceptions::DuplicateRole)
304
+ end
299
305
  end
300
306
 
301
307
  describe "when loading from disk and role_path is an array" do
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.14.2
4
+ version: 11.14.6
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-08-01 00:00:00.000000000 Z
11
+ date: 2014-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-config
@@ -258,6 +258,20 @@ dependencies:
258
258
  - - "~>"
259
259
  - !ruby/object:Gem::Version
260
260
  version: '0.9'
261
+ - !ruby/object:Gem::Dependency
262
+ name: plist
263
+ requirement: !ruby/object:Gem::Requirement
264
+ requirements:
265
+ - - "~>"
266
+ - !ruby/object:Gem::Version
267
+ version: 3.1.0
268
+ type: :runtime
269
+ prerelease: false
270
+ version_requirements: !ruby/object:Gem::Requirement
271
+ requirements:
272
+ - - "~>"
273
+ - !ruby/object:Gem::Version
274
+ version: 3.1.0
261
275
  - !ruby/object:Gem::Dependency
262
276
  name: rack
263
277
  requirement: !ruby/object:Gem::Requirement
@@ -1451,6 +1465,14 @@ files:
1451
1465
  - spec/data/lwrp_const_scoping/resources/conflict.rb
1452
1466
  - spec/data/lwrp_override/providers/buck_passer.rb
1453
1467
  - spec/data/lwrp_override/resources/foo.rb
1468
+ - spec/data/mac_users/10.7-8.plist.xml
1469
+ - spec/data/mac_users/10.7-8.shadow.xml
1470
+ - spec/data/mac_users/10.7.plist.xml
1471
+ - spec/data/mac_users/10.7.shadow.xml
1472
+ - spec/data/mac_users/10.8.plist.xml
1473
+ - spec/data/mac_users/10.8.shadow.xml
1474
+ - spec/data/mac_users/10.9.plist.xml
1475
+ - spec/data/mac_users/10.9.shadow.xml
1454
1476
  - spec/data/metadata/quick_start/metadata.rb
1455
1477
  - spec/data/nodes/default.rb
1456
1478
  - spec/data/nodes/test.example.com.rb
@@ -1573,6 +1595,7 @@ files:
1573
1595
  - spec/functional/resource/cron_spec.rb
1574
1596
  - spec/functional/resource/deploy_revision_spec.rb
1575
1597
  - spec/functional/resource/directory_spec.rb
1598
+ - spec/functional/resource/env_spec.rb
1576
1599
  - spec/functional/resource/file_spec.rb
1577
1600
  - spec/functional/resource/git_spec.rb
1578
1601
  - spec/functional/resource/group_spec.rb
@@ -1587,7 +1610,8 @@ files:
1587
1610
  - spec/functional/resource/remote_file_spec.rb
1588
1611
  - spec/functional/resource/rpm_spec.rb
1589
1612
  - spec/functional/resource/template_spec.rb
1590
- - spec/functional/resource/user_spec.rb
1613
+ - spec/functional/resource/user/dscl_spec.rb
1614
+ - spec/functional/resource/user/useradd_spec.rb
1591
1615
  - spec/functional/rest_spec.rb
1592
1616
  - spec/functional/run_lock_spec.rb
1593
1617
  - spec/functional/shell_spec.rb
@@ -1629,6 +1653,7 @@ files:
1629
1653
  - spec/support/lib/chef/resource/cat.rb
1630
1654
  - spec/support/lib/chef/resource/one_two_three_four.rb
1631
1655
  - spec/support/lib/chef/resource/with_state.rb
1656
+ - spec/support/lib/chef/resource/zen_follower.rb
1632
1657
  - spec/support/lib/chef/resource/zen_master.rb
1633
1658
  - spec/support/lib/library_load_order.rb
1634
1659
  - spec/support/matchers/leak.rb