puppet 2.7.18 → 2.7.19

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

Files changed (137) hide show
  1. data/CHANGELOG +82 -0
  2. data/CONTRIBUTING.md +114 -171
  3. data/README.md +8 -0
  4. data/README_DEVELOPER.md +38 -3
  5. data/Rakefile +19 -3
  6. data/conf/osx/createpackage.sh +3 -1
  7. data/conf/redhat/logrotate +1 -1
  8. data/conf/redhat/puppet.spec +35 -8
  9. data/lib/puppet.rb +1 -1
  10. data/lib/puppet/application/agent.rb +2 -0
  11. data/lib/puppet/application/master.rb +2 -0
  12. data/lib/puppet/configurer.rb +2 -3
  13. data/lib/puppet/defaults.rb +6 -5
  14. data/lib/puppet/face/module/install.rb +2 -1
  15. data/lib/puppet/file_bucket/dipper.rb +1 -1
  16. data/lib/puppet/indirector/file_content.rb +2 -2
  17. data/lib/puppet/indirector/file_metadata.rb +2 -2
  18. data/lib/puppet/indirector/indirection.rb +3 -4
  19. data/lib/puppet/indirector/rest.rb +12 -6
  20. data/lib/puppet/interface/action_manager.rb +1 -2
  21. data/lib/puppet/module_tool/applications/unpacker.rb +22 -3
  22. data/lib/puppet/network/handler/fileserver.rb +2 -2
  23. data/lib/puppet/parser/ast/resource.rb +9 -2
  24. data/lib/puppet/parser/functions/fqdn_rand.rb +2 -1
  25. data/lib/puppet/parser/functions/md5.rb +2 -2
  26. data/lib/puppet/parser/functions/sha1.rb +2 -2
  27. data/lib/puppet/parser/functions/template.rb +0 -2
  28. data/lib/puppet/parser/type_loader.rb +1 -2
  29. data/lib/puppet/provider/augeas/augeas.rb +19 -1
  30. data/lib/puppet/provider/confine.rb +1 -1
  31. data/lib/puppet/provider/package/msi.rb +97 -51
  32. data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +1 -0
  33. data/lib/puppet/provider/service/gentoo.rb +0 -2
  34. data/lib/puppet/provider/service/openrc.rb +69 -0
  35. data/lib/puppet/provider/service/windows.rb +6 -4
  36. data/lib/puppet/provider/user/aix.rb +8 -4
  37. data/lib/puppet/provider/user/useradd.rb +6 -0
  38. data/lib/puppet/rails/benchmark.rb +2 -2
  39. data/lib/puppet/reports/store.rb +9 -9
  40. data/lib/puppet/resource/catalog.rb +2 -1
  41. data/lib/puppet/resource/type_collection.rb +2 -1
  42. data/lib/puppet/ssl/base.rb +1 -2
  43. data/lib/puppet/ssl/certificate_authority/interface.rb +1 -0
  44. data/lib/puppet/test/test_helper.rb +2 -1
  45. data/lib/puppet/type.rb +1 -1
  46. data/lib/puppet/type/augeas.rb +1 -1
  47. data/lib/puppet/type/file.rb +4 -2
  48. data/lib/puppet/type/scheduled_task.rb +8 -10
  49. data/lib/puppet/type/tidy.rb +1 -1
  50. data/lib/puppet/util.rb +63 -25
  51. data/lib/puppet/util/autoload.rb +6 -4
  52. data/lib/puppet/util/checksums.rb +3 -8
  53. data/lib/puppet/util/diff.rb +2 -1
  54. data/lib/puppet/util/filetype.rb +1 -3
  55. data/lib/puppet/util/run_mode.rb +2 -1
  56. data/lib/puppet/util/suidmanager.rb +1 -1
  57. data/lib/puppet/util/windows.rb +1 -0
  58. data/lib/puppet/util/windows/file.rb +27 -0
  59. data/lib/puppet/util/windows/user.rb +1 -2
  60. data/man/man8/puppet-agent.8 +4 -0
  61. data/man/man8/puppet-master.8 +4 -0
  62. data/man/man8/puppetmasterd.8 +4 -0
  63. data/spec/fixtures/unit/provider/augeas/augeas/augeas/lenses/test.aug +13 -0
  64. data/spec/fixtures/unit/provider/augeas/augeas/etc/fstab +10 -0
  65. data/spec/fixtures/unit/provider/augeas/augeas/etc/hosts +6 -0
  66. data/spec/fixtures/unit/provider/augeas/augeas/etc/test +3 -0
  67. data/spec/fixtures/unit/provider/augeas/augeas/test.aug +13 -0
  68. data/spec/fixtures/unit/provider/service/openrc/rcservice_list +8 -0
  69. data/spec/fixtures/unit/provider/service/openrc/rcstatus +43 -0
  70. data/spec/integration/defaults_spec.rb +3 -3
  71. data/spec/integration/network/server/mongrel_spec.rb +8 -6
  72. data/spec/integration/parser/parser_spec.rb +1 -1
  73. data/spec/integration/type/file_spec.rb +49 -12
  74. data/spec/lib/puppet_spec/database.rb +5 -3
  75. data/spec/lib/puppet_spec/files.rb +2 -1
  76. data/spec/monkey_patches/alias_should_to_must.rb +15 -2
  77. data/spec/shared_behaviours/file_serving_model.rb +9 -6
  78. data/spec/shared_behaviours/path_parameters.rb +5 -5
  79. data/spec/shared_behaviours/things_that_declare_options.rb +5 -5
  80. data/spec/unit/application/facts_spec.rb +1 -1
  81. data/spec/unit/application_spec.rb +10 -8
  82. data/spec/unit/configurer_spec.rb +11 -2
  83. data/spec/unit/face/ca_spec.rb +15 -15
  84. data/spec/unit/face/help_spec.rb +5 -5
  85. data/spec/unit/face/module/install_spec.rb +13 -2
  86. data/spec/unit/face/node_spec.rb +7 -6
  87. data/spec/unit/indirector/certificate_request/ca_spec.rb +1 -1
  88. data/spec/unit/indirector/envelope_spec.rb +0 -13
  89. data/spec/unit/indirector/facts/inventory_service_spec.rb +1 -1
  90. data/spec/unit/indirector/queue_spec.rb +3 -3
  91. data/spec/unit/indirector/rest_spec.rb +31 -20
  92. data/spec/unit/indirector_spec.rb +5 -5
  93. data/spec/unit/interface/action_builder_spec.rb +3 -2
  94. data/spec/unit/interface/action_manager_spec.rb +1 -1
  95. data/spec/unit/interface/action_spec.rb +4 -3
  96. data/spec/unit/interface/face_collection_spec.rb +1 -1
  97. data/spec/unit/interface/option_spec.rb +13 -9
  98. data/spec/unit/interface_spec.rb +5 -5
  99. data/spec/unit/module_tool/applications/unpacker_spec.rb +61 -0
  100. data/spec/unit/network/handler/fileserver_spec.rb +3 -3
  101. data/spec/unit/other/transbucket_spec.rb +6 -9
  102. data/spec/unit/parser/ast/resource_spec.rb +27 -0
  103. data/spec/unit/parser/functions/create_resources_spec.rb +12 -12
  104. data/spec/unit/parser/lexer_spec.rb +5 -5
  105. data/spec/unit/provider/augeas/augeas_spec.rb +78 -0
  106. data/spec/unit/provider/nameservice/directoryservice_spec.rb +6 -6
  107. data/spec/unit/provider/package/freebsd_spec.rb +2 -2
  108. data/spec/unit/provider/package/msi_spec.rb +181 -114
  109. data/spec/unit/provider/package/openbsd_spec.rb +1 -0
  110. data/spec/unit/provider/package/pkgdmg_spec.rb +3 -3
  111. data/spec/unit/provider/scheduled_task/win32_taskscheduler_spec.rb +1 -1
  112. data/spec/unit/provider/service/openrc_spec.rb +209 -0
  113. data/spec/unit/provider/service/windows_spec.rb +57 -59
  114. data/spec/unit/provider/user/useradd_spec.rb +7 -0
  115. data/spec/unit/reports/store_spec.rb +13 -13
  116. data/spec/unit/resource/catalog_spec.rb +29 -24
  117. data/spec/unit/resource_spec.rb +13 -13
  118. data/spec/unit/simple_graph_spec.rb +12 -12
  119. data/spec/unit/ssl/certificate_authority/interface_spec.rb +3 -3
  120. data/spec/unit/ssl/certificate_authority_spec.rb +11 -10
  121. data/spec/unit/transaction_spec.rb +3 -3
  122. data/spec/unit/type/cron_spec.rb +171 -171
  123. data/spec/unit/type/exec_spec.rb +29 -27
  124. data/spec/unit/type/file_spec.rb +22 -13
  125. data/spec/unit/type/interface_spec.rb +1 -1
  126. data/spec/unit/type/scheduled_task_spec.rb +15 -14
  127. data/spec/unit/type/tidy_spec.rb +2 -2
  128. data/spec/unit/type/user_spec.rb +15 -15
  129. data/spec/unit/type/vlan_spec.rb +1 -1
  130. data/spec/unit/type_spec.rb +22 -25
  131. data/spec/unit/util/autoload_spec.rb +13 -7
  132. data/spec/unit/util/backups_spec.rb +36 -67
  133. data/spec/unit/util/storage_spec.rb +2 -9
  134. data/spec/unit/util/suidmanager_spec.rb +1 -1
  135. data/spec/unit/util_spec.rb +20 -28
  136. data/test/ral/manager/attributes.rb +1 -1
  137. metadata +1553 -1542
