puppet 3.0.1 → 3.0.2.rc1

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 (97) hide show
  1. data/Gemfile +17 -3
  2. data/Rakefile +7 -5
  3. data/ext/build_defaults.yaml +1 -1
  4. data/ext/debian/puppet.init +33 -34
  5. data/ext/debian/puppet.logrotate +2 -1
  6. data/ext/debian/puppetmaster.init +1 -2
  7. data/ext/suse/client.init +1 -1
  8. data/ext/suse/puppet.spec +3 -0
  9. data/ext/suse/server.init +1 -1
  10. data/ext/windows/service/daemon.rb +1 -1
  11. data/install.rb +32 -53
  12. data/lib/hiera/backend/puppet_backend.rb +6 -5
  13. data/lib/puppet/agent.rb +3 -3
  14. data/lib/puppet/application/agent.rb +1 -2
  15. data/lib/puppet/application/cert.rb +4 -5
  16. data/lib/puppet/application/kick.rb +3 -0
  17. data/lib/puppet/defaults.rb +15 -2
  18. data/lib/puppet/indirector/exec.rb +1 -1
  19. data/lib/puppet/module_tool/skeleton/templates/generator/manifests/init.pp.erb +1 -1
  20. data/lib/puppet/parser/functions/hiera_include.rb +6 -4
  21. data/lib/puppet/parser/lexer.rb +38 -1
  22. data/lib/puppet/parser/relationship.rb +3 -1
  23. data/lib/puppet/provider.rb +1 -1
  24. data/lib/puppet/provider/augeas/augeas.rb +1 -1
  25. data/lib/puppet/provider/file/windows.rb +10 -29
  26. data/lib/puppet/provider/group/ldap.rb +1 -1
  27. data/lib/puppet/provider/group/windows_adsi.rb +1 -1
  28. data/lib/puppet/provider/ldap.rb +5 -1
  29. data/lib/puppet/provider/macauthorization/macauthorization.rb +2 -6
  30. data/lib/puppet/provider/package/dpkg.rb +8 -12
  31. data/lib/puppet/provider/package/macports.rb +2 -2
  32. data/lib/puppet/provider/package/msi.rb +2 -2
  33. data/lib/puppet/provider/package/sun.rb +1 -1
  34. data/lib/puppet/provider/package/windows.rb +2 -2
  35. data/lib/puppet/provider/package/yum.rb +5 -1
  36. data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +2 -2
  37. data/lib/puppet/provider/service/freebsd.rb +1 -1
  38. data/lib/puppet/provider/user/directoryservice.rb +603 -65
  39. data/lib/puppet/provider/user/windows_adsi.rb +1 -1
  40. data/lib/puppet/provider/zpool/zpool.rb +1 -1
  41. data/lib/puppet/run.rb +2 -1
  42. data/lib/puppet/settings.rb +9 -5
  43. data/lib/puppet/ssl/certificate_authority.rb +2 -0
  44. data/lib/puppet/transaction.rb +1 -1
  45. data/lib/puppet/type/cron.rb +4 -4
  46. data/lib/puppet/type/exec.rb +10 -5
  47. data/lib/puppet/type/file.rb +1 -1
  48. data/lib/puppet/type/service.rb +3 -2
  49. data/lib/puppet/type/user.rb +24 -2
  50. data/lib/puppet/util.rb +3 -6
  51. data/lib/puppet/util/adsi.rb +3 -9
  52. data/lib/puppet/util/diff.rb +1 -1
  53. data/lib/puppet/util/execution.rb +13 -6
  54. data/lib/puppet/util/feature.rb +3 -1
  55. data/lib/puppet/util/log/destinations.rb +12 -16
  56. data/lib/puppet/util/selinux.rb +18 -2
  57. data/lib/puppet/util/windows.rb +1 -0
  58. data/lib/puppet/util/windows/security.rb +2 -39
  59. data/lib/puppet/util/windows/sid.rb +96 -0
  60. data/lib/puppet/version.rb +1 -1
  61. data/spec/integration/util/windows/security_spec.rb +3 -23
  62. data/spec/unit/agent_spec.rb +7 -3
  63. data/spec/unit/application/agent_spec.rb +13 -5
  64. data/spec/unit/daemon_spec.rb +2 -1
  65. data/spec/unit/hiera/backend/puppet_backend_spec.rb +49 -42
  66. data/spec/unit/indirector/exec_spec.rb +8 -6
  67. data/spec/unit/parser/functions/hiera_include_spec.rb +11 -4
  68. data/spec/unit/parser/lexer_spec.rb +120 -8
  69. data/spec/unit/parser/relationship_spec.rb +24 -0
  70. data/spec/unit/provider/file/windows_spec.rb +29 -29
  71. data/spec/unit/provider/group/windows_adsi_spec.rb +2 -2
  72. data/spec/unit/provider/nameservice/directoryservice_spec.rb +1 -1
  73. data/spec/unit/provider/package/dpkg_spec.rb +2 -2
  74. data/spec/unit/provider/package/macports_spec.rb +6 -5
  75. data/spec/unit/provider/package/msi_spec.rb +1 -1
  76. data/spec/unit/provider/package/pacman_spec.rb +1 -1
  77. data/spec/unit/provider/package/rpm_spec.rb +1 -1
  78. data/spec/unit/provider/package/sun_spec.rb +4 -4
  79. data/spec/unit/provider/package/windows_spec.rb +1 -1
  80. data/spec/unit/provider/scheduled_task/win32_taskscheduler_spec.rb +14 -11
  81. data/spec/unit/provider/user/directoryservice_spec.rb +943 -0
  82. data/spec/unit/provider/user/ldap_spec.rb +22 -8
  83. data/spec/unit/provider/user/windows_adsi_spec.rb +4 -4
  84. data/spec/unit/provider_spec.rb +1 -1
  85. data/spec/unit/run_spec.rb +1 -1
  86. data/spec/unit/settings_spec.rb +16 -0
  87. data/spec/unit/ssl/certificate_authority_spec.rb +24 -0
  88. data/spec/unit/util/adsi_spec.rb +4 -8
  89. data/spec/unit/util/diff_spec.rb +2 -2
  90. data/spec/unit/util/execution_spec.rb +78 -20
  91. data/spec/unit/util/feature_spec.rb +12 -1
  92. data/spec/unit/util/selinux_spec.rb +20 -0
  93. data/spec/unit/util/windows/sid_spec.rb +100 -0
  94. data/spec/unit/util_spec.rb +17 -0
  95. metadata +71 -48
  96. data/Gemfile.lock +0 -44
  97. data/lib/puppet/provider/interface/base.rb +0 -0
