puppet 6.4.4-x86-mingw32 → 6.4.5-x86-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 (221) hide show
  1. checksums.yaml +4 -4
  2. data/CODEOWNERS +1 -1
  3. data/Gemfile +4 -4
  4. data/Gemfile.lock +38 -32
  5. data/ext/build_defaults.yaml +1 -0
  6. data/ext/cert_inspector +3 -3
  7. data/ext/puppet-test +2 -2
  8. data/ext/regexp_nodes/regexp_nodes.rb +4 -4
  9. data/ext/windows/service/daemon.rb +38 -8
  10. data/install.rb +6 -6
  11. data/lib/puppet/application.rb +1 -1
  12. data/lib/puppet/application/apply.rb +2 -2
  13. data/lib/puppet/application/describe.rb +3 -9
  14. data/lib/puppet/application/doc.rb +1 -1
  15. data/lib/puppet/application/lookup.rb +1 -1
  16. data/lib/puppet/application/script.rb +2 -2
  17. data/lib/puppet/application/ssl.rb +4 -1
  18. data/lib/puppet/configurer.rb +86 -30
  19. data/lib/puppet/configurer/downloader.rb +2 -6
  20. data/lib/puppet/defaults.rb +32 -6
  21. data/lib/puppet/error.rb +9 -1
  22. data/lib/puppet/face/module/list.rb +5 -5
  23. data/lib/puppet/face/module/search.rb +1 -1
  24. data/lib/puppet/face/module/uninstall.rb +1 -1
  25. data/lib/puppet/face/module/upgrade.rb +1 -1
  26. data/lib/puppet/file_serving/http_metadata.rb +1 -1
  27. data/lib/puppet/file_system.rb +0 -8
  28. data/lib/puppet/file_system/memory_file.rb +1 -1
  29. data/lib/puppet/file_system/posix.rb +3 -2
  30. data/lib/puppet/forge.rb +3 -3
  31. data/lib/puppet/functions.rb +1 -2
  32. data/lib/puppet/functions/camelcase.rb +2 -2
  33. data/lib/puppet/functions/epp.rb +4 -4
  34. data/lib/puppet/functions/find_file.rb +9 -9
  35. data/lib/puppet/functions/inline_epp.rb +5 -5
  36. data/lib/puppet/gettext/module_translations.rb +1 -1
  37. data/lib/puppet/graph/rb_tree_map.rb +2 -2
  38. data/lib/puppet/graph/simple_graph.rb +4 -3
  39. data/lib/puppet/indirector/file_bucket_file/file.rb +1 -1
  40. data/lib/puppet/indirector/hiera.rb +2 -0
  41. data/lib/puppet/indirector/resource/ral.rb +1 -3
  42. data/lib/puppet/indirector/resource/validator.rb +1 -1
  43. data/lib/puppet/interface.rb +2 -1
  44. data/lib/puppet/loaders.rb +0 -1
  45. data/lib/puppet/metatype/manager.rb +1 -1
  46. data/lib/puppet/module.rb +1 -1
  47. data/lib/puppet/module/task.rb +20 -4
  48. data/lib/puppet/module_tool/applications/installer.rb +1 -1
  49. data/lib/puppet/module_tool/applications/uninstaller.rb +3 -3
  50. data/lib/puppet/module_tool/metadata.rb +1 -1
  51. data/lib/puppet/module_tool/shared_behaviors.rb +4 -4
  52. data/lib/puppet/module_tool/tar/mini.rb +1 -1
  53. data/lib/puppet/network/http/api/indirected_routes.rb +12 -11
  54. data/lib/puppet/network/http/connection.rb +10 -12
  55. data/lib/puppet/network/http/pool.rb +2 -0
  56. data/lib/puppet/network/http/site.rb +1 -1
  57. data/lib/puppet/network/resolver.rb +2 -2
  58. data/lib/puppet/node/environment.rb +4 -2
  59. data/lib/puppet/pal/pal_impl.rb +2 -2
  60. data/lib/puppet/parser/ast.rb +1 -1
  61. data/lib/puppet/parser/ast/resourceparam.rb +1 -1
  62. data/lib/puppet/parser/functions.rb +1 -1
  63. data/lib/puppet/parser/functions/epp.rb +3 -3
  64. data/lib/puppet/parser/functions/inline_epp.rb +5 -5
  65. data/lib/puppet/parser/scope.rb +8 -7
  66. data/lib/puppet/pops/evaluator/collectors/catalog_collector.rb +1 -1
  67. data/lib/puppet/pops/evaluator/collectors/exported_collector.rb +1 -1
  68. data/lib/puppet/pops/evaluator/external_syntax_support.rb +3 -2
  69. data/lib/puppet/pops/evaluator/runtime3_support.rb +4 -4
  70. data/lib/puppet/pops/loader/task_instantiator.rb +4 -0
  71. data/lib/puppet/pops/loaders.rb +1 -1
  72. data/lib/puppet/pops/lookup/hiera_config.rb +1 -0
  73. data/lib/puppet/pops/lookup/sub_lookup.rb +1 -1
  74. data/lib/puppet/pops/merge_strategy.rb +22 -18
  75. data/lib/puppet/pops/parser/heredoc_support.rb +1 -1
  76. data/lib/puppet/pops/parser/interpolation_support.rb +4 -4
  77. data/lib/puppet/pops/parser/locator.rb +1 -1
  78. data/lib/puppet/pops/parser/pn_parser.rb +17 -16
  79. data/lib/puppet/pops/puppet_stack.rb +51 -49
  80. data/lib/puppet/pops/types/p_sensitive_type.rb +1 -1
  81. data/lib/puppet/pops/types/string_converter.rb +10 -10
  82. data/lib/puppet/pops/types/types.rb +3 -3
  83. data/lib/puppet/property.rb +1 -1
  84. data/lib/puppet/property/ensure.rb +1 -1
  85. data/lib/puppet/provider/exec.rb +6 -2
  86. data/lib/puppet/provider/nameservice/directoryservice.rb +1 -1
  87. data/lib/puppet/provider/nameservice/pw.rb +2 -2
  88. data/lib/puppet/provider/package/apt.rb +5 -1
  89. data/lib/puppet/provider/package/dnfmodule.rb +87 -0
  90. data/lib/puppet/provider/package/dpkg.rb +34 -18
  91. data/lib/puppet/provider/package/openbsd.rb +1 -1
  92. data/lib/puppet/provider/package/pip.rb +34 -9
  93. data/lib/puppet/provider/package/portage.rb +4 -4
  94. data/lib/puppet/provider/package/rpm.rb +5 -5
  95. data/lib/puppet/provider/package/windows/package.rb +1 -1
  96. data/lib/puppet/provider/package/yum.rb +1 -1
  97. data/lib/puppet/provider/package_targetable.rb +5 -4
  98. data/lib/puppet/provider/parsedfile.rb +1 -1
  99. data/lib/puppet/provider/service/daemontools.rb +9 -9
  100. data/lib/puppet/provider/service/openbsd.rb +1 -1
  101. data/lib/puppet/provider/service/rcng.rb +2 -2
  102. data/lib/puppet/provider/service/runit.rb +2 -8
  103. data/lib/puppet/provider/service/systemd.rb +9 -9
  104. data/lib/puppet/provider/user/directoryservice.rb +1 -1
  105. data/lib/puppet/provider/user/hpux.rb +1 -1
  106. data/lib/puppet/provider/user/user_role_add.rb +1 -1
  107. data/lib/puppet/provider/user/useradd.rb +22 -13
  108. data/lib/puppet/provider/user/windows_adsi.rb +4 -5
  109. data/lib/puppet/reference/indirection.rb +2 -2
  110. data/lib/puppet/reference/metaparameter.rb +1 -3
  111. data/lib/puppet/reference/providers.rb +1 -3
  112. data/lib/puppet/reference/type.rb +3 -9
  113. data/lib/puppet/reports.rb +1 -1
  114. data/lib/puppet/resource.rb +1 -1
  115. data/lib/puppet/resource/catalog.rb +1 -1
  116. data/lib/puppet/settings.rb +3 -3
  117. data/lib/puppet/settings/environment_conf.rb +1 -0
  118. data/lib/puppet/ssl/host.rb +1 -1
  119. data/lib/puppet/ssl/oids.rb +1 -1
  120. data/lib/puppet/transaction.rb +33 -11
  121. data/lib/puppet/transaction/report.rb +1 -1
  122. data/lib/puppet/type.rb +2 -4
  123. data/lib/puppet/type/exec.rb +7 -3
  124. data/lib/puppet/type/file.rb +1 -2
  125. data/lib/puppet/type/file/data_sync.rb +5 -1
  126. data/lib/puppet/type/group.rb +4 -2
  127. data/lib/puppet/type/notify.rb +3 -2
  128. data/lib/puppet/type/package.rb +10 -3
  129. data/lib/puppet/type/schedule.rb +1 -1
  130. data/lib/puppet/type/service.rb +1 -1
  131. data/lib/puppet/type/user.rb +4 -2
  132. data/lib/puppet/util.rb +35 -12
  133. data/lib/puppet/util/command_line/trollop.rb +1 -1
  134. data/lib/puppet/util/http_proxy.rb +8 -14
  135. data/lib/puppet/util/log.rb +2 -2
  136. data/lib/puppet/util/log/destinations.rb +2 -2
  137. data/lib/puppet/util/logging.rb +32 -20
  138. data/lib/puppet/util/metric.rb +2 -2
  139. data/lib/puppet/util/provider_features.rb +2 -4
  140. data/lib/puppet/util/rdoc.rb +1 -1
  141. data/lib/puppet/util/reference.rb +1 -1
  142. data/lib/puppet/util/resource_template.rb +1 -1
  143. data/lib/puppet/util/selinux.rb +3 -1
  144. data/lib/puppet/util/windows/adsi.rb +48 -18
  145. data/lib/puppet/util/windows/registry.rb +7 -5
  146. data/lib/puppet/vendor.rb +1 -1
  147. data/lib/puppet/version.rb +1 -1
  148. data/lib/puppet/x509/cert_provider.rb +13 -6
  149. data/locales/puppet.pot +199 -159
  150. data/man/man5/puppet.conf.5 +35 -5
  151. data/man/man8/puppet-agent.8 +1 -1
  152. data/man/man8/puppet-apply.8 +1 -1
  153. data/man/man8/puppet-catalog.8 +1 -1
  154. data/man/man8/puppet-config.8 +1 -1
  155. data/man/man8/puppet-describe.8 +1 -1
  156. data/man/man8/puppet-device.8 +1 -1
  157. data/man/man8/puppet-doc.8 +1 -1
  158. data/man/man8/puppet-epp.8 +1 -1
  159. data/man/man8/puppet-facts.8 +1 -1
  160. data/man/man8/puppet-filebucket.8 +1 -1
  161. data/man/man8/puppet-generate.8 +1 -1
  162. data/man/man8/puppet-help.8 +1 -1
  163. data/man/man8/puppet-key.8 +1 -1
  164. data/man/man8/puppet-lookup.8 +1 -1
  165. data/man/man8/puppet-man.8 +1 -1
  166. data/man/man8/puppet-module.8 +1 -1
  167. data/man/man8/puppet-node.8 +1 -1
  168. data/man/man8/puppet-parser.8 +1 -1
  169. data/man/man8/puppet-plugin.8 +1 -1
  170. data/man/man8/puppet-report.8 +1 -1
  171. data/man/man8/puppet-resource.8 +1 -1
  172. data/man/man8/puppet-script.8 +1 -1
  173. data/man/man8/puppet-ssl.8 +1 -1
  174. data/man/man8/puppet-status.8 +1 -1
  175. data/man/man8/puppet.8 +2 -2
  176. data/spec/fixtures/unit/provider/package/dnfmodule/dnf-module-list-installed.txt +11 -0
  177. data/spec/integration/configurer_spec.rb +52 -0
  178. data/spec/integration/type/notify_spec.rb +46 -0
  179. data/spec/lib/puppet/certificate_factory.rb +2 -2
  180. data/spec/spec_helper.rb +28 -0
  181. data/spec/unit/application/ssl_spec.rb +4 -7
  182. data/spec/unit/configurer_spec.rb +394 -398
  183. data/spec/unit/defaults_spec.rb +4 -4
  184. data/spec/unit/forge/forge_spec.rb +1 -3
  185. data/spec/unit/forge/repository_spec.rb +1 -3
  186. data/spec/unit/indirector/resource/ral_spec.rb +4 -4
  187. data/spec/unit/network/http/connection_spec.rb +119 -145
  188. data/spec/unit/parser/scope_spec.rb +10 -0
  189. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +8 -3
  190. data/spec/unit/pops/loaders/module_loaders_spec.rb +37 -0
  191. data/spec/unit/provider/exec_spec.rb +209 -0
  192. data/spec/unit/provider/package/dnfmodule_spec.rb +186 -0
  193. data/spec/unit/provider/package/dpkg_spec.rb +238 -78
  194. data/spec/unit/provider/package/pip_spec.rb +51 -6
  195. data/spec/unit/provider/package/portage_spec.rb +4 -4
  196. data/spec/unit/provider/package_targetable_spec.rb +60 -0
  197. data/spec/unit/provider/service/daemontools_spec.rb +24 -0
  198. data/spec/unit/provider/service/runit_spec.rb +24 -0
  199. data/spec/unit/provider/service/systemd_spec.rb +25 -25
  200. data/spec/unit/provider/user/hpux_spec.rb +2 -2
  201. data/spec/unit/provider/user/useradd_spec.rb +46 -0
  202. data/spec/unit/ssl/host_spec.rb +0 -5
  203. data/spec/unit/ssl/state_machine_spec.rb +0 -6
  204. data/spec/unit/transaction_spec.rb +46 -0
  205. data/spec/unit/type/exec_spec.rb +6 -12
  206. data/spec/unit/type/file/content_spec.rb +9 -3
  207. data/spec/unit/type/file_spec.rb +9 -4
  208. data/spec/unit/type/package_spec.rb +5 -0
  209. data/spec/unit/util/execution_spec.rb +16 -0
  210. data/spec/unit/util/http_proxy_spec.rb +118 -27
  211. data/spec/unit/util/log/destinations_spec.rb +7 -3
  212. data/spec/unit/util/log_spec.rb +0 -138
  213. data/spec/unit/util/logging_spec.rb +200 -0
  214. data/spec/unit/util/windows/adsi_spec.rb +51 -0
  215. data/spec/unit/x509/cert_provider_spec.rb +24 -4
  216. data/tasks/manpages.rake +1 -0
  217. metadata +12 -10
  218. data/lib/puppet/pops/loader/null_loader.rb +0 -60
  219. data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_get/should_yield_to_the_block.yml +0 -24
  220. data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_head/should_yield_to_the_block.yml +0 -24
  221. data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_post/should_yield_to_the_block.yml +0 -24
