puppet 5.5.2-x64-mingw32 → 5.5.3-x64-mingw32

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 (83) hide show
  1. checksums.yaml +4 -4
  2. data/lib/puppet/application/device.rb +43 -30
  3. data/lib/puppet/defaults.rb +7 -4
  4. data/lib/puppet/environments.rb +2 -3
  5. data/lib/puppet/face/config.rb +1 -1
  6. data/lib/puppet/face/module/build.rb +5 -0
  7. data/lib/puppet/gettext/config.rb +28 -5
  8. data/lib/puppet/indirector/catalog/compiler.rb +5 -7
  9. data/lib/puppet/node/environment.rb +5 -1
  10. data/lib/puppet/provider/selmodule/semodule.rb +1 -1
  11. data/lib/puppet/provider/service/upstart.rb +2 -0
  12. data/lib/puppet/reference/configuration.rb +6 -0
  13. data/lib/puppet/resource/status.rb +2 -0
  14. data/lib/puppet/resource/type_collection.rb +1 -1
  15. data/lib/puppet/settings.rb +6 -0
  16. data/lib/puppet/ssl/certificate_request.rb +11 -3
  17. data/lib/puppet/transaction/event_manager.rb +3 -1
  18. data/lib/puppet/transaction/report.rb +1 -1
  19. data/lib/puppet/util.rb +2 -0
  20. data/lib/puppet/util/command_line.rb +0 -1
  21. data/lib/puppet/util/log/destinations.rb +1 -1
  22. data/lib/puppet/util/windows/file.rb +18 -0
  23. data/lib/puppet/util/windows/security.rb +26 -14
  24. data/lib/puppet/version.rb +1 -1
  25. data/locales/puppet.pot +96 -79
  26. data/man/man5/puppet.conf.5 +8 -5
  27. data/man/man8/puppet-agent.8 +1 -1
  28. data/man/man8/puppet-apply.8 +1 -1
  29. data/man/man8/puppet-ca.8 +2 -2
  30. data/man/man8/puppet-catalog.8 +1 -1
  31. data/man/man8/puppet-cert.8 +1 -1
  32. data/man/man8/puppet-certificate.8 +2 -2
  33. data/man/man8/puppet-certificate_request.8 +1 -1
  34. data/man/man8/puppet-certificate_revocation_list.8 +1 -1
  35. data/man/man8/puppet-config.8 +2 -2
  36. data/man/man8/puppet-describe.8 +1 -1
  37. data/man/man8/puppet-device.8 +6 -2
  38. data/man/man8/puppet-doc.8 +1 -1
  39. data/man/man8/puppet-epp.8 +1 -1
  40. data/man/man8/puppet-facts.8 +1 -1
  41. data/man/man8/puppet-filebucket.8 +1 -1
  42. data/man/man8/puppet-generate.8 +1 -1
  43. data/man/man8/puppet-help.8 +1 -1
  44. data/man/man8/puppet-key.8 +1 -1
  45. data/man/man8/puppet-lookup.8 +1 -1
  46. data/man/man8/puppet-man.8 +1 -1
  47. data/man/man8/puppet-master.8 +1 -1
  48. data/man/man8/puppet-module.8 +1 -1
  49. data/man/man8/puppet-node.8 +1 -1
  50. data/man/man8/puppet-parser.8 +1 -1
  51. data/man/man8/puppet-plugin.8 +1 -1
  52. data/man/man8/puppet-report.8 +1 -1
  53. data/man/man8/puppet-resource.8 +1 -1
  54. data/man/man8/puppet-script.8 +1 -1
  55. data/man/man8/puppet-status.8 +1 -1
  56. data/man/man8/puppet.8 +2 -2
  57. data/spec/integration/type/file_spec.rb +3 -1
  58. data/spec/integration/util/windows/security_spec.rb +14 -1
  59. data/spec/shared_examples/rhel_package_provider.rb +2 -2
  60. data/spec/unit/application/device_spec.rb +55 -11
  61. data/spec/unit/application/master_spec.rb +5 -4
  62. data/spec/unit/gettext/config_spec.rb +29 -10
  63. data/spec/unit/node/environment_spec.rb +4 -3
  64. data/spec/unit/provider/package/aptitude_spec.rb +1 -1
  65. data/spec/unit/provider/package/aptrpm_spec.rb +1 -1
  66. data/spec/unit/provider/package/dpkg_spec.rb +1 -1
  67. data/spec/unit/provider/package/nim_spec.rb +2 -11
  68. data/spec/unit/provider/package/opkg_spec.rb +2 -2
  69. data/spec/unit/provider/package/pkg_spec.rb +52 -17
  70. data/spec/unit/provider/package/rpm_spec.rb +30 -10
  71. data/spec/unit/provider/package/urpmi_spec.rb +9 -3
  72. data/spec/unit/provider/selmodule_spec.rb +6 -0
  73. data/spec/unit/provider/service/openrc_spec.rb +1 -1
  74. data/spec/unit/resource/status_spec.rb +2 -0
  75. data/spec/unit/resource/type_collection_spec.rb +4 -1
  76. data/spec/unit/ssl/certificate_request_spec.rb +11 -0
  77. data/spec/unit/transaction/event_manager_spec.rb +12 -0
  78. data/spec/unit/util/diff_spec.rb +11 -3
  79. data/spec/unit/util/execution_spec.rb +2 -1
  80. data/spec/unit/util/filetype_spec.rb +6 -2
  81. data/spec/unit/util/log/destinations_spec.rb +28 -12
  82. data/spec/unit/util/plist_spec.rb +12 -6
  83. metadata +2 -2