@@ -88,6 +88,13 @@ describe provider_class do
88
88
  @resource.stubs(:managehome?).returns true
89
89
  @provider.check_manage_home.must == ["-m"]
90
90
  end
91
+
92
+ it "should return an array with -r flag if home is managed" do
93
+ @resource.stubs(:managehome?).returns true
94
+ @resource.stubs(:ensure) == :absent
95
+ @provider.stubs(:command).returns("userdel")
96
+ @provider.deletecmd.must == ["userdel", "-r", "fakeval"]
97
+ end
91
98
 
92
99
  it "should return an array with -M if home is not managed and on Redhat" do
93
100
  Facter.stubs(:value).with("operatingsystem").returns("RedHat")
@@ -45,31 +45,31 @@ describe processor do
45
45
  @report.process
46
46
  end
47
47
 
48
- ['..', 'hello/', '/hello', 'he/llo', 'hello/..', '.'].each do |node|
49
- it "rejects #{node.inspect}" do
50
- @report.host = node
51
- expect { @report.process }.to raise_error(ArgumentError, /Invalid node/)
52
- end
48
+ it "rejects invalid hostnames" do
49
+ @report.host = ".."
50
+ FileTest.expects(:exists?).never
51
+ Tempfile.expects(:new).never
52
+ expect { @report.process }.to raise_error(ArgumentError, /Invalid node/)
53
53
  end