@@ -13,6 +13,39 @@ class LoggingTester
13
13
  include Puppet::Util::Logging
14
14
  end
15
15
 
16
+ class PuppetStackCreator
17
+ def raise_error(exception_class)
18
+ case exception_class
19
+ when Puppet::ParseErrorWithIssue
20
+ raise exception_class.new('Oops', '/tmp/test.pp', 30, 15, nil, :SYNTAX_ERROR)
21
+ when Puppet::ParseError
22
+ raise exception_class.new('Oops', '/tmp/test.pp', 30, 15)
23
+ else
24
+ raise exception_class.new('Oops')
25
+ end
26
+ end
27
+
28
+ def call_raiser(exception_class)
29
+ Puppet::Pops::PuppetStack.stack('/tmp/test2.pp', 20, self, :raise_error, [exception_class])
30
+ end
31
+
32
+ def two_frames_and_a_raise(exception_class)
33
+ Puppet::Pops::PuppetStack.stack('/tmp/test3.pp', 15, self, :call_raiser, [exception_class])
34
+ end
35
+
36
+ def outer_rescue(exception_class)
37
+ begin
38
+ two_frames_and_a_raise(exception_class)
39
+ rescue Puppet::Error => e
40
+ Puppet.log_exception(e)
41
+ end
42
+ end
43
+
44
+ def run(exception_class)
45
+ Puppet::Pops::PuppetStack.stack('/tmp/test4.pp', 10, self, :outer_rescue, [exception_class])
46
+ end
47
+ end
48
+
16
49
  describe Puppet::Util::Logging do