@@ -11,6 +11,13 @@ RSpec::Matchers.define :be_like do |*expected|
11
11
  end
12
12
  __ = nil
13
13
 
14
+ def tokens_scanned_from(s)
15
+ lexer = Puppet::Parser::Lexer.new
16
+ lexer.string = s
17
+ lexer.fullscan[0..-2]
18
+ end
19
+
20
+
14
21
  describe Puppet::Parser::Lexer do
15
22
  describe "when reading strings" do
16
23
  before { @lexer = Puppet::Parser::Lexer.new }
@@ -419,7 +426,8 @@ describe Puppet::Parser::Lexer::TOKENS[:RETURN] do
419
426
  end
420
427
  end
421
428
 
422
- shared_examples_for "variable names in the lexer" do |prefix|
429
+
430
+ shared_examples_for "handling `-` in standard variable names" do |prefix|
423
431
  # Watch out - a regex might match a *prefix* on these, not just the whole
424
432
  # word, so make sure you don't have false positive or negative results based
425
433
  # on that.
@@ -436,7 +444,13 @@ shared_examples_for "variable names in the lexer" do |prefix|
436
444
 
437
445
  illegal.each do |name|
438
446
  var = prefix + global_scope + name
439
- it "should NOT accept #{var.inspect} as a valid variable name" do
447
+ it "when `variable_with_dash` is disabled it should NOT accept #{var.inspect} as a valid variable name" do
448
+ Puppet[:allow_variables_with_dashes] = false
449
+ (subject.regex.match(var) || [])[0].should_not == var
450
+ end
451
+
452
+ it "when `variable_with_dash` is enabled it should NOT accept #{var.inspect} as a valid variable name" do
453
+ Puppet[:allow_variables_with_dashes] = true
440
454
  (subject.regex.match(var) || [])[0].should_not == var
