puppet 6.4.4 → 6.4.5
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.
- checksums.yaml +4 -4
- data/CODEOWNERS +1 -1
- data/Gemfile +4 -4
- data/Gemfile.lock +38 -32
- data/ext/build_defaults.yaml +1 -0
- data/ext/cert_inspector +3 -3
- data/ext/puppet-test +2 -2
- data/ext/regexp_nodes/regexp_nodes.rb +4 -4
- data/ext/windows/service/daemon.rb +38 -8
- data/install.rb +6 -6
- data/lib/puppet/application.rb +1 -1
- data/lib/puppet/application/apply.rb +2 -2
- data/lib/puppet/application/describe.rb +3 -9
- data/lib/puppet/application/doc.rb +1 -1
- data/lib/puppet/application/lookup.rb +1 -1
- data/lib/puppet/application/script.rb +2 -2
- data/lib/puppet/application/ssl.rb +4 -1
- data/lib/puppet/configurer.rb +86 -30
- data/lib/puppet/configurer/downloader.rb +2 -6
- data/lib/puppet/defaults.rb +32 -6
- data/lib/puppet/error.rb +9 -1
- data/lib/puppet/face/module/list.rb +5 -5
- data/lib/puppet/face/module/search.rb +1 -1
- data/lib/puppet/face/module/uninstall.rb +1 -1
- data/lib/puppet/face/module/upgrade.rb +1 -1
- data/lib/puppet/file_serving/http_metadata.rb +1 -1
- data/lib/puppet/file_system.rb +0 -8
- data/lib/puppet/file_system/memory_file.rb +1 -1
- data/lib/puppet/file_system/posix.rb +3 -2
- data/lib/puppet/forge.rb +3 -3
- data/lib/puppet/functions.rb +1 -2
- data/lib/puppet/functions/camelcase.rb +2 -2
- data/lib/puppet/functions/epp.rb +4 -4
- data/lib/puppet/functions/find_file.rb +9 -9
- data/lib/puppet/functions/inline_epp.rb +5 -5
- data/lib/puppet/gettext/module_translations.rb +1 -1
- data/lib/puppet/graph/rb_tree_map.rb +2 -2
- data/lib/puppet/graph/simple_graph.rb +4 -3
- data/lib/puppet/indirector/file_bucket_file/file.rb +1 -1
- data/lib/puppet/indirector/hiera.rb +2 -0
- data/lib/puppet/indirector/resource/ral.rb +1 -3
- data/lib/puppet/indirector/resource/validator.rb +1 -1
- data/lib/puppet/interface.rb +2 -1
- data/lib/puppet/loaders.rb +0 -1
- data/lib/puppet/metatype/manager.rb +1 -1
- data/lib/puppet/module.rb +1 -1
- data/lib/puppet/module/task.rb +20 -4
- data/lib/puppet/module_tool/applications/installer.rb +1 -1
- data/lib/puppet/module_tool/applications/uninstaller.rb +3 -3
- data/lib/puppet/module_tool/metadata.rb +1 -1
- data/lib/puppet/module_tool/shared_behaviors.rb +4 -4
- data/lib/puppet/module_tool/tar/mini.rb +1 -1
- data/lib/puppet/network/http/api/indirected_routes.rb +12 -11
- data/lib/puppet/network/http/connection.rb +10 -12
- data/lib/puppet/network/http/pool.rb +2 -0
- data/lib/puppet/network/http/site.rb +1 -1
- data/lib/puppet/network/resolver.rb +2 -2
- data/lib/puppet/node/environment.rb +4 -2
- data/lib/puppet/pal/pal_impl.rb +2 -2
- data/lib/puppet/parser/ast.rb +1 -1
- data/lib/puppet/parser/ast/resourceparam.rb +1 -1
- data/lib/puppet/parser/functions.rb +1 -1
- data/lib/puppet/parser/functions/epp.rb +3 -3
- data/lib/puppet/parser/functions/inline_epp.rb +5 -5
- data/lib/puppet/parser/scope.rb +8 -7
- data/lib/puppet/pops/evaluator/collectors/catalog_collector.rb +1 -1
- data/lib/puppet/pops/evaluator/collectors/exported_collector.rb +1 -1
- data/lib/puppet/pops/evaluator/external_syntax_support.rb +3 -2
- data/lib/puppet/pops/evaluator/runtime3_support.rb +4 -4
- data/lib/puppet/pops/loader/task_instantiator.rb +4 -0
- data/lib/puppet/pops/loaders.rb +1 -1
- data/lib/puppet/pops/lookup/hiera_config.rb +1 -0
- data/lib/puppet/pops/lookup/sub_lookup.rb +1 -1
- data/lib/puppet/pops/merge_strategy.rb +22 -18
- data/lib/puppet/pops/parser/heredoc_support.rb +1 -1
- data/lib/puppet/pops/parser/interpolation_support.rb +4 -4
- data/lib/puppet/pops/parser/locator.rb +1 -1
- data/lib/puppet/pops/parser/pn_parser.rb +17 -16
- data/lib/puppet/pops/puppet_stack.rb +51 -49
- data/lib/puppet/pops/types/p_sensitive_type.rb +1 -1
- data/lib/puppet/pops/types/string_converter.rb +10 -10
- data/lib/puppet/pops/types/types.rb +3 -3
- data/lib/puppet/property.rb +1 -1
- data/lib/puppet/property/ensure.rb +1 -1
- data/lib/puppet/provider/exec.rb +6 -2
- data/lib/puppet/provider/nameservice/directoryservice.rb +1 -1
- data/lib/puppet/provider/nameservice/pw.rb +2 -2
- data/lib/puppet/provider/package/apt.rb +5 -1
- data/lib/puppet/provider/package/dnfmodule.rb +87 -0
- data/lib/puppet/provider/package/dpkg.rb +34 -18
- data/lib/puppet/provider/package/openbsd.rb +1 -1
- data/lib/puppet/provider/package/pip.rb +34 -9
- data/lib/puppet/provider/package/portage.rb +4 -4
- data/lib/puppet/provider/package/rpm.rb +5 -5
- data/lib/puppet/provider/package/windows/package.rb +1 -1
- data/lib/puppet/provider/package/yum.rb +1 -1
- data/lib/puppet/provider/package_targetable.rb +5 -4
- data/lib/puppet/provider/parsedfile.rb +1 -1
- data/lib/puppet/provider/service/daemontools.rb +9 -9
- data/lib/puppet/provider/service/openbsd.rb +1 -1
- data/lib/puppet/provider/service/rcng.rb +2 -2
- data/lib/puppet/provider/service/runit.rb +2 -8
- data/lib/puppet/provider/service/systemd.rb +9 -9
- data/lib/puppet/provider/user/directoryservice.rb +1 -1
- data/lib/puppet/provider/user/hpux.rb +1 -1
- data/lib/puppet/provider/user/user_role_add.rb +1 -1
- data/lib/puppet/provider/user/useradd.rb +22 -13
- data/lib/puppet/provider/user/windows_adsi.rb +4 -5
- data/lib/puppet/reference/indirection.rb +2 -2
- data/lib/puppet/reference/metaparameter.rb +1 -3
- data/lib/puppet/reference/providers.rb +1 -3
- data/lib/puppet/reference/type.rb +3 -9
- data/lib/puppet/reports.rb +1 -1
- data/lib/puppet/resource.rb +1 -1
- data/lib/puppet/resource/catalog.rb +1 -1
- data/lib/puppet/settings.rb +3 -3
- data/lib/puppet/settings/environment_conf.rb +1 -0
- data/lib/puppet/ssl/host.rb +1 -1
- data/lib/puppet/ssl/oids.rb +1 -1
- data/lib/puppet/transaction.rb +33 -11
- data/lib/puppet/transaction/report.rb +1 -1
- data/lib/puppet/type.rb +2 -4
- data/lib/puppet/type/exec.rb +7 -3
- data/lib/puppet/type/file.rb +1 -2
- data/lib/puppet/type/file/data_sync.rb +5 -1
- data/lib/puppet/type/group.rb +4 -2
- data/lib/puppet/type/notify.rb +3 -2
- data/lib/puppet/type/package.rb +10 -3
- data/lib/puppet/type/schedule.rb +1 -1
- data/lib/puppet/type/service.rb +1 -1
- data/lib/puppet/type/user.rb +4 -2
- data/lib/puppet/util.rb +35 -12
- data/lib/puppet/util/command_line/trollop.rb +1 -1
- data/lib/puppet/util/http_proxy.rb +8 -14
- data/lib/puppet/util/log.rb +2 -2
- data/lib/puppet/util/log/destinations.rb +2 -2
- data/lib/puppet/util/logging.rb +32 -20
- data/lib/puppet/util/metric.rb +2 -2
- data/lib/puppet/util/provider_features.rb +2 -4
- data/lib/puppet/util/rdoc.rb +1 -1
- data/lib/puppet/util/reference.rb +1 -1
- data/lib/puppet/util/resource_template.rb +1 -1
- data/lib/puppet/util/selinux.rb +3 -1
- data/lib/puppet/util/windows/adsi.rb +48 -18
- data/lib/puppet/util/windows/registry.rb +7 -5
- data/lib/puppet/vendor.rb +1 -1
- data/lib/puppet/version.rb +1 -1
- data/lib/puppet/x509/cert_provider.rb +13 -6
- data/locales/puppet.pot +199 -159
- data/man/man5/puppet.conf.5 +35 -5
- data/man/man8/puppet-agent.8 +1 -1
- data/man/man8/puppet-apply.8 +1 -1
- data/man/man8/puppet-catalog.8 +1 -1
- data/man/man8/puppet-config.8 +1 -1
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +1 -1
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +1 -1
- data/man/man8/puppet-facts.8 +1 -1
- data/man/man8/puppet-filebucket.8 +1 -1
- data/man/man8/puppet-generate.8 +1 -1
- data/man/man8/puppet-help.8 +1 -1
- data/man/man8/puppet-key.8 +1 -1
- data/man/man8/puppet-lookup.8 +1 -1
- data/man/man8/puppet-man.8 +1 -1
- data/man/man8/puppet-module.8 +1 -1
- data/man/man8/puppet-node.8 +1 -1
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +1 -1
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-script.8 +1 -1
- data/man/man8/puppet-ssl.8 +1 -1
- data/man/man8/puppet-status.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/fixtures/unit/provider/package/dnfmodule/dnf-module-list-installed.txt +11 -0
- data/spec/integration/configurer_spec.rb +52 -0
- data/spec/integration/type/notify_spec.rb +46 -0
- data/spec/lib/puppet/certificate_factory.rb +2 -2
- data/spec/spec_helper.rb +28 -0
- data/spec/unit/application/ssl_spec.rb +4 -7
- data/spec/unit/configurer_spec.rb +394 -398
- data/spec/unit/defaults_spec.rb +4 -4
- data/spec/unit/forge/forge_spec.rb +1 -3
- data/spec/unit/forge/repository_spec.rb +1 -3
- data/spec/unit/indirector/resource/ral_spec.rb +4 -4
- data/spec/unit/network/http/connection_spec.rb +119 -145
- data/spec/unit/parser/scope_spec.rb +10 -0
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +8 -3
- data/spec/unit/pops/loaders/module_loaders_spec.rb +37 -0
- data/spec/unit/provider/exec_spec.rb +209 -0
- data/spec/unit/provider/package/dnfmodule_spec.rb +186 -0
- data/spec/unit/provider/package/dpkg_spec.rb +238 -78
- data/spec/unit/provider/package/pip_spec.rb +51 -6
- data/spec/unit/provider/package/portage_spec.rb +4 -4
- data/spec/unit/provider/package_targetable_spec.rb +60 -0
- data/spec/unit/provider/service/daemontools_spec.rb +24 -0
- data/spec/unit/provider/service/runit_spec.rb +24 -0
- data/spec/unit/provider/service/systemd_spec.rb +25 -25
- data/spec/unit/provider/user/hpux_spec.rb +2 -2
- data/spec/unit/provider/user/useradd_spec.rb +46 -0
- data/spec/unit/ssl/host_spec.rb +0 -5
- data/spec/unit/ssl/state_machine_spec.rb +0 -6
- data/spec/unit/transaction_spec.rb +46 -0
- data/spec/unit/type/exec_spec.rb +6 -12
- data/spec/unit/type/file/content_spec.rb +9 -3
- data/spec/unit/type/file_spec.rb +9 -4
- data/spec/unit/type/package_spec.rb +5 -0
- data/spec/unit/util/execution_spec.rb +16 -0
- data/spec/unit/util/http_proxy_spec.rb +118 -27
- data/spec/unit/util/log/destinations_spec.rb +7 -3
- data/spec/unit/util/log_spec.rb +0 -138
- data/spec/unit/util/logging_spec.rb +200 -0
- data/spec/unit/util/windows/adsi_spec.rb +51 -0
- data/spec/unit/x509/cert_provider_spec.rb +24 -4
- data/tasks/manpages.rake +1 -0
- metadata +12 -10
- data/lib/puppet/pops/loader/null_loader.rb +0 -60
- data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_get/should_yield_to_the_block.yml +0 -24
- data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_head/should_yield_to_the_block.yml +0 -24
- 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 '
|
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
|
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 '
|
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
|
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
|
data/tasks/manpages.rake
CHANGED
@@ -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
|
+
version: 6.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet Labs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: facter
|
@@ -827,7 +827,6 @@ files:
|
|
827
827
|
- lib/puppet/pops/loader/loader.rb
|
828
828
|
- lib/puppet/pops/loader/loader_paths.rb
|
829
829
|
- lib/puppet/pops/loader/module_loaders.rb
|
830
|
-
- lib/puppet/pops/loader/null_loader.rb
|
831
830
|
- lib/puppet/pops/loader/predefined_loader.rb
|
832
831
|
- lib/puppet/pops/loader/puppet_function_instantiator.rb
|
833
832
|
- lib/puppet/pops/loader/puppet_plan_instantiator.rb
|
@@ -994,6 +993,7 @@ files:
|
|
994
993
|
- lib/puppet/provider/package/aptrpm.rb
|
995
994
|
- lib/puppet/provider/package/blastwave.rb
|
996
995
|
- lib/puppet/provider/package/dnf.rb
|
996
|
+
- lib/puppet/provider/package/dnfmodule.rb
|
997
997
|
- lib/puppet/provider/package/dpkg.rb
|
998
998
|
- lib/puppet/provider/package/fink.rb
|
999
999
|
- lib/puppet/provider/package/freebsd.rb
|
@@ -1664,6 +1664,7 @@ files:
|
|
1664
1664
|
- spec/fixtures/unit/provider/cron/crontab/vixie_header.txt
|
1665
1665
|
- spec/fixtures/unit/provider/cron/parsed/managed
|
1666
1666
|
- spec/fixtures/unit/provider/cron/parsed/simple
|
1667
|
+
- spec/fixtures/unit/provider/package/dnfmodule/dnf-module-list-installed.txt
|
1667
1668
|
- spec/fixtures/unit/provider/package/gem/gem-list-single-package
|
1668
1669
|
- spec/fixtures/unit/provider/package/gem/line-with-1.8.5-warning
|
1669
1670
|
- spec/fixtures/unit/provider/package/openbsd/pkginfo.detail
|
@@ -1714,9 +1715,6 @@ files:
|
|
1714
1715
|
- spec/fixtures/unit/util/filetype/suntab_output
|
1715
1716
|
- spec/fixtures/unit/util/monkey_patches/x509.pem
|
1716
1717
|
- spec/fixtures/unit/util/rdoc/basic.pp
|
1717
|
-
- spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_get/should_yield_to_the_block.yml
|
1718
|
-
- spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_head/should_yield_to_the_block.yml
|
1719
|
-
- spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_post/should_yield_to_the_block.yml
|
1720
1718
|
- spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_fetch_if_not_on_the_local_disk.yml
|
1721
1719
|
- 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
|
1722
1720
|
- spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_update_if_content_differs_on_disk.yml
|
@@ -1790,6 +1788,7 @@ files:
|
|
1790
1788
|
- spec/integration/transaction_spec.rb
|
1791
1789
|
- spec/integration/type/exec_spec.rb
|
1792
1790
|
- spec/integration/type/file_spec.rb
|
1791
|
+
- spec/integration/type/notify_spec.rb
|
1793
1792
|
- spec/integration/type/package_spec.rb
|
1794
1793
|
- spec/integration/type/tidy_spec.rb
|
1795
1794
|
- spec/integration/type_spec.rb
|
@@ -2319,6 +2318,7 @@ files:
|
|
2319
2318
|
- spec/unit/provider/package/aptrpm_spec.rb
|
2320
2319
|
- spec/unit/provider/package/base_spec.rb
|
2321
2320
|
- spec/unit/provider/package/dnf_spec.rb
|
2321
|
+
- spec/unit/provider/package/dnfmodule_spec.rb
|
2322
2322
|
- spec/unit/provider/package/dpkg_spec.rb
|
2323
2323
|
- spec/unit/provider/package/freebsd_spec.rb
|
2324
2324
|
- spec/unit/provider/package/gem_spec.rb
|
@@ -2348,6 +2348,7 @@ files:
|
|
2348
2348
|
- spec/unit/provider/package/windows_spec.rb
|
2349
2349
|
- spec/unit/provider/package/yum_spec.rb
|
2350
2350
|
- spec/unit/provider/package/zypper_spec.rb
|
2351
|
+
- spec/unit/provider/package_targetable_spec.rb
|
2351
2352
|
- spec/unit/provider/parsedfile_spec.rb
|
2352
2353
|
- spec/unit/provider/service/base_spec.rb
|
2353
2354
|
- spec/unit/provider/service/bsd_spec.rb
|
@@ -2574,7 +2575,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
2574
2575
|
- !ruby/object:Gem::Version
|
2575
2576
|
version: 1.3.1
|
2576
2577
|
requirements: []
|
2577
|
-
rubygems_version: 3.0.
|
2578
|
+
rubygems_version: 3.0.6
|
2578
2579
|
signing_key:
|
2579
2580
|
specification_version: 4
|
2580
2581
|
summary: Puppet, an automated configuration management tool
|
@@ -2900,6 +2901,7 @@ test_files:
|
|
2900
2901
|
- spec/fixtures/unit/provider/cron/crontab/vixie_header.txt
|
2901
2902
|
- spec/fixtures/unit/provider/cron/parsed/managed
|
2902
2903
|
- spec/fixtures/unit/provider/cron/parsed/simple
|
2904
|
+
- spec/fixtures/unit/provider/package/dnfmodule/dnf-module-list-installed.txt
|
2903
2905
|
- spec/fixtures/unit/provider/package/gem/gem-list-single-package
|
2904
2906
|
- spec/fixtures/unit/provider/package/gem/line-with-1.8.5-warning
|
2905
2907
|
- spec/fixtures/unit/provider/package/openbsd/pkginfo.detail
|
@@ -2950,9 +2952,6 @@ test_files:
|
|
2950
2952
|
- spec/fixtures/unit/util/filetype/suntab_output
|
2951
2953
|
- spec/fixtures/unit/util/monkey_patches/x509.pem
|
2952
2954
|
- spec/fixtures/unit/util/rdoc/basic.pp
|
2953
|
-
- spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_get/should_yield_to_the_block.yml
|
2954
|
-
- spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_head/should_yield_to_the_block.yml
|
2955
|
-
- spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_post/should_yield_to_the_block.yml
|
2956
2955
|
- spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_fetch_if_not_on_the_local_disk.yml
|
2957
2956
|
- 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
|
2958
2957
|
- spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_update_if_content_differs_on_disk.yml
|
@@ -3026,6 +3025,7 @@ test_files:
|
|
3026
3025
|
- spec/integration/transaction_spec.rb
|
3027
3026
|
- spec/integration/type/exec_spec.rb
|
3028
3027
|
- spec/integration/type/file_spec.rb
|
3028
|
+
- spec/integration/type/notify_spec.rb
|
3029
3029
|
- spec/integration/type/package_spec.rb
|
3030
3030
|
- spec/integration/type/tidy_spec.rb
|
3031
3031
|
- spec/integration/type_spec.rb
|
@@ -3555,6 +3555,7 @@ test_files:
|
|
3555
3555
|
- spec/unit/provider/package/aptrpm_spec.rb
|
3556
3556
|
- spec/unit/provider/package/base_spec.rb
|
3557
3557
|
- spec/unit/provider/package/dnf_spec.rb
|
3558
|
+
- spec/unit/provider/package/dnfmodule_spec.rb
|
3558
3559
|
- spec/unit/provider/package/dpkg_spec.rb
|
3559
3560
|
- spec/unit/provider/package/freebsd_spec.rb
|
3560
3561
|
- spec/unit/provider/package/gem_spec.rb
|
@@ -3584,6 +3585,7 @@ test_files:
|
|
3584
3585
|
- spec/unit/provider/package/windows_spec.rb
|
3585
3586
|
- spec/unit/provider/package/yum_spec.rb
|
3586
3587
|
- spec/unit/provider/package/zypper_spec.rb
|
3588
|
+
- spec/unit/provider/package_targetable_spec.rb
|
3587
3589
|
- spec/unit/provider/parsedfile_spec.rb
|
3588
3590
|
- spec/unit/provider/service/base_spec.rb
|
3589
3591
|
- spec/unit/provider/service/bsd_spec.rb
|