@@ -68,7 +68,7 @@ shared_examples "RHEL package provider" do |provider_class, provider_name|
68
68
  before(:each) do
69
69
  Puppet::Util.stubs(:which).with("rpm").returns("/bin/rpm")
70
70
  provider.stubs(:which).with("rpm").returns("/bin/rpm")
71
- Puppet::Util::Execution.expects(:execute).with(["/bin/rpm", "--version"], {:combine => true, :custom_environment => {}, :failonfail => true}).returns("4.10.1\n").at_most_once
71
+ Puppet::Util::Execution.expects(:execute).with(["/bin/rpm", "--version"], {:combine => true, :custom_environment => {}, :failonfail => true}).returns(Puppet::Util::Execution::ProcessOutput.new("4.10.1\n", 0)).at_most_once
72
72
  Facter.stubs(:value).with(:operatingsystemmajrelease).returns('6')
73
73
  end
74
74
  it "should call #{provider_name} install for :installed" do
@@ -84,7 +84,7 @@ shared_examples "RHEL package provider" do |provider_class, provider_name|
84
84
  end
85
85
  it "should catch #{provider_name} install failures when status code is wrong" do
86
86
  resource.stubs(:should).with(:ensure).returns :installed
87
- Puppet::Util::Execution.expects(:execute).with(["/usr/bin/#{provider_name}", '-e', error_level, '-y', :install, name]).returns("No package #{name} available.")
87
+ Puppet::Util::Execution.expects(:execute).with(["/usr/bin/#{provider_name}", '-e', error_level, '-y', :install, name]).returns(Puppet::Util::Execution::ProcessOutput.new("No package #{name} available.", 0))
88
88
  expect {
89
89
  provider.install
90
90
  }.to raise_error(Puppet::Error, "Could not find package #{name}")
@@ -140,6 +140,11 @@ describe Puppet::Application::Device do
140
140
  @device.handle_resource(true)
141
141
  end
142
142
 
143
+ it "should store the facts options with --facts" do
144
+ @device.options.expects(:[]=).with(:facts,true)
145
+
146
+ @device.handle_facts(true)
147
+ end
143
148
  end
144
149
 
145
150
  describe "during setup" do
@@ -291,6 +296,7 @@ describe Puppet::Application::Device do
291
296
  @device.options.stubs(:[]).with(:detailed_exitcodes).returns(false)
292
297
  @device.options.stubs(:[]).with(:target).returns(nil)
293
298
  @device.options.stubs(:[]).with(:apply).returns(nil)
299
+ @device.options.stubs(:[]).with(:facts).returns(false)
294
300
  @device.options.stubs(:[]).with(:resource).returns(false)
295
301
  @device.options.stubs(:[]).with(:to_yaml).returns(false)
296
302
  @device.options.stubs(:[]).with(:client)
@@ -305,8 +311,12 @@ describe Puppet::Application::Device do
305
311
 
306
312
  it "should exit if resource is requested without target" do
307
313
  @device.options.stubs(:[]).with(:resource).returns(true)
308
- Puppet.expects(:err).with "resource command requires target"
309
- expect { @device.main }.to exit_with 1
314
+ expect { @device.main }.to raise_error(RuntimeError, "resource command requires target")
315
+ end
316
+
317
+ it "should exit if facts is requested without target" do
318
+ @device.options.stubs(:[]).with(:facts).returns(true)
319
+ expect { @device.main }.to raise_error(RuntimeError, "facts command requires target")
310
320
  end
311
321
 
312
322
  it "should get the device list" do
@@ -337,8 +347,7 @@ describe Puppet::Application::Device do
337
347
 
338
348
  Puppet::Util::NetworkDevice::Config.expects(:devices).returns(device_hash)
339
349
  Puppet.expects(:info).with(regexp_matches(/starting applying configuration to/)).never