54
+ end
54
55
 
55
- ['.hello', 'hello.', '..hi', 'hi..'].each do |node|
56
- it "accepts #{node.inspect}" do
57
- @report.host = node
58
- @report.process
59
- end
56
+ describe "::destroy" do
57
+ it "rejects invalid hostnames" do
58
+ File.expects(:unlink).never
59
+ expect { processor.destroy("..") }.to raise_error(ArgumentError, /Invalid node/)
60
60
  end
61
61
  end
62
62
 
63
- describe "::destroy" do
63
+ describe "::validate_host" do
64
64
  ['..', 'hello/', '/hello', 'he/llo', 'hello/..', '.'].each do |node|
65
65
  it "rejects #{node.inspect}" do
66
- expect { processor.destroy(node) }.to raise_error(ArgumentError, /Invalid node/)
66
+ expect { processor.validate_host(node) }.to raise_error(ArgumentError, /Invalid node/)
67
67
  end
68
68
  end
69
69
 
70
70
  ['.hello', 'hello.', '..hi', 'hi..'].each do |node|
71
71
  it "accepts #{node.inspect}" do
72
- processor.destroy(node)
72
+ processor.validate_host(node)
73
73
  end
74
74
  end
75
75
  end
@@ -309,7 +309,12 @@ describe Puppet::Resource::Catalog, "when compiling" do
309
309
  end
310
310
 
311
311
  it "should add all resources as RAL instances" do
312
- @resources.each { |resource| @catalog.resource(resource.ref).should be_instance_of(Puppet::Type) }
312
+ @resources.each do |resource|
313
+ # Warning: a failure here will result in "global resource iteration is
314
+ # deprecated" being raised, because the rspec rendering to get the
315
+ # result tries to call `each` on the resource, and that raises.
316
+ @catalog.resource(resource.ref).must be_a_kind_of(Puppet::Type)
317
+ end
313
318
  end
314
319
 
315
320
  it "should copy the tag list to the new catalog" do
@@ -416,8 +421,8 @@ describe Puppet::Resource::Catalog, "when compiling" do
416
421
 
417
422
  it "should provide a method to add one or more resources" do
418
423
  @catalog.add_resource @one, @two
419
- @catalog.resource(@one.ref).should equal(@one)
420
- @catalog.resource(@two.ref).should equal(@two)
424
+ @catalog.resource(@one.ref).must equal(@one)
425
+ @catalog.resource(@two.ref).must equal(@two)
421
426
  end
422
427
 
423
428
  it "should add resources to the relationship graph if it exists" do
@@ -433,20 +438,18 @@ describe Puppet::Resource::Catalog, "when compiling" do
433
438
 