441
455
  end
442
456
  end
@@ -447,20 +461,118 @@ describe Puppet::Parser::Lexer::TOKENS[:DOLLAR_VAR] do
447
461
  its(:skip_text) { should be_false }
448
462
  its(:incr_line) { should be_false }
449
463
 
450
- it_should_behave_like "variable names in the lexer", '$'
464
+ it_should_behave_like "handling `-` in standard variable names", '$'
451
465
  end
452
466
 
453
467
  describe Puppet::Parser::Lexer::TOKENS[:VARIABLE] do
454
468
  its(:skip_text) { should be_false }
455
469
  its(:incr_line) { should be_false }
456
470
 
457
- it_should_behave_like "variable names in the lexer", ''
471
+ it_should_behave_like "handling `-` in standard variable names", ''
458
472
  end
459
473
 
460
- def tokens_scanned_from(s)
461
- lexer = Puppet::Parser::Lexer.new
462
- lexer.string = s
463
- lexer.fullscan[0..-2]
474
+ describe "the horrible deprecation / compatibility variables with dashes" do
475
+ NamesWithDashes = %w{f- f-o -f f::-o f::o- f::o-o}
476
+
477
+ { Puppet::Parser::Lexer::TOKENS[:DOLLAR_VAR_WITH_DASH] => '$',
478
+ Puppet::Parser::Lexer::TOKENS[:VARIABLE_WITH_DASH] => ''
479
+ }.each do |token, prefix|
480
+ describe token do
481
+ its(:skip_text) { should be_false }
482
+ its(:incr_line) { should be_false }
483
+
484
+ context "when compatibly is disabled" do
485
+ before :each do Puppet[:allow_variables_with_dashes] = false end
486
+ Puppet::Parser::Lexer::TOKENS.each do |name, value|
487
+ it "should be unacceptable after #{name}" do
488
+ token.acceptable?(:after => name).should be_false
489
+ end
490
+ end
491
+
492
+ # Yes, this should still *match*, just not be acceptable.
493
+ NamesWithDashes.each do |name|
494
+ ["", "::"].each do |global_scope|
495
+ var = prefix + global_scope + name
496
+ it "should match #{var.inspect}" do
497
+ subject.regex.match(var).to_a.should == [var]
498
+ end
499
+ end
500
+ end
501
+ end
502
+
503
+ context "when compatibility is enabled" do
504
+ before :each do Puppet[:allow_variables_with_dashes] = true end
505
+ it "should be acceptable after DQPRE" do
506
+ token.acceptable?(:after => :DQPRE).should be_true
507
+ end
508
+
509
+ NamesWithDashes.each do |name|
510
+ ["", "::"].each do |global_scope|
511
+ var = prefix + global_scope + name
512
+ it "should match #{var.inspect}" do
513
+ subject.regex.match(var).to_a.should == [var]
514
+ end
515
+ end
516
+ end
517
+ end
518
+ end
519
+ end
520
+
521
+ context "deprecation warnings" do
522
+ before :each do Puppet[:allow_variables_with_dashes] = true end
523
+
524
+ it "should match a top level variable" do
525
+ Puppet.expects(:deprecation_warning).once
526
+
527
+ tokens_scanned_from('$foo-bar').should == [
528
+ [:VARIABLE, { :value => 'foo-bar', :line => 1 }]
529
+ ]
530
+ end
531
+
532
+ it "does not warn about a variable without a dash" do
533
+ Puppet.expects(:deprecation_warning).never
534
+
535
+ tokens_scanned_from('$c').should == [
536
+ [:VARIABLE, { :value => "c", :line => 1 }]
537
+ ]
538
+ end
539
+
540
+ it "does not warn about referencing a class name that contains a dash" do
541
+ Puppet.expects(:deprecation_warning).never
542
+
543
+ tokens_scanned_from('foo-bar').should == [
544
+ [:NAME, { :value => "foo-bar", :line => 1 }]
545
+ ]
546
+ end
547
+
548
+ it "warns about reference to variable" do
549
+ Puppet.expects(:deprecation_warning).once
550
+
551
+ tokens_scanned_from('$::foo-bar::baz-quux').should == [
552
+ [:VARIABLE, { :value => "::foo-bar::baz-quux", :line => 1 }]
553
+ ]
554
+ end
555
+
556
+ it "warns about reference to variable interpolated in a string" do
557
+ Puppet.expects(:deprecation_warning).once
558
+
559
+ tokens_scanned_from('"$::foo-bar::baz-quux"').should == [
560
+ [:DQPRE, { :value => "", :line => 1 }],
561
+ [:VARIABLE, { :value => "::foo-bar::baz-quux", :line => 1 }],
562
+ [:DQPOST, { :value => "", :line => 1 }],
563
+ ]
564
+ end
565
+
566
+ it "warns about reference to variable interpolated in a string as an expression" do
567
+ Puppet.expects(:deprecation_warning).once
568
+
569
+ tokens_scanned_from('"${::foo-bar::baz-quux}"').should == [
570
+ [:DQPRE, { :value => "", :line => 1 }],
571
+ [:VARIABLE, { :value => "::foo-bar::baz-quux", :line => 1 }],
572
+ [:DQPOST, { :value => "", :line => 1 }],
573
+ ]
574
+ end
575
+ end
464
576
  end