340
- Puppet.expects(:err).with(regexp_matches(/Target device \/ certificate 'bla' not found in .*\.conf/))
341
- expect { @device.main }.to exit_with 1
350
+ expect { @device.main }.to raise_error(RuntimeError, /Target device \/ certificate 'bla' not found in .*\.conf/)
342
351
  end
343
352
 
344
353
  it "should error if target is passed and the apply path is incorrect" do
@@ -346,11 +355,33 @@ describe Puppet::Application::Device do
346
355
  @device.options.stubs(:[]).with(:target).returns('device1')
347
356
 
348
357
  File.expects(:file?).returns(false)
349
- Puppet.expects(:err).with(regexp_matches(/does not exist, cannot apply/))
358
+ expect { @device.main }.to raise_error(RuntimeError, /does not exist, cannot apply/)
359
+ end
360
+
361
+ it "should run an apply, and not create the state folder" do
362
+ @device.options.stubs(:[]).with(:apply).returns('file.pp')
363
+ @device.options.stubs(:[]).with(:target).returns('device1')
364
+ device_hash = {
365
+ "device1" => OpenStruct.new(:name => "device1", :url => "ssh://user:pass@testhost", :provider => "cisco"),
366
+ }
367
+ Puppet::Util::NetworkDevice::Config.expects(:devices).returns(device_hash)
368
+ Puppet::Util::NetworkDevice.stubs(:init)
369
+ File.expects(:file?).returns(true)
370
+
371
+ ::File.stubs(:directory?).returns false
372
+ state_path = tmpfile('state')
373
+ Puppet[:statedir] = state_path
374
+ File.expects(:directory?).with(state_path).returns true
375
+ FileUtils.expects(:mkdir_p).with(state_path).never
376
+
377
+ Puppet::Util::CommandLine.expects(:new).once
378
+ Puppet::Application::Apply.expects(:new).once
379
+
380
+ Puppet::Configurer.expects(:new).never
350
381
  expect { @device.main }.to exit_with 1
351
382
  end
352
383
 
353
- it "should run an apply" do
384
+ it "should run an apply, and create the state folder" do
354
385
  @device.options.stubs(:[]).with(:apply).returns('file.pp')
355
386
  @device.options.stubs(:[]).with(:target).returns('device1')