434
439
  it "should make all vertices available by resource reference" do
435
440
  @catalog.add_resource(@one)
436
- @catalog.resource(@one.ref).should equal(@one)
437
- @catalog.vertices.find { |r| r.ref == @one.ref }.should equal(@one)
441
+ @catalog.resource(@one.ref).must equal(@one)
442
+ @catalog.vertices.find { |r| r.ref == @one.ref }.must equal(@one)
438
443
  end
439
444
 
440
445
  it "should canonize how resources are referred to during retrieval when both type and title are provided" do
441
446
  @catalog.add_resource(@one)
442
-
443
- @catalog.resource("notify", "one").should equal(@one)
447
+ @catalog.resource("notify", "one").must equal(@one)
444
448
  end
445
449
 
446
450
  it "should canonize how resources are referred to during retrieval when just the title is provided" do
447
451
  @catalog.add_resource(@one)
448
-
449
- @catalog.resource("notify[one]", nil).should equal(@one)
452
+ @catalog.resource("notify[one]", nil).must equal(@one)
450
453
  end
451
454
 
452
455
  it "should not allow two resources with the same resource reference" do
@@ -502,26 +505,28 @@ describe Puppet::Resource::Catalog, "when compiling" do
502
505
 
503
506
  it "should be able to find resources by reference" do
504
507
  @catalog.add_resource @one
505
- @catalog.resource(@one.ref).should equal(@one)
508
+ @catalog.resource(@one.ref).must equal(@one)
506
509
  end
507
510
 
508
511
  it "should be able to find resources by reference or by type/title tuple" do
509
512
  @catalog.add_resource @one
510
- @catalog.resource("notify", "one").should equal(@one)
513
+ @catalog.resource("notify", "one").must equal(@one)
511
514
  end
512
515
 
513
516
  it "should have a mechanism for removing resources" do
514
- @catalog.add_resource @one
515
- @one.expects :remove
517
+ @catalog.add_resource(@one)
518
+ @catalog.resource(@one.ref).must be
519
+ @catalog.vertex?(@one).must be_true
520
+
516
521
  @catalog.remove_resource(@one)
517
- @catalog.resource(@one.ref).should be_nil
518
- @catalog.vertex?(@one).should be_false
522
+ @catalog.resource(@one.ref).must be_nil
523
+ @catalog.vertex?(@one).must be_false
519
524
  end
520
525
 
521
526
  it "should have a method for creating aliases for resources" do
522
527
  @catalog.add_resource @one
523
528
  @catalog.alias(@one, "other")
524
- @catalog.resource("notify", "other").should equal(@one)
529
+ @catalog.resource("notify", "other").must equal(@one)
525
530
  end
526
531
 
527
532
  it "should ignore conflicting aliases that point to the aliased resource" do
@@ -534,7 +539,7 @@ describe Puppet::Resource::Catalog, "when compiling" do
534
539
 
535
540
  @catalog.add_resource(resource)
536
541
 
537
- @catalog.resource(:file, @basepath+"/something").should equal(resource)
542
+ @catalog.resource(:file, @basepath+"/something").must equal(resource)
538
543
  end
539
544
 
540
545
  it "should not create aliases for non-isomorphic resources whose names do not match their titles" do
@@ -550,7 +555,7 @@ describe Puppet::Resource::Catalog, "when compiling" do
550
555
  it "should alias using the class name from the resource reference, not the resource class name" do
551
556
  @catalog.add_resource @one
552
557
  @catalog.alias(@one, "other")
553
- @catalog.resource("notify", "other").should equal(@one)
558
+ @catalog.resource("notify", "other").must equal(@one)
554
559
  end
555
560
 
556
561
  it "should fail to add an alias if the aliased name already exists" do
@@ -565,13 +570,13 @@ describe Puppet::Resource::Catalog, "when compiling" do
565
570
 
566
571
  it "should not create aliases that point back to the resource" do
567
572
  @catalog.alias(@one, "one")
568
- @catalog.resource(:notify, "one").should be_nil
573
+ @catalog.resource(:notify, "one").must be_nil
569
574
  end
570
575
 
571
576
  it "should be able to look resources up by their aliases" do
572
577
  @catalog.add_resource @one
573
578
  @catalog.alias @one, "two"
574
- @catalog.resource(:notify, "two").should equal(@one)
579
+ @catalog.resource(:notify, "two").must equal(@one)
575
580
  end
576
581
 
577
582
  it "should remove resource aliases when the target resource is removed" do
@@ -579,14 +584,14 @@ describe Puppet::Resource::Catalog, "when compiling" do
579
584
  @catalog.alias(@one, "other")