17
50
  before do
18
51
  @logger = LoggingTester.new
@@ -340,6 +373,173 @@ original
340
373
  .*2\.rb:2:in `b'
341
374
  .*3\.rb:1/)
342
375
  end
376
+
377
+ describe "when trace is disabled" do
378
+ it 'excludes backtrace for RuntimeError in log message' do
379
+ begin
380
+ raise RuntimeError, 'Oops'
381
+ rescue RuntimeError => e
382
+ Puppet.log_exception(e)
383
+ end
384
+
385
+ expect(@logs.size).to eq(1)
386
+ log = @logs[0]
387
+ expect(log.message).to_not match('/logging_spec.rb')
388
+ expect(log.backtrace).to be_nil
389
+ end
390
+
391
+ it "backtrace member is unset when logging ParseErrorWithIssue" do
392
+ begin
393
+ raise Puppet::ParseErrorWithIssue.new('Oops', '/tmp/test.pp', 30, 15, nil, :SYNTAX_ERROR)
394
+ rescue RuntimeError => e
395
+ Puppet.log_exception(e)
396
+ end
397
+
398
+ expect(@logs.size).to eq(1)
399
+ log = @logs[0]
400
+ expect(log.message).to_not match('/logging_spec.rb')
401
+ expect(log.backtrace).to be_nil
402
+ end
403
+ end
404
+
405
+ describe "when trace is enabled" do
406
+ it 'includes backtrace for RuntimeError in log message when enabled globally' do
407
+ Puppet[:trace] = true
408
+ begin
409
+ raise RuntimeError, 'Oops'
410
+ rescue RuntimeError => e
411
+ Puppet.log_exception(e, :default)
412
+ end
413
+ Puppet[:trace] = false
414
+
415
+ expect(@logs.size).to eq(1)
416
+ log = @logs[0]
417
+ expect(log.message).to match('/logging_spec.rb')
418
+ expect(log.backtrace).to be_nil
419
+ end
420
+
421
+ it 'includes backtrace for RuntimeError in log message when enabled via option' do
422
+ begin
423
+ raise RuntimeError, 'Oops'
424
+ rescue RuntimeError => e
425
+ Puppet.log_exception(e, :default, :trace => true)
426
+ end
427
+
428
+ expect(@logs.size).to eq(1)
429
+ log = @logs[0]
430
+ expect(log.message).to match('/logging_spec.rb')
431
+ expect(log.backtrace).to be_nil
432
+ end
433
+
434
+
435
+ it "backtrace member is set when logging ParseErrorWithIssue" do
436
+ begin
437
+ raise Puppet::ParseErrorWithIssue.new('Oops', '/tmp/test.pp', 30, 15, nil, :SYNTAX_ERROR)
438
+ rescue RuntimeError => e
439
+ Puppet.log_exception(e, :default, :trace => true)
440
+ end
441
+
442
+ expect(@logs.size).to eq(1)
443
+ log = @logs[0]
444
+ expect(log.message).to_not match('/logging_spec.rb')
445
+ expect(log.backtrace).to be_a(Array)
446
+ expect(log.backtrace[0]).to match('/logging_spec.rb')
447
+ end
448
+ it "backtrace has interleaved PuppetStack when logging ParseErrorWithIssue" do
449
+ Puppet[:trace] = true
450
+ PuppetStackCreator.new.run(Puppet::ParseErrorWithIssue)
451
+ Puppet[:trace] = false
452
+
453
+ expect(@logs.size).to eq(1)
454
+ log = @logs[0]
455
+ expect(log.message).to_not match('/logging_spec.rb')
456
+ expect(log.backtrace[0]).to match('/logging_spec.rb')
457
+
458
+ expect(log.backtrace[1]).to match('/tmp/test2.pp:20')
459
+ puppetstack = log.backtrace.select { |l| l =~ /tmp\/test\d\.pp/ }
460
+
461
+ expect(puppetstack.length).to equal 3
462
+ end
463
+
464
+ it "message has interleaved PuppetStack when logging ParseError" do
465
+ Puppet[:trace] = true
466
+ PuppetStackCreator.new.run(Puppet::ParseError)
467
+ Puppet[:trace] = false
468
+
469
+ expect(@logs.size).to eq(1)
470
+ log = @logs[0]
471
+
472
+ log_lines = log.message.split("\n")
473
+ expect(log_lines[1]).to match('/logging_spec.rb')
474
+ expect(log_lines[2]).to match('/tmp/test2.pp:20')
475
+ puppetstack = log_lines.select { |l| l =~ /tmp\/test\d\.pp/ }
476
+
477
+ expect(puppetstack.length).to equal 3
478
+ end
479
+ end
480
+
481
+ describe "when trace is disabled but puppet_trace is enabled" do
482
+ it "includes only PuppetStack as backtrace member with ParseErrorWithIssue" do
483
+ Puppet[:trace] = false
484
+ Puppet[:puppet_trace] = true
485
+ PuppetStackCreator.new.run(Puppet::ParseErrorWithIssue)
486
+ Puppet[:trace] = false
487
+ Puppet[:puppet_trace] = false
488
+
489
+ expect(@logs.size).to eq(1)
490
+ log = @logs[0]
491
+
492
+ expect(log.backtrace[0]).to match('/tmp/test2.pp:20')
493
+ expect(log.backtrace.length).to equal 3
494
+ end
495
+
496
+ it "includes only PuppetStack in message with ParseError" do
497
+ Puppet[:trace] = false
498
+ Puppet[:puppet_trace] = true
499
+ PuppetStackCreator.new.run(Puppet::ParseError)
500
+ Puppet[:trace] = false
501
+ Puppet[:puppet_trace] = false
502
+
503
+ expect(@logs.size).to eq(1)
504
+ log = @logs[0]
505
+
506
+ log_lines = log.message.split("\n")
507
+ expect(log_lines[1]).to match('/tmp/test2.pp:20')
508
+ puppetstack = log_lines.select { |l| l =~ /tmp\/test\d\.pp/ }
509
+
510
+ expect(puppetstack.length).to equal 3
511
+ end
512
+ end
513
+
514
+ it 'includes position details for ParseError in log message' do
515
+ begin
516
+ raise Puppet::ParseError.new('Oops', '/tmp/test.pp', 30, 15)
517
+ rescue RuntimeError => e
518
+ Puppet.log_exception(e)
519
+ end
520
+
521
+ expect(@logs.size).to eq(1)
522
+ log = @logs[0]
523
+ expect(log.message).to match(/ \(file: \/tmp\/test\.pp, line: 30, column: 15\)/)
524
+ expect(log.message).to be(log.to_s)
525
+ end
526
+
527
+ it 'excludes position details for ParseErrorWithIssue from log message' do
528
+ begin
529
+ raise Puppet::ParseErrorWithIssue.new('Oops', '/tmp/test.pp', 30, 15, nil, :SYNTAX_ERROR)
530
+ rescue RuntimeError => e
531
+ Puppet.log_exception(e)
532
+ end
533
+
534
+ expect(@logs.size).to eq(1)
535
+ log = @logs[0]
536
+ expect(log.message).to_not match(/ \(file: \/tmp\/test\.pp, line: 30, column: 15\)/)
537
+ expect(log.to_s).to match(/ \(file: \/tmp\/test\.pp, line: 30, column: 15\)/)
538
+ expect(log.issue_code).to eq(:SYNTAX_ERROR)
539
+ expect(log.file).to eq('/tmp/test.pp')
540
+ expect(log.line).to eq(30)
541
+ expect(log.pos).to eq(15)
542
+ end
343
543
  end
344
544
 
345
545
  describe 'when Facter' do
@@ -41,6 +41,19 @@ describe Puppet::Util::Windows::ADSI, :if => Puppet::Util::Platform.windows? do
41
41
  end
42
42
  end
43
43
 
44
+ describe ".domain_role" do
45
+ DOMAIN_ROLES = Puppet::Util::Platform.windows? ? Puppet::Util::Windows::ADSI::DOMAIN_ROLES : {}
46
+
47
+ DOMAIN_ROLES.each do |id, role|
48
+ it "should be able to return #{role} as the domain role of the computer" do
49
+ Puppet::Util::Windows::ADSI.instance_variable_set(:@domain_role, nil)
50
+ domain_role = [double('WMI', :DomainRole => id)]
51
+ allow(Puppet::Util::Windows::ADSI).to receive(:execquery).with('select DomainRole from Win32_ComputerSystem').and_return(domain_role)
52
+ expect(Puppet::Util::Windows::ADSI.domain_role).to eq(role)
53
+ end
54
+ end
55
+ end
56
+
44
57
  describe ".sid_uri" do
45
58
  it "should raise an error when the input is not a SID Principal" do
46
59
  [Object.new, {}, 1, :symbol, '', nil].each do |input|
@@ -56,6 +69,32 @@ describe Puppet::Util::Windows::ADSI, :if => Puppet::Util::Platform.windows? do
56
69
  end
57
70
  end
58
71
 
72
+ shared_examples 'a local only resource query' do |klass, account_type|
73
+ before(:each) do
74
+ allow(Puppet::Util::Windows::ADSI).to receive(:domain_role).and_return(:MEMBER_SERVER)
75
+ end
76
+
77
+ it "should be able to check for a local resource" do
78
+ local_domain = 'testcomputername'
79
+ principal = double('Principal', :account => resource_name, :domain => local_domain, :account_type => account_type)
80
+ allow(Puppet::Util::Windows::SID).to receive(:name_to_principal).with(resource_name).and_return(principal)
81
+ expect(klass.exists?(resource_name)).to eq(true)
82
+ end
83
+
84
+ it "should be case insensitive when comparing the domain with the computer name" do
85
+ local_domain = 'TESTCOMPUTERNAME'
86
+ principal = double('Principal', :account => resource_name, :domain => local_domain, :account_type => account_type)
87
+ allow(Puppet::Util::Windows::SID).to receive(:name_to_principal).with(resource_name).and_return(principal)
88
+ expect(klass.exists?(resource_name)).to eq(true)
89
+ end
90
+
91
+ it "should return false if no local resource exists" do
92
+ principal = double('Principal', :account => resource_name, :domain => 'AD_DOMAIN', :account_type => account_type)
93
+ allow(Puppet::Util::Windows::SID).to receive(:name_to_principal).with(resource_name).and_return(principal)
94
+ expect(klass.exists?(resource_name)).to eq(false)
95
+ end
96
+ end
97
+
59
98
  describe Puppet::Util::Windows::ADSI::User do
60
99
  let(:username) { 'testuser' }
61
100
  let(:domain) { 'DOMAIN' }
@@ -103,6 +142,12 @@ describe Puppet::Util::Windows::ADSI, :if => Puppet::Util::Platform.windows? do
103
142
  expect(user.native_object).to eq(adsi_user)
104
143
  end
105
144
 
145
+ context "when domain-joined" do
146
+ it_should_behave_like 'a local only resource query', Puppet::Util::Windows::ADSI::User, :SidTypeUser do
147
+ let(:resource_name) { username }
148
+ end
149
+ end
150
+
106
151
  it "should be able to check the existence of a user" do
107
152
  expect(Puppet::Util::Windows::SID).to receive(:name_to_principal).with(username).and_return(nil)
108
153
  expect(Puppet::Util::Windows::ADSI).to receive(:connect).with("WinNT://./#{username},user").and_return(connection)
@@ -543,6 +588,12 @@ describe Puppet::Util::Windows::ADSI, :if => Puppet::Util::Platform.windows? do
543
588
  expect(Puppet::Util::Windows::ADSI::Group.uri(groupname, ntauthority_localized)).to eq("WinNT://./#{groupname},group")
544
589
  end
545
590
 
591
+ context "when domain-joined" do
592
+ it_should_behave_like 'a local only resource query', Puppet::Util::Windows::ADSI::Group, :SidTypeGroup do
593
+ let(:resource_name) { groupname }
594
+ end
595
+ end
596
+
546
597
  it "should be able to create a group" do
547
598
  adsi_group = double("adsi")
548
599
 
@@ -260,11 +260,11 @@ describe Puppet::X509::CertProvider do
260
260
  }.to raise_error(RuntimeError, 'Certname "signed/../key" must not contain unprintable or non-ASCII characters')
261
261
  end
262
262
 
263
- it 'returns nil if `hostprivkey` is overridden' do
263
+ it 'prefers `hostprivkey` if set' do
264
264
  Puppet[:certname] = 'foo'
265
265
  Puppet[:hostprivkey] = File.join(fixture_dir, "signed-key.pem")
266
266
 
267
- expect(provider.load_private_key('foo')).to be_nil
267
+ expect(provider.load_private_key('foo')).to be_a(OpenSSL::PKey::RSA)
268
268
  end
269
269
 
270
270
  it 'raises if the private key is unreadable' do
@@ -318,11 +318,11 @@ describe Puppet::X509::CertProvider do
318
318
  }.to raise_error(RuntimeError, 'Certname "tom/../key" must not contain unprintable or non-ASCII characters')
319
319
  end
320
320
 
321
- it 'returns nil if `hostcert` is overridden' do
321
+ it 'prefers `hostcert` if set' do
322
322
  Puppet[:certname] = 'foo'
323
323
  Puppet[:hostcert] = File.join(fixture_dir, "signed.pem")
324
324
 
325
- expect(provider.load_client_cert('foo')).to be_nil
325
+ expect(provider.load_client_cert('foo')).to be_a(OpenSSL::X509::Certificate)
326
326
  end
327
327
 
328
328
  it 'raises if the certificate is unreadable' do
@@ -413,6 +413,16 @@ describe Puppet::X509::CertProvider do
413
413
  provider.save_private_key(name, private_key)
414
414
  }.to raise_error(Puppet::Error, "Failed to save private key for '#{name}'")
415
415
  end
416
+
417
+ it 'prefers `hostprivkey` if set' do
418
+ overridden_path = tmpfile('hostprivkey')
419
+ Puppet[:hostprivkey] = overridden_path
420
+
421
+ provider.save_private_key(name, private_key)
422
+
423
+ expect(File).to_not exist(path)
424
+ expect(File).to exist(overridden_path)
425
+ end
416
426
  end
417
427
 
418
428
  context 'certs' do
@@ -452,6 +462,16 @@ describe Puppet::X509::CertProvider do
452
462
  provider.save_client_cert(name, client_cert)
453
463
  }.to raise_error(Puppet::Error, "Failed to save client certificate for '#{name}'")
454
464
  end
465
+
466
+ it 'prefers `hostcert` if set' do
467
+ overridden_path = tmpfile('hostcert')
468
+ Puppet[:hostcert] = overridden_path
469
+
470
+ provider.save_client_cert(name, client_cert)
471
+
472
+ expect(File).to_not exist(path)
473
+ expect(File).to exist(overridden_path)
474
+ end
455
475
  end
456
476
 
457
477
  context 'requests' do
@@ -43,6 +43,7 @@ task :gen_manpages do
43
43
  # IO.popen("#{ronn} #{ronn_args} > ./man/man5/puppet.conf.5", 'w') do |fh|
44
44
  # fh.write %x{RUBYLIB=./lib:$RUBYLIB bin/puppetdoc --reference configuration}
45
45
  # end
46
+ %x{mkdir -p ./man/man5 ./man/man8}
46
47
  %x{RUBYLIB=./lib:$RUBYLIB bin/puppet doc --reference configuration > ./man/man5/puppetconf.5.ronn}
47
48
  %x{#{ronn} #{ronn_args} ./man/man5/puppetconf.5.ronn}
48
49
  FileUtils.mv("./man/man5/puppetconf.5", "./man/man5/puppet.conf.5")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.4.4
4
+ version: 6.4.5
5
5
  platform: x86-mingw32
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-08 00:00:00.000000000 Z
11
+ date: 2020-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: facter
@@ -911,7 +911,6 @@ files:
911
911
  - lib/puppet/pops/loader/loader.rb
912
912
  - lib/puppet/pops/loader/loader_paths.rb
913
913
  - lib/puppet/pops/loader/module_loaders.rb
914
- - lib/puppet/pops/loader/null_loader.rb
915
914
  - lib/puppet/pops/loader/predefined_loader.rb
916
915
  - lib/puppet/pops/loader/puppet_function_instantiator.rb
917
916
  - lib/puppet/pops/loader/puppet_plan_instantiator.rb
@@ -1078,6 +1077,7 @@ files:
1078
1077
  - lib/puppet/provider/package/aptrpm.rb
1079
1078
  - lib/puppet/provider/package/blastwave.rb
1080
1079
  - lib/puppet/provider/package/dnf.rb
1080
+ - lib/puppet/provider/package/dnfmodule.rb
1081
1081
  - lib/puppet/provider/package/dpkg.rb
1082
1082
  - lib/puppet/provider/package/fink.rb
1083
1083
  - lib/puppet/provider/package/freebsd.rb
@@ -1748,6 +1748,7 @@ files:
1748
1748
  - spec/fixtures/unit/provider/cron/crontab/vixie_header.txt
1749
1749
  - spec/fixtures/unit/provider/cron/parsed/managed
1750
1750
  - spec/fixtures/unit/provider/cron/parsed/simple
1751
+ - spec/fixtures/unit/provider/package/dnfmodule/dnf-module-list-installed.txt
1751
1752
  - spec/fixtures/unit/provider/package/gem/gem-list-single-package
1752
1753
  - spec/fixtures/unit/provider/package/gem/line-with-1.8.5-warning
1753
1754
  - spec/fixtures/unit/provider/package/openbsd/pkginfo.detail
@@ -1798,9 +1799,6 @@ files:
1798
1799
  - spec/fixtures/unit/util/filetype/suntab_output
1799
1800
  - spec/fixtures/unit/util/monkey_patches/x509.pem
1800
1801
  - spec/fixtures/unit/util/rdoc/basic.pp
1801
- - spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_get/should_yield_to_the_block.yml
1802
- - spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_head/should_yield_to_the_block.yml
1803
- - spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_post/should_yield_to_the_block.yml
1804
1802
  - spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_fetch_if_not_on_the_local_disk.yml
1805
1803
  - spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_not_update_if_content_on_disk_is_up-to-date.yml
1806
1804
  - spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_update_if_content_differs_on_disk.yml
@@ -1874,6 +1872,7 @@ files:
1874
1872
  - spec/integration/transaction_spec.rb
1875
1873
  - spec/integration/type/exec_spec.rb
1876
1874
  - spec/integration/type/file_spec.rb
1875
+ - spec/integration/type/notify_spec.rb
1877
1876
  - spec/integration/type/package_spec.rb
1878
1877
  - spec/integration/type/tidy_spec.rb
1879
1878
  - spec/integration/type_spec.rb
@@ -2403,6 +2402,7 @@ files:
2403
2402
  - spec/unit/provider/package/aptrpm_spec.rb
2404
2403
  - spec/unit/provider/package/base_spec.rb
2405
2404
  - spec/unit/provider/package/dnf_spec.rb
2405
+ - spec/unit/provider/package/dnfmodule_spec.rb
2406
2406
  - spec/unit/provider/package/dpkg_spec.rb
2407
2407
  - spec/unit/provider/package/freebsd_spec.rb
2408
2408
  - spec/unit/provider/package/gem_spec.rb
@@ -2432,6 +2432,7 @@ files:
2432
2432
  - spec/unit/provider/package/windows_spec.rb
2433
2433
  - spec/unit/provider/package/yum_spec.rb
2434
2434
  - spec/unit/provider/package/zypper_spec.rb
2435
+ - spec/unit/provider/package_targetable_spec.rb
2435
2436
  - spec/unit/provider/parsedfile_spec.rb
2436
2437
  - spec/unit/provider/service/base_spec.rb
2437
2438
  - spec/unit/provider/service/bsd_spec.rb
@@ -2658,7 +2659,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2658
2659
  - !ruby/object:Gem::Version
2659
2660
  version: 1.3.1
2660
2661
  requirements: []
2661
- rubygems_version: 3.0.4
2662
+ rubygems_version: 3.0.6
2662
2663
  signing_key:
2663
2664
  specification_version: 4
2664
2665
  summary: Puppet, an automated configuration management tool
@@ -2984,6 +2985,7 @@ test_files:
2984
2985
  - spec/fixtures/unit/provider/cron/crontab/vixie_header.txt
2985
2986
  - spec/fixtures/unit/provider/cron/parsed/managed
2986
2987
  - spec/fixtures/unit/provider/cron/parsed/simple
2988
+ - spec/fixtures/unit/provider/package/dnfmodule/dnf-module-list-installed.txt
2987
2989
  - spec/fixtures/unit/provider/package/gem/gem-list-single-package
2988
2990
  - spec/fixtures/unit/provider/package/gem/line-with-1.8.5-warning
2989
2991
  - spec/fixtures/unit/provider/package/openbsd/pkginfo.detail
@@ -3034,9 +3036,6 @@ test_files:
3034
3036
  - spec/fixtures/unit/util/filetype/suntab_output
3035
3037
  - spec/fixtures/unit/util/monkey_patches/x509.pem
3036
3038
  - spec/fixtures/unit/util/rdoc/basic.pp
3037
- - spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_get/should_yield_to_the_block.yml
3038
- - spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_head/should_yield_to_the_block.yml
3039
- - spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_post/should_yield_to_the_block.yml
3040
3039
  - spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_fetch_if_not_on_the_local_disk.yml
3041
3040
  - spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_not_update_if_content_on_disk_is_up-to-date.yml
3042
3041
  - spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_update_if_content_differs_on_disk.yml
@@ -3110,6 +3109,7 @@ test_files:
3110
3109
  - spec/integration/transaction_spec.rb
3111
3110
  - spec/integration/type/exec_spec.rb
3112
3111
  - spec/integration/type/file_spec.rb
3112
+ - spec/integration/type/notify_spec.rb
3113
3113
  - spec/integration/type/package_spec.rb
3114
3114
  - spec/integration/type/tidy_spec.rb
3115
3115
  - spec/integration/type_spec.rb
@@ -3639,6 +3639,7 @@ test_files:
3639
3639
  - spec/unit/provider/package/aptrpm_spec.rb
3640
3640
  - spec/unit/provider/package/base_spec.rb
3641
3641
  - spec/unit/provider/package/dnf_spec.rb
3642
+ - spec/unit/provider/package/dnfmodule_spec.rb
3642
3643
  - spec/unit/provider/package/dpkg_spec.rb
3643
3644
  - spec/unit/provider/package/freebsd_spec.rb
3644
3645
  - spec/unit/provider/package/gem_spec.rb
@@ -3668,6 +3669,7 @@ test_files:
3668
3669
  - spec/unit/provider/package/windows_spec.rb
3669
3670
  - spec/unit/provider/package/yum_spec.rb
3670
3671
  - spec/unit/provider/package/zypper_spec.rb
3672
+ - spec/unit/provider/package_targetable_spec.rb
3671
3673
  - spec/unit/provider/parsedfile_spec.rb
3672
3674
  - spec/unit/provider/service/base_spec.rb
3673
3675
  - spec/unit/provider/service/bsd_spec.rb