356
387
  device_hash = {
@@ -359,6 +390,7 @@ describe Puppet::Application::Device do
359
390
  Puppet::Util::NetworkDevice::Config.expects(:devices).returns(device_hash)
360
391
  Puppet::Util::NetworkDevice.stubs(:init)
361
392
  File.expects(:file?).returns(true)
393
+ FileUtils.expects(:mkdir_p).once
362
394
 
363
395
  Puppet::Util::CommandLine.expects(:new).once
364
396
  Puppet::Application::Apply.expects(:new).once
@@ -426,15 +458,17 @@ describe Puppet::Application::Device do
426
458
  @device.options.stubs(:[]).with(:target).returns('device1')
427
459
  @device.command_line.stubs(:args).returns(['user'])
428
460
  Puppet::Resource.indirection.expects(:search).with('user/', {}).returns([])
429
- expect { @device.main }.to exit_with 1
461
+ expect { @device.main }.to exit_with 0
430
462
  end
431
463
 
432
464
  it "should retrieve named resources of a type" do
465
+ resource = Puppet::Type.type(:user).new(:name => "jim").to_resource
433
466
  @device.options.stubs(:[]).with(:resource).returns(true)
434
467
  @device.options.stubs(:[]).with(:target).returns('device1')
435
- @device.command_line.stubs(:args).returns(['user', 'title'])
436
- Puppet::Resource.indirection.expects(:find).with('user/title')
437
- expect { @device.main }.to exit_with 1
468
+ @device.command_line.stubs(:args).returns(['user', 'jim'])
469
+ Puppet::Resource.indirection.expects(:find).with('user/jim').returns(resource)
470
+ @device.expects(:puts).with("user { 'jim':\n}")
471
+ expect { @device.main }.to exit_with 0
438
472
  end
439
473
 
440
474
  it "should output resources as YAML" do
@@ -447,7 +481,17 @@ describe Puppet::Application::Device do
447
481
  @device.command_line.stubs(:args).returns(['user'])
448
482
  Puppet::Resource.indirection.expects(:search).with('user/', {}).returns(resources)
449
483
  @device.expects(:puts).with("user:\n title:\n")
450
- expect { @device.main }.to exit_with 1
484
+ expect { @device.main }.to exit_with 0
485
+ end
486
+
487
+ it "should retrieve facts" do
488
+ indirection_fact_values = {"operatingsystem"=>"cisco_ios","clientcert"=>"3750"}
489
+ indirection_facts = Puppet::Node::Facts.new("nil", indirection_fact_values)
490
+ @device.options.stubs(:[]).with(:facts).returns(true)
491
+ @device.options.stubs(:[]).with(:target).returns('device1')
492
+ Puppet::Node::Facts.indirection.expects(:find).with(nil, anything()).returns(indirection_facts)
493
+ @device.expects(:puts).with(regexp_matches(/name.*3750.*\n.*values.*\n.*operatingsystem.*cisco_ios/))
494
+ expect { @device.main }.to exit_with 0
451
495
  end
452
496
 
453
497
  it "should make sure all the required folders and files are created" do
@@ -124,20 +124,21 @@ describe Puppet::Application::Master, :unless => Puppet.features.microsoft_windo
124
124
  @master.options.stubs(:[]).with(:setdest).returns false
125
125
  end
126
126
 
127
- it "logs to the console when --compile is given" do
127
+ it "should log to the console when --compile is given" do
128
128
  @master.options.stubs(:[]).with(:node).returns "default"
129
129
  Puppet::Util::Log.expects(:newdestination).with(:console)
130
130
  @master.setup
131
131
  end
132
132
 
133
- it "logs to the console when the master is not daemonized or run with rack" do
133
+ it "should log to the console when the master is not daemonized or run with rack" do
134
134
  Puppet::Util::Log.expects(:newdestination).with(:console)
135
135
  Puppet[:daemonize] = false
136
136
  @master.options.stubs(:[]).with(:rack).returns(false)
137
137
  @master.setup
138
138
  end
139
139
 
140
- it "logs to syslog when the master is daemonized" do
140
+ it "should log to syslog when the master is daemonized" do
141
+
141
142
  Puppet::Util::Log.expects(:newdestination).with(:console).never
142
143
  Puppet::Util::Log.expects(:newdestination).with(:syslog)
143
144
  Puppet[:daemonize] = true
@@ -145,7 +146,7 @@ describe Puppet::Application::Master, :unless => Puppet.features.microsoft_windo
145
146
  @master.setup
146
147
  end
147
148
 
148
- it "logs to syslog when the master is run with rack" do
149
+ it "should log to syslog when the master is run with rack" do
149
150
  Puppet::Util::Log.expects(:newdestination).with(:console).never
150
151
  Puppet::Util::Log.expects(:newdestination).with(:syslog)
151
152
  Puppet[:daemonize] = false
@@ -95,29 +95,48 @@ describe Puppet::GettextConfig do
95
95
  end
96
96
 
97
97
  it 'should copy default translations when creating a non-default text domain' do
98
+ Puppet::GettextConfig.reset_text_domain(:test)
99
+ expect(Puppet::GettextConfig.loaded_text_domains).to include(Puppet::GettextConfig::DEFAULT_TEXT_DOMAIN, :test)
100
+ end
101
+
102
+ it 'should normalize domain name when creating a non-default text domain' do
98
103
  Puppet::GettextConfig.reset_text_domain('test')
99
- expect(Puppet::GettextConfig.loaded_text_domains).to include(Puppet::GettextConfig::DEFAULT_TEXT_DOMAIN, 'test')
104
+ expect(Puppet::GettextConfig.loaded_text_domains).to include(Puppet::GettextConfig::DEFAULT_TEXT_DOMAIN, :test)
105
+ end
106
+ end
107
+
108
+ describe "clearing the configured text domain" do
109
+ it 'succeeds' do
110
+ Puppet::GettextConfig.clear_text_domain
111
+ expect(FastGettext.text_domain).to be_nil
112
+ end
113
+
114
+ it 'falls back to default' do
115
+ Puppet::GettextConfig.reset_text_domain(:test)
116
+ expect(FastGettext.text_domain).to eq(:test)
117
+ Puppet::GettextConfig.clear_text_domain
118
+ expect(FastGettext.text_domain).to eq(Puppet::GettextConfig::DEFAULT_TEXT_DOMAIN)
100
119
  end
101
120
  end
102
121
 
103
122
  describe "deleting text domains" do
104
123
  it 'can delete a text domain by name' do
105
- Puppet::GettextConfig.reset_text_domain('test')
106
- expect(Puppet::GettextConfig.loaded_text_domains).to include(Puppet::GettextConfig::DEFAULT_TEXT_DOMAIN, 'test')
107
- Puppet::GettextConfig.delete_text_domain(Puppet::GettextConfig::DEFAULT_TEXT_DOMAIN)
108
- expect(Puppet::GettextConfig.loaded_text_domains).not_to include(Puppet::GettextConfig::DEFAULT_TEXT_DOMAIN)
124
+ Puppet::GettextConfig.reset_text_domain(:test)
125
+ expect(Puppet::GettextConfig.loaded_text_domains).to include(Puppet::GettextConfig::DEFAULT_TEXT_DOMAIN, :test)
126
+ Puppet::GettextConfig.delete_text_domain(:test)
127
+ expect(Puppet::GettextConfig.loaded_text_domains).to eq([Puppet::GettextConfig::DEFAULT_TEXT_DOMAIN])
109
128
  end
110
129
 
111
130
  it 'can delete all non-default text domains' do
112
- Puppet::GettextConfig.reset_text_domain('test')
113
- expect(Puppet::GettextConfig.loaded_text_domains).to include(Puppet::GettextConfig::DEFAULT_TEXT_DOMAIN, 'test')
131
+ Puppet::GettextConfig.reset_text_domain(:test)
132
+ expect(Puppet::GettextConfig.loaded_text_domains).to include(Puppet::GettextConfig::DEFAULT_TEXT_DOMAIN, :test)
114
133
  Puppet::GettextConfig.delete_environment_text_domains
115
- expect(Puppet::GettextConfig.loaded_text_domains).not_to include('test')
134
+ expect(Puppet::GettextConfig.loaded_text_domains).to eq([Puppet::GettextConfig::DEFAULT_TEXT_DOMAIN])
116
135
  end
117
136
 
118
137
  it 'can delete all text domains' do
119
- Puppet::GettextConfig.reset_text_domain('test')
120
- expect(Puppet::GettextConfig.loaded_text_domains).to include(Puppet::GettextConfig::DEFAULT_TEXT_DOMAIN, 'test')
138
+ Puppet::GettextConfig.reset_text_domain(:test)
139
+ expect(Puppet::GettextConfig.loaded_text_domains).to include(Puppet::GettextConfig::DEFAULT_TEXT_DOMAIN, :test)
121
140
  Puppet::GettextConfig.delete_all_text_domains
122
141
  expect(Puppet::GettextConfig.loaded_text_domains).to be_empty
123
142
  end
@@ -496,15 +496,16 @@ describe Puppet::Node::Environment do
496
496
  it "creates a new text domain the first time we try to use the text domain" do
497
497
  Puppet::GettextConfig.expects(:reset_text_domain).with(env.name)
498
498
  Puppet::ModuleTranslations.expects(:load_from_modulepath)
499
+ Puppet::GettextConfig.expects(:clear_text_domain)
499
500
 
500
- env.use_text_domain
501
+ env.with_text_domain do; end
501
502
  end
502
503
 
503
504
  it "uses the existing text domain once it has been created" do
504
- env.use_text_domain
505
+ env.with_text_domain do; end
505
506
 
506
507
  Puppet::GettextConfig.expects(:use_text_domain).with(env.name)
507
- env.use_text_domain
508
+ env.with_text_domain do; end
508
509
  end
509
510
  end
510
511
 
@@ -23,7 +23,7 @@ describe Puppet::Type.type(:package).provider(:aptitude) do
23
23
  Puppet::Util::Execution.expects(:execute).with(
24
24
  [dpkgquery_path, '-W', '--showformat', "'${Status} ${Package} ${Version}\\n'", 'faff'],
25
25
  {:failonfail => true, :combine => true, :custom_environment => {}}
26
- ).returns(output)
26
+ ).returns(Puppet::Util::Execution::ProcessOutput.new(output, 0))
27
27
 