465
577
 
466
578
  describe Puppet::Parser::Lexer,"when lexing strings" do
@@ -7,6 +7,8 @@ describe Puppet::Parser::Relationship do
7
7
  before do
8
8
  @source = Puppet::Resource.new(:mytype, "source")
9
9
  @target = Puppet::Resource.new(:mytype, "target")
10
+ @extra_resource = Puppet::Resource.new(:mytype, "extra")
11
+ @extra_resource2 = Puppet::Resource.new(:mytype, "extra2")
10
12
  @dep = Puppet::Parser::Relationship.new(@source, @target, :relationship)
11
13
  end
12
14
 
@@ -15,6 +17,8 @@ describe Puppet::Parser::Relationship do
15
17
  @catalog = Puppet::Resource::Catalog.new
16
18
  @catalog.add_resource(@source)
17
19
  @catalog.add_resource(@target)
20
+ @catalog.add_resource(@extra_resource)
21
+ @catalog.add_resource(@extra_resource2)
18
22
  end
19
23
 
20
24
  it "should fail if the source resource cannot be found" do
@@ -44,10 +48,30 @@ describe Puppet::Parser::Relationship do
44
48
  it "should supplement rather than clobber existing relationship values" do
45
49
  @source[:before] = "File[/bar]"
46
50
  @dep.evaluate(@catalog)
51
+ # this test did not work before. It was appending the resources
52
+ # together as a string
53
+ (@source[:before].class == Array).should be_true
47
54
  @source[:before].should be_include("Mytype[target]")
48
55
  @source[:before].should be_include("File[/bar]")
49
56
  end
50
57
 