580
585
  @one.expects :remove
581
586
  @catalog.remove_resource(@one)
582
- @catalog.resource("notify", "other").should be_nil
587
+ @catalog.resource("notify", "other").must be_nil
583
588
  end
584
589
 
585
590
  it "should add an alias for the namevar when the title and name differ on isomorphic resource types" do
586
591
  resource = Puppet::Type.type(:file).new :path => @basepath+"/something", :title => "other", :content => "blah"
587
592
  resource.expects(:isomorphic?).returns(true)
588
593
  @catalog.add_resource(resource)
589
- @catalog.resource(:file, "other").should equal(resource)
594
+ @catalog.resource(:file, "other").must equal(resource)
590
595
  @catalog.resource(:file, @basepath+"/something").ref.should == resource.ref
591
596
  end
592
597
 
@@ -594,7 +599,7 @@ describe Puppet::Resource::Catalog, "when compiling" do
594
599
  resource = Puppet::Type.type(:file).new :path => @basepath+"/something", :title => "other", :content => "blah"
595
600
  resource.expects(:isomorphic?).returns(false)
596
601
  @catalog.add_resource(resource)
597
- @catalog.resource(:file, resource.title).should equal(resource)
602
+ @catalog.resource(:file, resource.title).must equal(resource)
598
603
  # We can't use .should here, because the resources respond to that method.
599
604
  raise "Aliased non-isomorphic resource" if @catalog.resource(:file, resource.name)
600
605
  end
@@ -604,7 +609,7 @@ describe Puppet::Resource::Catalog, "when compiling" do
604
609
  resource = stub 'file', :ref => "File[/yay]", :catalog= => @catalog, :title => "/yay", :[] => "/yay"
605
610
  Puppet::Type.type(:file).expects(:new).with(args).returns(resource)
606
611
  @catalog.create_resource :file, args
607
- @catalog.resource("File[/yay]").should equal(resource)
612
+ @catalog.resource("File[/yay]").must equal(resource)
608
613
  end
609
614
 
610
615
  describe "when adding resources with multiple namevars" do
@@ -20,7 +20,7 @@ describe Puppet::Resource do
20
20
  end
21
21
 
22
22
  it "should require the type and title" do
23
- lambda { Puppet::Resource.new }.should raise_error(ArgumentError)
23
+ expect { Puppet::Resource.new }.to raise_error(ArgumentError)
24
24
  end
25
25
 
26
26
  it "should canonize types to capitalized strings" do
@@ -93,15 +93,15 @@ describe Puppet::Resource do
93
93
 
94
94
 
95
95
  it "should fail if the title is nil and the type is not a valid resource reference string" do
96
- expect { Puppet::Resource.new("resource-spec-foo") }.should raise_error(ArgumentError)
96
+ expect { Puppet::Resource.new("resource-spec-foo") }.to raise_error(ArgumentError)
97
97
  end
98
98
 
99
99
  it 'should fail if strict is set and type does not exist' do
100
- expect { Puppet::Resource.new('resource-spec-foo', 'title', {:strict=>true}) }.should raise_error(ArgumentError, 'Invalid resource type resource-spec-foo')
100
+ expect { Puppet::Resource.new('resource-spec-foo', 'title', {:strict=>true}) }.to raise_error(ArgumentError, 'Invalid resource type resource-spec-foo')
101
101
  end
102
102
 
103
103
  it 'should fail if strict is set and class does not exist' do
104
- expect { Puppet::Resource.new('Class', 'resource-spec-foo', {:strict=>true}) }.should raise_error(ArgumentError, 'Could not find declared class resource-spec-foo')
104
+ expect { Puppet::Resource.new('Class', 'resource-spec-foo', {:strict=>true}) }.to raise_error(ArgumentError, 'Could not find declared class resource-spec-foo')
105
105
  end
106
106
 
107
107
  it "should fail if the title is a hash and the type is not a valid resource reference string" do
@@ -284,11 +284,11 @@ describe Puppet::Resource do
284
284
  end
285
285
 
286
286
  it "should fail if invalid parameters are used" do
287
- expect { Puppet::Resource.new("file", "/path", :strict => true, :parameters => {:nosuchparam => "bar"}) }.should raise_error
287
+ expect { Puppet::Resource.new("file", "/path", :strict => true, :parameters => {:nosuchparam => "bar"}) }.to raise_error
288
288
  end
289
289
 
290
290
  it "should fail if the resource type cannot be resolved" do