28
28
  expect(pkg.property(:ensure).retrieve).to eq(expect)
29
29
  end
@@ -13,7 +13,7 @@ describe Puppet::Type.type(:package).provider(:aptrpm) do
13
13
  before(:each) do
14
14
  Puppet::Util.stubs(:which).with("rpm").returns("/bin/rpm")
15
15
  pkg.provider.stubs(:which).with("rpm").returns("/bin/rpm")
16
- Puppet::Util::Execution.expects(:execute).with(["/bin/rpm", "--version"], {:combine => true, :custom_environment => {}, :failonfail => true}).returns("4.10.1\n").at_most_once
16
+ Puppet::Util::Execution.expects(:execute).with(["/bin/rpm", "--version"], {:combine => true, :custom_environment => {}, :failonfail => true}).returns(Puppet::Util::Execution::ProcessOutput.new("4.10.1\n", 0)).at_most_once
17
17
  end
18
18
 
19
19
  def rpm_args
@@ -68,7 +68,7 @@ describe provider_class do
68
68
  end
69
69
 
70
70
  def dpkg_query_execution_returns(output)
71
- Puppet::Util::Execution.expects(:execute).with(query_args, execute_options).returns(output)
71
+ Puppet::Util::Execution.expects(:execute).with(query_args, execute_options).returns(Puppet::Util::Execution::ProcessOutput.new(output, 0))
72
72
  end
73
73
 
74
74
  before do
@@ -27,7 +27,7 @@ describe provider_class do
27
27
  end