58
+ it "should supplement rather than clobber existing resource relationships" do
59
+ @source[:before] = @extra_resource
60
+ @dep.evaluate(@catalog)
61
+ (@source[:before].class == Array).should be_true
62
+ @source[:before].should be_include("Mytype[target]")
63
+ @source[:before].should be_include(@extra_resource)
64
+ end
65
+
66
+ it "should supplement rather than clobber multiple existing resource relationships" do
67
+ @source[:before] = [@extra_resource, @extra_resource2]
68
+ @dep.evaluate(@catalog)
69
+ (@source[:before].class == Array).should be_true
70
+ @source[:before].should be_include("Mytype[target]")
71
+ @source[:before].should be_include(@extra_resource)
72
+ @source[:before].should be_include(@extra_resource2)
73
+ end
74
+
51
75
  it "should use the collected retargets if the target is a Collector" do
52
76
  orig_target = @target
53
77
  @target = Puppet::Parser::Collector.new(stub("scope"), :file, "equery", "vquery", :virtual)
@@ -14,6 +14,8 @@ describe Puppet::Type.type(:file).provider(:windows), :if => Puppet.features.mic
14
14
  let(:path) { tmpfile('windows_file_spec') }
15
15
  let(:resource) { Puppet::Type.type(:file).new :path => path, :mode => 0777, :provider => described_class.name }
16
16
  let(:provider) { resource.provider }
17
+ let(:sid) { 'S-1-1-50' }
18
+ let(:account) { 'quinn' }
17
19
 
18
20
  describe "#mode" do
19
21
  it "should return a string with the higher-order bits stripped away" do
@@ -47,47 +49,41 @@ describe Puppet::Type.type(:file).provider(:windows), :if => Puppet.features.mic
47
49
 
48
50
  describe "#id2name" do
49
51
  it "should return the name of the user identified by the sid" do
50
- result = [stub('user', :name => 'quinn')]
51
- Puppet::Util::ADSI.stubs(:execquery).returns(result)
52
+ Puppet::Util::Windows::Security.expects(:valid_sid?).with(sid).returns(true)
53
+ Puppet::Util::Windows::Security.expects(:sid_to_name).with(sid).returns(account)
52
54
 
53
- provider.id2name('S-1-1-50').should == 'quinn'
55
+ provider.id2name(sid).should == account
54
56
  end
55
57
 
56
58
  it "should return the argument if it's already a name" do
57
- provider.id2name('flannigan').should == 'flannigan'
59
+ Puppet::Util::Windows::Security.expects(:valid_sid?).with(account).returns(false)
60
+ Puppet::Util::Windows::Security.expects(:sid_to_name).never
61
+
62
+ provider.id2name(account).should == account
58
63
  end
59
64
 
60
65
  it "should return nil if the user doesn't exist" do
61
- Puppet::Util::ADSI.stubs(:execquery).returns []
66
+ Puppet::Util::Windows::Security.expects(:valid_sid?).with(sid).returns(true)
67
+ Puppet::Util::Windows::Security.expects(:sid_to_name).with(sid).returns(nil)
62
68
 
63
- provider.id2name('S-1-1-50').should == nil
69
+ provider.id2name(sid).should == nil
64
70
  end
65
71
  end
66
72
 
67
73
  describe "#name2id" do
68
- it "should return the sid of the user" do
69
- Puppet::Util::ADSI.stubs(:execquery).returns [stub('account', :Sid => 'S-1-1-50')]
70
-
71
- provider.name2id('anybody').should == 'S-1-1-50'
72
- end
73
-
74
- it "should return the argument if it's already a sid" do
75
- provider.name2id('S-1-1-50').should == 'S-1-1-50'
76
- end
77
-
78
- it "should return nil if the user doesn't exist" do
79
- Puppet::Util::ADSI.stubs(:execquery).returns []
74
+ it "should delegate to name_to_sid" do
75
+ Puppet::Util::Windows::Security.expects(:name_to_sid).with(account).returns(sid)
80
76
 
81
- provider.name2id('someone').should == nil
77
+ provider.name2id(account).should == sid
82
78
  end
83
79
  end
84
80
 
85
81
  describe "#owner" do
86
82
  it "should return the sid of the owner if the file does exist" do
87
83
  FileUtils.touch(resource[:path])