291
- expect { Puppet::Resource.new("nosuchtype", "/path", :strict => true) }.should raise_error
291
+ expect { Puppet::Resource.new("nosuchtype", "/path", :strict => true) }.to raise_error
292
292
  end
293
293
  end
294
294
 
@@ -353,7 +353,7 @@ describe Puppet::Resource do
353
353
  it "should be able to set the name for non-builtin types" do
354
354
  resource = Puppet::Resource.new(:foo, "bar")
355
355
  resource[:name] = "eh"
356
- expect { resource[:name] = "eh" }.should_not raise_error
356
+ expect { resource[:name] = "eh" }.to_not raise_error
357
357
  end
358
358
 
359
359
  it "should be able to return the name for non-builtin types" do
@@ -445,7 +445,7 @@ describe Puppet::Resource do
445
445
  end
446
446
 
447
447
  it "should be able to be dumped to yaml" do
448
- proc { YAML.dump(@resource) }.should_not raise_error
448
+ expect { YAML.dump(@resource) }.to_not raise_error
449
449
  end
450
450
 
451
451
  it "should produce an equivalent yaml object" do
@@ -470,7 +470,7 @@ type: File
470
470
  end
471
471
 
472
472
  it "should deserialize a Puppet::Resource::Reference without exceptions" do
473
- expect { YAML.load(@old_storedconfig_yaml) }.should_not raise_error
473
+ expect { YAML.load(@old_storedconfig_yaml) }.to_not raise_error
474
474
  end
475
475
 
476
476
  it "should deserialize as a Puppet::Resource::Reference as a Puppet::Resource" do
@@ -486,7 +486,7 @@ type: File
486
486
  it "should use the resource type's :new method to create the resource if the resource is of a builtin type" do
487
487
  resource = Puppet::Resource.new("file", basepath+"/my/file")
488
488
  result = resource.to_ral
489
- result.should be_instance_of(Puppet::Type.type(:file))
489
+ result.must be_instance_of(Puppet::Type.type(:file))
490
490
  result[:path].should == basepath+"/my/file"
491
491
  end
492
492
 
@@ -494,7 +494,7 @@ type: File
494
494
  resource = Puppet::Resource.new("foobar", "somename")
495
495
  result = resource.to_ral
496
496
 
497
- result.should be_instance_of(Puppet::Type.type(:component))
497
+ result.must be_instance_of(Puppet::Type.type(:component))
498
498
  result.title.should == "Foobar[somename]"
499
499
  end
500
500
  end
@@ -735,12 +735,12 @@ type: File
735
735
 
736
736
  it "should fail if no title is provided" do
737
737
  @data.delete('title')
738
- expect { Puppet::Resource.from_pson(@data) }.should raise_error(ArgumentError)
738
+ expect { Puppet::Resource.from_pson(@data) }.to raise_error(ArgumentError)
739
739
  end
740
740
 
741
741
  it "should fail if no type is provided" do
742
742
  @data.delete('type')
743
- expect { Puppet::Resource.from_pson(@data) }.should raise_error(ArgumentError)
743
+ expect { Puppet::Resource.from_pson(@data) }.to raise_error(ArgumentError)
744
744
  end
745
745
 
746
746
  it "should set each of the provided parameters" do
@@ -24,7 +24,7 @@ describe Puppet::SimpleGraph do
24
24
  @graph = Puppet::SimpleGraph.new
25
25
  @graph.add_edge(:one, :two)
26
26
 
27
- proc { @graph.to_dot_graph }.should_not raise_error
27
+ expect { @graph.to_dot_graph }.to_not raise_error
28
28
  end
29
29
 
30
30
  describe "when managing vertices" do
@@ -45,7 +45,7 @@ describe Puppet::SimpleGraph do
45
45
 
46
46
  it "should ignore already-present vertices when asked to add a vertex" do
47
47
  @graph.add_vertex(:test)
48
- proc { @graph.add_vertex(:test) }.should_not raise_error
48
+ expect { @graph.add_vertex(:test) }.to_not raise_error
49
49
  end
50
50
 
51
51
  it "should return true when asked if a vertex is present" do
@@ -72,7 +72,7 @@ describe Puppet::SimpleGraph do
72
72
  end
73
73
 
74
74
  it "should do nothing when a non-vertex is asked to be removed" do
75
- proc { @graph.remove_vertex!(:one) }.should_not raise_error
75
+ expect { @graph.remove_vertex!(:one) }.to_not raise_error
76
76
  end
77
77
  end
78
78
 
@@ -291,22 +291,22 @@ describe Puppet::SimpleGraph do
291
291
 
292
292
  it "should fail on two-vertex loops" do
293
293
  add_edges :a => :b, :b => :a