28
28
 
29
29
  let(:bff_showres_output) {
30
- <<END
30
+ Puppet::Util::Execution::ProcessOutput.new(<<END, 0)
31
31
  mypackage.foo ALL @@I:mypackage.foo _all_filesets
32
32
  @ 1.2.3.1 MyPackage Runtime Environment @@I:mypackage.foo 1.2.3.1
33
33
  + 1.2.3.4 MyPackage Runtime Environment @@I:mypackage.foo 1.2.3.4
@@ -37,7 +37,7 @@ END
37
37
  }
38
38
 
39
39
  let(:rpm_showres_output) {
40
- <<END
40
+ Puppet::Util::Execution::ProcessOutput.new(<<END, 0)
41
41
  mypackage.foo ALL @@R:mypackage.foo _all_filesets
42
42
  @@R:mypackage.foo-1.2.3-1 1.2.3-1
43
43
  @@R:mypackage.foo-1.2.3-4 1.2.3-4
@@ -168,9 +168,6 @@ OUTPUT
168
168
 
169
169
  expect { @provider.install }.to raise_error(Puppet::Error, "NIM package provider is unable to downgrade packages")
170
170
  end
171
-
172
-
173
-
174
171
  end
175
172
 
176
173
  context "when uninstalling" do
@@ -187,10 +184,8 @@ OUTPUT
187
184
  @provider.class.expects(:pkglist).with(:pkgname => 'mypackage.foo').returns(nil)
188
185
  @provider.uninstall
189
186
  end
190
-
191
187
  end
192
188
 
193
-
194
189
  context "when parsing nimclient showres output" do
195
190
  describe "#parse_showres_output" do
196
191
  it "should be able to parse installp/BFF package listings" do
@@ -231,7 +226,6 @@ END
231
226
  expect(subject.send(:determine_latest_version, nimclient_showres_output, 'mypackage.foo')).to eq([:rpm, nil])
232
227
  end
233
228
  end
234
-
235
229
  end
236
230
 
237
231
  describe "#determine_package_type" do
@@ -244,7 +238,4 @@ END
244
238
  end
245
239
  end
246
240
  end
247
-
248
-
249
-
250
241
  end
@@ -74,7 +74,7 @@ describe Puppet::Type.type(:package).provider(:opkg) do
74
74
  end
75
75
 
76
76
  it "should install from the path segment of the URL" do
77
- Puppet::Util::Execution.expects(:execute).returns("")
77
+ Puppet::Util::Execution.expects(:execute).returns(Puppet::Util::Execution::ProcessOutput.new("", 0))
78
78
  provider.install
79
79
  end
80
80
  end
@@ -165,7 +165,7 @@ OPKG_OUTPUT
165
165
  end
166
166
 
167
167
  it "should return a nil if the package isn't found" do
168
- Puppet::Util::Execution.expects(:execute).returns("")
168
+ Puppet::Util::Execution.expects(:execute).returns(Puppet::Util::Execution::ProcessOutput.new("", 0))
169
169
  expect(provider.query).to be_nil
170
170
  end
171
171
 
@@ -115,7 +115,9 @@ describe Puppet::Type.type(:package).provider(:pkg) do
115
115
  end
116
116
 
117
117
  it "should work correctly for ensure latest on solaris 11(known UFOXI)" do
118
- Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'update', '-n', 'dummy'], {:failonfail => false, :combine => true}).returns ''
118
+ Puppet::Util::Execution.expects(:execute)
119
+ .with(['/bin/pkg', 'update', '-n', 'dummy'], {:failonfail => false, :combine => true})
120
+ .returns(Puppet::Util::Execution::ProcessOutput.new('', 0))
119
121
  $CHILD_STATUS.stubs(:exitstatus).returns 0
120
122
 
121
123
  described_class.expects(:pkg).with(:list,'-Hvn','dummy').returns File.read(my_fixture('dummy_solaris11.known'))
@@ -180,7 +182,9 @@ describe Puppet::Type.type(:package).provider(:pkg) do
180
182
  context ":query" do
181
183
  context "on solaris 10" do
182
184
  it "should find the package" do
183
- Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true}).returns File.read(my_fixture('dummy_solaris10'))
185
+ Puppet::Util::Execution.expects(:execute)
186
+ .with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true})
187
+ .returns(Puppet::Util::Execution::ProcessOutput.new(File.read(my_fixture('dummy_solaris10')), 0))
184
188
  $CHILD_STATUS.stubs(:exitstatus).returns 0