88
- provider.stubs(:get_owner).with(resource[:path]).returns('S-1-1-50')
84
+ provider.stubs(:get_owner).with(resource[:path]).returns(sid)
89
85
 
90
- provider.owner.should == 'S-1-1-50'
86
+ provider.owner.should == sid
91
87
  end
92
88
 
93
89
  it "should return absent if the file doesn't exist" do
@@ -97,23 +93,25 @@ describe Puppet::Type.type(:file).provider(:windows), :if => Puppet.features.mic
97
93
 
98
94
  describe "#owner=" do
99
95
  it "should set the owner to the specified value" do
100
- provider.expects(:set_owner).with('S-1-1-50', resource[:path])
101
- provider.owner = 'S-1-1-50'
96
+ provider.expects(:set_owner).with(sid, resource[:path])
97
+ provider.owner = sid
102
98
  end
103
99
 
104
100
  it "should propagate any errors encountered when setting the owner" do
105
101
  provider.stubs(:set_owner).raises(ArgumentError)
106
102
 
107
- expect { provider.owner = 'S-1-1-50' }.to raise_error(Puppet::Error, /Failed to set owner/)
103
+ expect {
104
+ provider.owner = sid
105
+ }.to raise_error(Puppet::Error, /Failed to set owner/)
108
106
  end
109
107
  end
110
108
 
111
109
  describe "#group" do
112
110
  it "should return the sid of the group if the file does exist" do
113
111
  FileUtils.touch(resource[:path])
114
- provider.stubs(:get_group).with(resource[:path]).returns('S-1-1-50')
112
+ provider.stubs(:get_group).with(resource[:path]).returns(sid)
115
113
 
116
- provider.group.should == 'S-1-1-50'
114
+ provider.group.should == sid
117
115
  end
118
116
 
119
117
  it "should return absent if the file doesn't exist" do
@@ -123,14 +121,16 @@ describe Puppet::Type.type(:file).provider(:windows), :if => Puppet.features.mic
123
121
 
124
122
  describe "#group=" do
125
123
  it "should set the group to the specified value" do
126
- provider.expects(:set_group).with('S-1-1-50', resource[:path])
127
- provider.group = 'S-1-1-50'
124
+ provider.expects(:set_group).with(sid, resource[:path])
125
+ provider.group = sid
128
126
  end
129
127
 
130
128
  it "should propagate any errors encountered when setting the group" do
131
129
  provider.stubs(:set_group).raises(ArgumentError)
132
130
 
133
- expect { provider.group = 'S-1-1-50' }.to raise_error(Puppet::Error, /Failed to set group/)
131
+ expect {
132
+ provider.group = sid
133
+ }.to raise_error(Puppet::Error, /Failed to set group/)
134
134
  end
135
135
  end
136
136
 
@@ -88,8 +88,8 @@ describe Puppet::Type.type(:group).provider(:windows_adsi) do
88
88
  provider.delete
89
89
  end
90
90
 
91
- it "should report the group's SID as gid" do
92
- Puppet::Util::ADSI.expects(:sid_for_account).with('testers').returns('S-1-5-32-547')
91
+ it "should report the group's SID as gid", :if => Puppet.features.microsoft_windows? do
92
+ Puppet::Util::Windows::Security.expects(:name_to_sid).with('testers').returns('S-1-5-32-547')
93
93
  provider.gid.should == 'S-1-5-32-547'
94
94
  end
95
95
 
@@ -2,7 +2,7 @@
2
2
  require 'spec_helper'
3
3
 
4
4
  # We use this as a reasonable way to obtain all the support infrastructure.
5
- [:user, :group].each do |type_for_this_round|
5
+ [:group].each do |type_for_this_round|
6
6
  provider_class = Puppet::Type.type(type_for_this_round).provider(:directoryservice)
7
7
 
8
8
  describe provider_class do
@@ -178,13 +178,13 @@ describe provider do
178
178
 
179
179
  it "should execute dpkg --set-selections when holding" do