294
- proc { @graph.report_cycles_in_graph }.should raise_error(Puppet::Error)
294
+ expect { @graph.report_cycles_in_graph }.to raise_error(Puppet::Error)
295
295
  end
296
296
 
297
297
  it "should fail on multi-vertex loops" do
298
298
  add_edges :a => :b, :b => :c, :c => :a
299
- proc { @graph.report_cycles_in_graph }.should raise_error(Puppet::Error)
299
+ expect { @graph.report_cycles_in_graph }.to raise_error(Puppet::Error)
300
300
  end
301
301
 
302
302
  it "should fail when a larger tree contains a small cycle" do
303
303
  add_edges :a => :b, :b => :a, :c => :a, :d => :c
304
- proc { @graph.report_cycles_in_graph }.should raise_error(Puppet::Error)
304
+ expect { @graph.report_cycles_in_graph }.to raise_error(Puppet::Error)
305
305
  end
306
306
 
307
307
  it "should succeed on trees with no cycles" do
308
308
  add_edges :a => :b, :b => :e, :c => :a, :d => :c
309
- proc { @graph.report_cycles_in_graph }.should_not raise_error
309
+ expect { @graph.report_cycles_in_graph }.to_not raise_error
310
310
  end
311
311
 
312
312
  it "should produce the correct relationship text" do
@@ -323,7 +323,7 @@ describe Puppet::SimpleGraph do
323
323
  add_edges "b" => "c"
324
324
 
325
325
  cycles = nil
326
- expect { cycles = @graph.find_cycles_in_graph }.should_not raise_error
326
+ expect { cycles = @graph.find_cycles_in_graph }.to_not raise_error
327
327
  simplify(cycles).should be == [["a", "b"]]
328
328
  end
329
329
 
@@ -332,7 +332,7 @@ describe Puppet::SimpleGraph do
332
332
  add_edges "b" => "b1", "b1" => "b"
333
333
 
334
334
  cycles = nil
335
- expect { cycles = @graph.find_cycles_in_graph }.should_not raise_error
335
+ expect { cycles = @graph.find_cycles_in_graph }.to_not raise_error
336
336
  simplify(cycles).should be == [["a1", "a"], ["b1", "b"]]
337
337
  end
338
338
 
@@ -342,7 +342,7 @@ describe Puppet::SimpleGraph do
342
342
  add_edges "c" => "c1", "c1" => "c2", "c2" => "c3", "c3" => "c"
343
343
 
344
344
  cycles = nil
345
- expect { cycles = @graph.find_cycles_in_graph }.should_not raise_error
345
+ expect { cycles = @graph.find_cycles_in_graph }.to_not raise_error
346
346
  simplify(cycles).should be == [%w{a1 a}, %w{c1 c2 c3 c}]
347
347
  end
348
348
 
@@ -353,7 +353,7 @@ describe Puppet::SimpleGraph do
353
353
  add_edges "c" => "c2", "c2" => "b"
354
354
 
355
355
  cycles = nil
356
- expect { cycles = @graph.find_cycles_in_graph }.should_not raise_error
356
+ expect { cycles = @graph.find_cycles_in_graph }.to_not raise_error
357
357
  simplify(cycles).should be == [%w{a b c1 c2 c}]
358
358
  end
359
359
 
@@ -362,7 +362,7 @@ describe Puppet::SimpleGraph do
362
362
  (1..(limit - 1)).each do |n| add_edges n.to_s => (n+1).to_s end
363
363
 
364
364
  cycles = nil
365
- expect { cycles = @graph.find_cycles_in_graph }.should_not raise_error
365
+ expect { cycles = @graph.find_cycles_in_graph }.to_not raise_error
366
366
  simplify(cycles).should be == []
367
367
  end
368
368
 
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env rspec
1
+ #!/usr/bin/env ruby -S rspec
2
2
  require 'spec_helper'
3
3
 
4
4
  require 'puppet/ssl/certificate_authority'
@@ -95,14 +95,14 @@ describe Puppet::SSL::CertificateAuthority::Interface do
95
95
  lambda { @applier.apply(@ca) }.should raise_error(Puppet::SSL::CertificateAuthority::Interface::InterfaceError)
96
96
  end
97
97
 
98
- it "should log non-Interface failures rather than failing" do
98
+ it "should log non-Interface failures" do
99
99
  @applier = @class.new(:revoke, :to => :all)
100
100
 
101
101
  @ca.expects(:list).raises ArgumentError
102
102
 
103
103
  Puppet.expects(:err)
104
104
 