185
189
  expect(provider.query).to eq({
186
190
  :name => 'dummy',
@@ -192,7 +196,9 @@ describe Puppet::Type.type(:package).provider(:pkg) do
192
196
  end
193
197
 
194
198
  it "should return :absent when the package is not found" do
195
- Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true}).returns ''
199
+ Puppet::Util::Execution.expects(:execute)
200
+ .with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true})
201
+ .returns(Puppet::Util::Execution::ProcessOutput.new('', 0))
196
202
  $CHILD_STATUS.stubs(:exitstatus).returns 1
197
203
  expect(provider.query).to eq({:ensure => :absent, :name => "dummy"})
198
204
  end
@@ -201,7 +207,9 @@ describe Puppet::Type.type(:package).provider(:pkg) do
201
207
  context "on solaris 11" do
202
208
  it "should find the package" do
203
209
  $CHILD_STATUS.stubs(:exitstatus).returns 0
204
- Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true}).returns File.read(my_fixture('dummy_solaris11.installed'))
210
+ Puppet::Util::Execution.expects(:execute)
211
+ .with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true})
212
+ .returns(Puppet::Util::Execution::ProcessOutput.new(File.read(my_fixture('dummy_solaris11.installed')), 0))
205
213
  expect(provider.query).to eq({
206
214
  :name => 'dummy',
207
215
  :status => 'installed',
@@ -212,14 +220,19 @@ describe Puppet::Type.type(:package).provider(:pkg) do
212
220
  end
213
221
 
214
222
  it "should return :absent when the package is not found" do
215
- Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true}).returns ''
223
+ Puppet::Util::Execution
224
+ .expects(:execute)
225
+ .with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true})
226
+ .returns(Puppet::Util::Execution::ProcessOutput.new('', 0))
216
227
  $CHILD_STATUS.stubs(:exitstatus).returns 1
217
228
  expect(provider.query).to eq({:ensure => :absent, :name => "dummy"})
218
229
  end
219
230
  end
220
231
 
221
232
  it "should return fail when the packageline cannot be parsed" do
222
- Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true}).returns(File.read(my_fixture('incomplete')))
233
+ Puppet::Util::Execution.expects(:execute)
234
+ .with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true})
235
+ .returns(Puppet::Util::Execution::ProcessOutput.new(File.read(my_fixture('incomplete')), 0))
223
236
  $CHILD_STATUS.stubs(:exitstatus).returns 0
224
237
  expect {
225
238
  provider.query
@@ -238,8 +251,12 @@ describe Puppet::Type.type(:package).provider(:pkg) do
238
251
  end
239
252
  it "should accept all licenses" do
240
253
  provider.expects(:query).with().returns({:ensure => :absent})
241
- Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'install', *hash[:flags], 'dummy'], {:failonfail => false, :combine => true}).returns ''
242
- Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true}).returns ''
254
+ Puppet::Util::Execution.expects(:execute)
255
+ .with(['/bin/pkg', 'install', *hash[:flags], 'dummy'], {:failonfail => false, :combine => true})
256
+ .returns(Puppet::Util::Execution::ProcessOutput.new('', 0))
257
+ Puppet::Util::Execution.expects(:execute)
258
+ .with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
259
+ .returns(Puppet::Util::Execution::ProcessOutput.new('', 0))
243
260
  $CHILD_STATUS.stubs(:exitstatus).returns 0
244
261
  provider.install
245
262
  end
@@ -249,16 +266,24 @@ describe Puppet::Type.type(:package).provider(:pkg) do
249
266
  resource[:ensure] = '0.0.7,5.11-0.151006:20131230T130000Z'
250
267
  $CHILD_STATUS.stubs(:exitstatus).returns 0
251
268
  Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
252
- Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true}).returns 'pkg://foo/dummy@0.0.6,5.11-0.151006:20131230T130000Z installed -----'
253
- Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'update', *hash[:flags], 'dummy@0.0.7,5.11-0.151006:20131230T130000Z'], {:failonfail => false, :combine => true}).returns ''
269
+ Puppet::Util::Execution.expects(:execute)
270
+ .with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true})
271
+ .returns(Puppet::Util::Execution::ProcessOutput.new('pkg://foo/dummy@0.0.6,5.11-0.151006:20131230T130000Z installed -----', 0))
272
+ Puppet::Util::Execution.expects(:execute)
273
+ .with(['/bin/pkg', 'update', *hash[:flags], 'dummy@0.0.7,5.11-0.151006:20131230T130000Z'], {:failonfail => false, :combine => true})
274
+ .returns(Puppet::Util::Execution::ProcessOutput.new('', 0))
254
275
  provider.install
255
276
  end
256
277
 
257
278
  it "should install specific version(2)" do
258
279
  resource[:ensure] = '0.0.8'
259
280
  Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