180
180
  @provider.stubs(:install)
181
- @provider.expects(:execute).with([:dpkg, '--set-selections'], {:stdinfile => @tempfile.path}).once
181
+ @provider.expects(:execute).with([:dpkg, '--set-selections'], {:failonfail => false, :combine => false, :stdinfile => @tempfile.path}).once
182
182
  @provider.hold
183
183
  end
184
184
 
185
185
  it "should execute dpkg --set-selections when unholding" do
186
186
  @provider.stubs(:install)
187
- @provider.expects(:execute).with([:dpkg, '--set-selections'], {:stdinfile => @tempfile.path}).once
187
+ @provider.expects(:execute).with([:dpkg, '--set-selections'], {:failonfail => false, :combine => false, :stdinfile => @tempfile.path}).once
188
188
  @provider.hold
189
189
  end
190
190
  end
@@ -86,6 +86,7 @@ describe provider_class do
86
86
  let :infoargs do
87
87
  ["/opt/local/bin/port", "-q", :info, "--line", "--version", "--revision", resource_name]
88
88
  end
89
+ let(:arguments) do {:failonfail => false, :combine => false} end
89
90
 
90
91
  before :each do
91
92
  provider.stubs(:command).with(:port).returns("/opt/local/bin/port")
@@ -93,28 +94,28 @@ describe provider_class do
93
94
 
94
95
  it "should return nil when the package cannot be found" do
95
96
  resource[:name] = resource_name
96
- provider.expects(:execute).with(infoargs, {:combine=>false}).returns("")
97
+ provider.expects(:execute).with(infoargs, arguments).returns("")
97
98
  provider.latest.should == nil
98
99
  end
99
100
 
100
101
  it "should return the current version if the installed port has the same revision" do
101
102
  current_hash[:revision] = "2"
102
- provider.expects(:execute).with(infoargs, {:combine=>false}).returns(new_info_line)
103
+ provider.expects(:execute).with(infoargs, arguments).returns(new_info_line)
103
104
  provider.expects(:query).returns(current_hash)
104
105
  provider.latest.should == current_hash[:ensure]
105
106
  end
106
107
 
107
108
  it "should return the new version_revision if the installed port has a lower revision" do
108
109
  current_hash[:revision] = "1"
109
- provider.expects(:execute).with(infoargs, {:combine=>false}).returns(new_info_line)
110
+ provider.expects(:execute).with(infoargs, arguments).returns(new_info_line)
110
111
  provider.expects(:query).returns(current_hash)
111
112
  provider.latest.should == "1.2.3_2"
112
113
  end
113
114
 
114
115
  it "should return the newest version if the port is not installed" do
115
116
  resource[:name] = resource_name
116
- provider.expects(:execute).with(infoargs, {:combine=>false}).returns(new_info_line)
117
- provider.expects(:execute).with(["/opt/local/bin/port", "-q", :installed, resource[:name]], {:combine=>false}).returns("")
117
+ provider.expects(:execute).with(infoargs, arguments).returns(new_info_line)
118
+ provider.expects(:execute).with(["/opt/local/bin/port", "-q", :installed, resource[:name]], arguments).returns("")
118
119
  provider.latest.should == "1.2.3_2"
119
120
  end
120
121
  end
@@ -8,7 +8,7 @@ describe Puppet::Type.type(:package).provider(:msi) do
8
8
  let (:packagecode) { '{5A6FD560-763A-4BC1-9E03-B18DFFB7C72C}' }
9
9
  let (:resource) { Puppet::Type.type(:package).new(:name => name, :provider => :msi, :source => source) }
10
10
  let (:provider) { resource.provider }
11
- let (:execute_options) do {:combine => true} end
11
+ let (:execute_options) do {:failonfail => false, :combine => true} end
12
12
 
13
13
  def installer(productcodes)
14
14
  installer = mock
@@ -5,7 +5,7 @@ require 'stringio'
5
5
  provider = Puppet::Type.type(:package).provider(:pacman)