105
- lambda { @applier.apply(@ca) }.should_not raise_error
105
+ lambda { @applier.apply(@ca) }.should raise_error
106
106
  end
107
107
 
108
108
  describe "with an empty array specified and the method is not list" do
@@ -370,14 +370,15 @@ describe Puppet::SSL::CertificateAuthority do
370
370
  it "should fail if no CSR can be found for the host" do
371
371
  Puppet::SSL::CertificateRequest.indirection.expects(:find).with(@name).returns nil
372
372
 
373
- lambda { @ca.sign(@name) }.should raise_error(ArgumentError)
373
+ expect { @ca.sign(@name) }.to raise_error(ArgumentError)
374
374
  end
375
375
 
376
376
  it "should fail if an unknown request extension is present" do
377
377
  @request.stubs :request_extensions => [{ "oid" => "bananas",
378
378
  "value" => "delicious" }]
379
- expect { @ca.sign(@name) }.
380
- should raise_error(/CSR has request extensions that are not permitted/)
379
+ expect {
380
+ @ca.sign(@name)
381
+ }.to raise_error(/CSR has request extensions that are not permitted/)
381
382
  end
382
383
 
383
384
  it "should fail if the CSR contains alt names and they are not expected" do
@@ -390,7 +391,7 @@ describe Puppet::SSL::CertificateAuthority do
390
391
 
391
392
  it "should not fail if the CSR does not contain alt names and they are expected" do
392
393
  @request.stubs(:subject_alt_names).returns []
393
- expect { @ca.sign(@name, true) }.should_not raise_error
394
+ expect { @ca.sign(@name, true) }.to_not raise_error
394
395
  end
395
396
 
396
397
  it "should reject alt names by default" do
@@ -705,7 +706,7 @@ describe Puppet::SSL::CertificateAuthority do
705
706
 
706
707
  describe "when applying a method to a set of hosts" do
707
708
  it "should fail if no subjects have been specified" do
708
- lambda { @ca.apply(:generate) }.should raise_error(ArgumentError)
709
+ expect { @ca.apply(:generate) }.to raise_error(ArgumentError)
709
710
  end
710
711
 
711
712
  it "should create an Interface instance with the specified method and the options" do
@@ -769,7 +770,7 @@ describe Puppet::SSL::CertificateAuthority do
769
770
  it "should raise an error if the certificate or CSR cannot be found" do
770
771
  Puppet::SSL::Certificate.indirection.expects(:find).with("myhost").returns nil
771
772
  Puppet::SSL::CertificateRequest.indirection.expects(:find).with("myhost").returns nil
772
- lambda { @ca.fingerprint("myhost") }.should raise_error
773
+ expect { @ca.fingerprint("myhost") }.to raise_error
773
774
  end
774
775
 
775
776
  it "should try to find a CSR if no certificate can be found" do
@@ -809,7 +810,7 @@ describe Puppet::SSL::CertificateAuthority do
809
810
  it "should fail if the host's certificate cannot be found" do
810
811
  Puppet::SSL::Certificate.indirection.expects(:find).with("me").returns(nil)
811
812
 
812
- lambda { @ca.verify("me") }.should raise_error(ArgumentError)
813
+ expect { @ca.verify("me") }.to raise_error(ArgumentError)
813
814
  end
814
815
 
815
816
  it "should create an SSL Store to verify" do
@@ -857,7 +858,7 @@ describe Puppet::SSL::CertificateAuthority do
857
858
 
858
859
  @store.expects(:verify).with("mycert").returns false
859
860
 
860
- lambda { @ca.verify("me") }.should raise_error
861
+ expect { @ca.verify("me") }.to raise_error
861
862
  end
862
863
  end
863
864
 
@@ -877,7 +878,7 @@ describe Puppet::SSL::CertificateAuthority do
877
878
  it "should fail if the certificate revocation list is disabled" do
878
879
  @ca.stubs(:crl).returns false
879
880
 
880
- lambda { @ca.revoke('ca_testing') }.should raise_error(ArgumentError)
881
+ expect { @ca.revoke('ca_testing') }.to raise_error(ArgumentError)
881
882
 
882
883
  end
883
884
 
@@ -923,7 +924,7 @@ describe Puppet::SSL::CertificateAuthority do
923
924
  it "should fail if a certificate already exists for the host" do
924
925
  Puppet::SSL::Certificate.indirection.expects(:find).with("him").returns "something"
925
926
 
926
- lambda { @ca.generate("him") }.should raise_error(ArgumentError)
927
+ expect { @ca.generate("him") }.to raise_error(ArgumentError)
927
928
  end
928
929
 
929
930
  it "should create a new Host instance with the correct name" do