260
- Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true}).returns 'pkg://foo/dummy@0.0.7,5.11-0.151006:20131230T130000Z installed -----'
261
- Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'update', *hash[:flags], 'dummy@0.0.8'], {:failonfail => false, :combine => true}).returns ''
281
+ Puppet::Util::Execution.expects(:execute)
282
+ .with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true})
283
+ .returns(Puppet::Util::Execution::ProcessOutput.new('pkg://foo/dummy@0.0.7,5.11-0.151006:20131230T130000Z installed -----', 0))
284
+ Puppet::Util::Execution.expects(:execute)
285
+ .with(['/bin/pkg', 'update', *hash[:flags], 'dummy@0.0.8'], {:failonfail => false, :combine => true})
286
+ .returns(Puppet::Util::Execution::ProcessOutput.new('', 0))
262
287
  $CHILD_STATUS.stubs(:exitstatus).returns 0
263
288
  provider.install
264
289
  end
@@ -268,14 +293,18 @@ describe Puppet::Type.type(:package).provider(:pkg) do
268
293
  provider.expects(:query).with().returns({:ensure => '0.0.8,5.11-0.151106:20131230T130000Z'})
269
294
  $CHILD_STATUS.stubs(:exitstatus).returns 0
270
295
  Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
271
- Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'update', *hash[:flags], 'dummy@0.0.7'], {:failonfail => false, :combine => true}).returns ''
296
+ Puppet::Util::Execution.expects(:execute)
297
+ .with(['/bin/pkg', 'update', *hash[:flags], 'dummy@0.0.7'], {:failonfail => false, :combine => true})
298
+ .returns(Puppet::Util::Execution::ProcessOutput.new('', 0))
272
299
  provider.install
273
300
  end
274
301
 
275
302
  it "should install any if version is not specified" do
276
303
  resource[:ensure] = :present
277
304
  provider.expects(:query).with().returns({:ensure => :absent})
278
- Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'install', *hash[:flags], 'dummy'], {:failonfail => false, :combine => true}).returns ''
305
+ Puppet::Util::Execution.expects(:execute)
306
+ .with(['/bin/pkg', 'install', *hash[:flags], 'dummy'], {:failonfail => false, :combine => true})
307
+ .returns(Puppet::Util::Execution::ProcessOutput.new('', 0))
279
308
  Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
280
309
  $CHILD_STATUS.stubs(:exitstatus).returns 0
281
310
  provider.install
@@ -285,7 +314,9 @@ describe Puppet::Type.type(:package).provider(:pkg) do
285
314
  resource[:ensure] = '0.0.7'
286
315
  provider.expects(:query).with().returns({:ensure => :absent})
287
316
  Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
288
- Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'install', *hash[:flags], 'dummy@0.0.7'], {:failonfail => false, :combine => true}).returns ''
317
+ Puppet::Util::Execution.expects(:execute)
318
+ .with(['/bin/pkg', 'install', *hash[:flags], 'dummy@0.0.7'], {:failonfail => false, :combine => true})
319
+ .returns(Puppet::Util::Execution::ProcessOutput.new('', 0))
289
320
  $CHILD_STATUS.stubs(:exitstatus).returns 0
290
321
  provider.install
291
322
  end
@@ -294,7 +325,9 @@ describe Puppet::Type.type(:package).provider(:pkg) do
294
325
  resource[:ensure] = '1.0-0.151006'
295
326
  is = :absent
296
327
  provider.expects(:query).with().returns({:ensure => is})
297
- described_class.expects(:pkg).with(:list, '-Hvfa', 'dummy@1.0-0.151006').returns File.read(my_fixture('dummy_implicit_version'))
328
+ described_class.expects(:pkg)
329
+ .with(:list, '-Hvfa', 'dummy@1.0-0.151006')
330
+ .returns(Puppet::Util::Execution::ProcessOutput.new(File.read(my_fixture('dummy_implicit_version')), 0))
298
331
  Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'install', '-n', 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true})
299
332
  provider.expects(:unhold).with()
300
333
  Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'install', *hash[:flags], 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true})
@@ -320,7 +353,9 @@ describe Puppet::Type.type(:package).provider(:pkg) do
320
353
  resource[:ensure] = '1.0-0.151006'
321
354
  is = '1.0,5.11-0.151006:20140220T084443Z'
322
355
  provider.expects(:warning).with("Implicit version 1.0-0.151006 has 3 possible matches")
323
- described_class.expects(:pkg).with(:list, '-Hvfa', 'dummy@1.0-0.151006').returns File.read(my_fixture('dummy_implicit_version'))
356
+ described_class.expects(:pkg)
357
+ .with(:list, '-Hvfa', 'dummy@1.0-0.151006')
358
+ .returns(Puppet::Util::Execution::ProcessOutput.new(File.read(my_fixture('dummy_implicit_version')), 0))
324
359
  Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'update', '-n', 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true})
325
360
  $CHILD_STATUS.stubs(:exitstatus).returns 4
326
361
  provider.insync?(is)