6
6
 
7
7
  describe provider do
8
- let(:no_extra_options) { { :custom_environment => {} } }
8
+ let(:no_extra_options) { { :failonfail => true, :combine => true, :custom_environment => {} } }
9
9
  let(:executor) { Puppet::Util::Execution }
10
10
  let(:resolver) { Puppet::Util }
11
11
 
@@ -16,7 +16,7 @@ describe provider_class do
16
16
 
17
17
  describe "self.instances" do
18
18
  it "returns an array of packages" do
19
- Puppet::Util::Execution.expects(:execute).with(["/bin/rpm", "--version"], {:custom_environment => {}}).returns("RPM version 5.x")
19
+ Puppet::Util::Execution.expects(:execute).with(["/bin/rpm", "--version"], {:failonfail => true, :combine => true, :custom_environment => {}}).returns("RPM version 5.x")
20
20
  Puppet::Util.stubs(:which).with("rpm").returns("/bin/rpm")
21
21
  subject.stubs(:which).with("rpm").returns("/bin/rpm")
22
22
  Puppet::Util::Execution.expects(:execpipe).with("/bin/rpm -qa --nosignature --nodigest --qf '%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}\n'").yields(packages)
@@ -35,7 +35,7 @@ describe Puppet::Type.type(:package).provider(:sun) do
35
35
  end
36
36
 
37
37
  it "should install a package if it is not present on update" do
38
- Puppet::Util::Execution.expects(:execute).with(['/usr/bin/pkginfo', '-l', 'dummy'], {:failonfail => false}).returns File.read(my_fixture('dummy.server'))
38
+ Puppet::Util::Execution.expects(:execute).with(['/usr/bin/pkginfo', '-l', 'dummy'], {:failonfail => false, :combine => false}).returns File.read(my_fixture('dummy.server'))
39
39
  provider.expects(:pkgrm).with(['-n', 'dummy'])
40
40
  provider.expects(:install)
41
41
  provider.update
@@ -74,7 +74,7 @@ describe Puppet::Type.type(:package).provider(:sun) do
74
74
 
75
75
  context '#query' do
76
76
  it "should find the package on query" do
77
- Puppet::Util::Execution.expects(:execute).with(['/usr/bin/pkginfo', '-l', 'dummy'], {:failonfail => false}).returns File.read(my_fixture('dummy.server'))
77
+ Puppet::Util::Execution.expects(:execute).with(['/usr/bin/pkginfo', '-l', 'dummy'], {:failonfail => false, :combine => false}).returns File.read(my_fixture('dummy.server'))
78
78
  provider.query.should == {
79
79
  :name => 'SUNWdummy',
80
80
  :category=>"system",
@@ -87,12 +87,12 @@ describe Puppet::Type.type(:package).provider(:sun) do
87
87
  end
88
88
 
89
89
  it "shouldn't find the package on query if it is not present" do
90
- Puppet::Util::Execution.expects(:execute).with(['/usr/bin/pkginfo', '-l', 'dummy'], {:failonfail => false}).returns 'ERROR: information for "dummy" not found.'
90
+ Puppet::Util::Execution.expects(:execute).with(['/usr/bin/pkginfo', '-l', 'dummy'], {:failonfail => false, :combine => false}).returns 'ERROR: information for "dummy" not found.'
91
91
  provider.query.should == {:ensure => :absent}
92
92
  end
93
93
 
94
94
  it "unknown message should raise error." do
95
- Puppet::Util::Execution.expects(:execute).with(['/usr/bin/pkginfo', '-l', 'dummy'], {:failonfail => false}).returns 'RANDOM'
95
+ Puppet::Util::Execution.expects(:execute).with(['/usr/bin/pkginfo', '-l', 'dummy'], {:failonfail => false, :combine => false}).returns 'RANDOM'
96
96
  lambda { provider.query }.should raise_error(Puppet::Error)
97
97
  end
98
98
  end