puppet 6.4.5-x64-mingw32 → 6.5.0-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.
- checksums.yaml +4 -4
- data/CODEOWNERS +10 -10
- data/Gemfile +6 -6
- data/Gemfile.lock +46 -52
- data/ext/build_defaults.yaml +0 -1
- data/ext/project_data.yaml +3 -3
- data/ext/regexp_nodes/regexp_nodes.rb +4 -4
- data/ext/solaris/smf/puppet.xml +0 -2
- data/ext/windows/eventlog/Rakefile +32 -0
- data/ext/windows/eventlog/puppetres.dll +0 -0
- data/ext/windows/eventlog/puppetres.mc +18 -0
- data/ext/windows/service/daemon.rb +8 -38
- data/install.rb +24 -6
- data/lib/puppet.rb +3 -1
- data/lib/puppet/application.rb +1 -1
- data/lib/puppet/application/agent.rb +11 -34
- data/lib/puppet/application/apply.rb +6 -6
- data/lib/puppet/application/describe.rb +9 -3
- data/lib/puppet/application/device.rb +4 -14
- data/lib/puppet/application/doc.rb +1 -1
- data/lib/puppet/application/lookup.rb +2 -2
- data/lib/puppet/application/resource.rb +4 -4
- data/lib/puppet/application/script.rb +2 -2
- data/lib/puppet/application/ssl.rb +10 -9
- data/lib/puppet/configurer.rb +30 -86
- data/lib/puppet/configurer/downloader.rb +6 -2
- data/lib/puppet/defaults.rb +50 -44
- data/lib/puppet/error.rb +14 -9
- data/lib/puppet/face/catalog.rb +20 -1
- data/lib/puppet/face/config.rb +48 -10
- data/lib/puppet/face/facts.rb +1 -1
- data/lib/puppet/face/help.rb +1 -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/face/parser.rb +48 -9
- data/lib/puppet/face/plugin.rb +2 -9
- data/lib/puppet/file_serving/http_metadata.rb +1 -1
- data/lib/puppet/file_system.rb +12 -2
- data/lib/puppet/file_system/file_impl.rb +6 -3
- data/lib/puppet/file_system/memory_file.rb +1 -1
- data/lib/puppet/file_system/posix.rb +2 -3
- data/lib/puppet/forge.rb +3 -3
- data/lib/puppet/functions.rb +2 -1
- 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/functions/regsubst.rb +6 -8
- 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 +3 -4
- data/lib/puppet/indirector/catalog/compiler.rb +5 -11
- data/lib/puppet/indirector/file_bucket_file/file.rb +1 -1
- data/lib/puppet/indirector/hiera.rb +0 -2
- data/lib/puppet/indirector/resource/ral.rb +3 -1
- data/lib/puppet/indirector/resource/validator.rb +1 -1
- data/lib/puppet/interface.rb +1 -2
- data/lib/puppet/loaders.rb +1 -0
- data/lib/puppet/metatype/manager.rb +1 -1
- data/lib/puppet/module.rb +1 -1
- data/lib/puppet/module/task.rb +4 -20
- 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 +2 -12
- data/lib/puppet/network/http/api/indirected_routes.rb +11 -12
- data/lib/puppet/network/http/connection.rb +12 -10
- data/lib/puppet/network/http/factory.rb +11 -1
- data/lib/puppet/network/http/pool.rb +0 -2
- data/lib/puppet/network/http/site.rb +1 -1
- data/lib/puppet/network/resolver.rb +2 -2
- data/lib/puppet/node/environment.rb +2 -4
- 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/fail.rb +8 -1
- data/lib/puppet/parser/functions/inline_epp.rb +5 -5
- data/lib/puppet/parser/scope.rb +7 -8
- 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 +2 -3
- data/lib/puppet/pops/evaluator/runtime3_support.rb +4 -4
- data/lib/puppet/pops/loader/null_loader.rb +60 -0
- data/lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb +6 -4
- data/lib/puppet/pops/loader/task_instantiator.rb +0 -4
- data/lib/puppet/pops/loaders.rb +1 -1
- data/lib/puppet/pops/lookup/hiera_config.rb +0 -1
- data/lib/puppet/pops/lookup/sub_lookup.rb +1 -1
- data/lib/puppet/pops/merge_strategy.rb +18 -22
- 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 +16 -17
- data/lib/puppet/pops/puppet_stack.rb +49 -51
- 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 +6 -5
- data/lib/puppet/property.rb +1 -1
- data/lib/puppet/property/ensure.rb +1 -1
- data/lib/puppet/provider/exec.rb +2 -6
- data/lib/puppet/provider/file/posix.rb +0 -5
- data/lib/puppet/provider/nameservice.rb +3 -10
- data/lib/puppet/provider/nameservice/directoryservice.rb +1 -1
- data/lib/puppet/provider/nameservice/pw.rb +2 -2
- data/lib/puppet/provider/package.rb +0 -2
- data/lib/puppet/provider/package/apt.rb +1 -5
- data/lib/puppet/provider/package/dnf.rb +1 -1
- data/lib/puppet/provider/package/dpkg.rb +18 -34
- data/lib/puppet/provider/package/openbsd.rb +1 -1
- data/lib/puppet/provider/package/pip.rb +13 -37
- data/lib/puppet/provider/package/portage.rb +4 -4
- data/lib/puppet/provider/package/puppet_gem.rb +1 -1
- data/lib/puppet/provider/package/rpm.rb +18 -56
- data/lib/puppet/provider/package/windows/package.rb +1 -1
- data/lib/puppet/provider/package/yum.rb +5 -9
- data/lib/puppet/provider/package_targetable.rb +4 -7
- data/lib/puppet/provider/parsedfile.rb +1 -1
- data/lib/puppet/provider/service/daemontools.rb +9 -9
- data/lib/puppet/provider/service/launchd.rb +5 -20
- 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 +8 -2
- data/lib/puppet/provider/service/systemd.rb +19 -14
- data/lib/puppet/provider/service/windows.rb +0 -8
- data/lib/puppet/provider/user/directoryservice.rb +1 -1
- data/lib/puppet/provider/user/hpux.rb +1 -1
- data/lib/puppet/provider/user/pw.rb +3 -12
- data/lib/puppet/provider/user/user_role_add.rb +1 -5
- data/lib/puppet/provider/user/useradd.rb +20 -45
- data/lib/puppet/provider/user/windows_adsi.rb +5 -4
- data/lib/puppet/reference/configuration.rb +3 -3
- data/lib/puppet/reference/indirection.rb +2 -2
- data/lib/puppet/reference/metaparameter.rb +3 -1
- data/lib/puppet/reference/providers.rb +3 -1
- data/lib/puppet/reference/type.rb +9 -3
- data/lib/puppet/reports.rb +1 -1
- data/lib/puppet/resource.rb +1 -18
- data/lib/puppet/resource/catalog.rb +1 -1
- data/lib/puppet/rest/routes.rb +30 -17
- data/lib/puppet/settings.rb +3 -43
- data/lib/puppet/settings/environment_conf.rb +0 -1
- data/lib/puppet/ssl/certificate_request.rb +12 -2
- data/lib/puppet/ssl/host.rb +2 -2
- data/lib/puppet/ssl/oids.rb +1 -1
- data/lib/puppet/ssl/ssl_provider.rb +11 -5
- data/lib/puppet/ssl/state_machine.rb +102 -98
- data/lib/puppet/test/test_helper.rb +1 -0
- data/lib/puppet/transaction.rb +11 -33
- data/lib/puppet/transaction/report.rb +1 -1
- data/lib/puppet/type.rb +4 -2
- data/lib/puppet/type/exec.rb +17 -23
- data/lib/puppet/type/file.rb +39 -11
- data/lib/puppet/type/file/data_sync.rb +1 -5
- data/lib/puppet/type/group.rb +2 -4
- data/lib/puppet/type/notify.rb +3 -4
- data/lib/puppet/type/package.rb +3 -20
- data/lib/puppet/type/schedule.rb +1 -1
- data/lib/puppet/type/service.rb +3 -8
- data/lib/puppet/type/user.rb +2 -4
- data/lib/puppet/util.rb +29 -39
- data/lib/puppet/util/command_line/trollop.rb +1 -1
- data/lib/puppet/util/execution.rb +3 -4
- data/lib/puppet/util/http_proxy.rb +19 -27
- data/lib/puppet/util/log.rb +2 -2
- data/lib/puppet/util/log/destinations.rb +2 -2
- data/lib/puppet/util/logging.rb +20 -32
- data/lib/puppet/util/metric.rb +2 -2
- data/lib/puppet/util/monkey_patches.rb +33 -0
- data/lib/puppet/util/pidlock.rb +2 -3
- data/lib/puppet/util/provider_features.rb +4 -2
- 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 +2 -8
- data/lib/puppet/util/skip_tags.rb +4 -0
- data/lib/puppet/util/windows/adsi.rb +18 -48
- data/lib/puppet/util/windows/process.rb +8 -8
- data/lib/puppet/util/windows/registry.rb +5 -7
- data/lib/puppet/util/windows/security.rb +0 -2
- data/lib/puppet/util/windows/service.rb +4 -149
- data/lib/puppet/util/windows/sid.rb +0 -1
- data/lib/puppet/vendor.rb +1 -1
- data/lib/puppet/version.rb +1 -1
- data/lib/puppet/x509/cert_provider.rb +81 -24
- data/locales/puppet.pot +462 -482
- data/man/man5/puppet.conf.5 +43 -44
- data/man/man8/puppet-agent.8 +1 -1
- data/man/man8/puppet-apply.8 +3 -3
- data/man/man8/puppet-catalog.8 +31 -3
- 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 +3 -3
- data/spec/fixtures/ssl/127.0.0.1-key.pem +56 -56
- data/spec/fixtures/ssl/127.0.0.1.pem +27 -27
- data/spec/fixtures/ssl/bad-basic-constraints.pem +32 -32
- data/spec/fixtures/ssl/bad-int-basic-constraints.pem +30 -30
- data/spec/fixtures/ssl/ca.pem +30 -30
- data/spec/fixtures/ssl/crl.pem +15 -15
- data/spec/fixtures/ssl/ec-key.pem +18 -0
- data/spec/fixtures/ssl/ec.pem +40 -0
- data/spec/fixtures/ssl/encrypted-ec-key.pem +21 -0
- data/spec/fixtures/ssl/encrypted-key.pem +57 -57
- data/spec/fixtures/ssl/intermediate-agent-crl.pem +16 -16
- data/spec/fixtures/ssl/intermediate-agent.pem +33 -33
- data/spec/fixtures/ssl/intermediate-crl.pem +17 -17
- data/spec/fixtures/ssl/intermediate.pem +31 -31
- data/spec/fixtures/ssl/pluto-key.pem +56 -56
- data/spec/fixtures/ssl/pluto.pem +28 -28
- data/spec/fixtures/ssl/request-key.pem +56 -56
- data/spec/fixtures/ssl/request.pem +24 -24
- data/spec/fixtures/ssl/revoked-key.pem +56 -56
- data/spec/fixtures/ssl/revoked.pem +25 -25
- data/spec/fixtures/ssl/signed-key.pem +56 -56
- data/spec/fixtures/ssl/signed.pem +25 -25
- data/spec/fixtures/ssl/tampered-cert.pem +27 -27
- data/spec/fixtures/ssl/tampered-csr.pem +24 -24
- data/spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/lib/puppet/parser/functions/func_with_syntax_error.rb +9 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_get/should_yield_to_the_block.yml +24 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_head/should_yield_to_the_block.yml +24 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_post/should_yield_to_the_block.yml +24 -0
- data/spec/integration/configurer_spec.rb +0 -52
- data/spec/integration/provider/service/init_spec.rb +1 -0
- data/spec/integration/provider/service/systemd_spec.rb +5 -8
- data/spec/integration/type/file_spec.rb +38 -28
- data/spec/integration/util/execution_spec.rb +0 -27
- data/spec/lib/puppet/certificate_factory.rb +2 -2
- data/spec/lib/puppet/test_ca.rb +17 -4
- data/spec/lib/puppet_spec/fixtures.rb +4 -0
- data/spec/spec_helper.rb +0 -28
- data/spec/unit/application/agent_spec.rb +34 -67
- data/spec/unit/application/device_spec.rb +1 -27
- data/spec/unit/application/ssl_spec.rb +60 -35
- data/spec/unit/configurer_spec.rb +399 -395
- data/spec/unit/defaults_spec.rb +4 -4
- data/spec/unit/face/facts_spec.rb +0 -9
- data/spec/unit/face/parser_spec.rb +69 -22
- data/spec/unit/face/plugin_spec.rb +0 -8
- data/spec/unit/file_system_spec.rb +30 -1
- data/spec/unit/forge/forge_spec.rb +3 -1
- data/spec/unit/forge/repository_spec.rb +3 -1
- data/spec/unit/indirector/catalog/compiler_spec.rb +5 -62
- data/spec/unit/indirector/resource/ral_spec.rb +4 -4
- data/spec/unit/module_tool/tar/mini_spec.rb +1 -1
- data/spec/unit/network/http/api/indirected_routes_spec.rb +10 -25
- data/spec/unit/network/http/connection_spec.rb +145 -119
- data/spec/unit/network/http/factory_spec.rb +5 -27
- data/spec/unit/parser/scope_spec.rb +0 -10
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +3 -8
- data/spec/unit/pops/loaders/loaders_spec.rb +4 -0
- data/spec/unit/pops/loaders/module_loaders_spec.rb +0 -37
- data/spec/unit/pops/types/types_spec.rb +27 -0
- data/spec/unit/provider/exec_spec.rb +0 -209
- data/spec/unit/provider/package/aptrpm_spec.rb +1 -1
- data/spec/unit/provider/package/dnf_spec.rb +0 -7
- data/spec/unit/provider/package/dpkg_spec.rb +80 -240
- data/spec/unit/provider/package/pip_spec.rb +8 -61
- data/spec/unit/provider/package/portage_spec.rb +4 -4
- data/spec/unit/provider/package/rpm_spec.rb +16 -150
- data/spec/unit/provider/package/yum_spec.rb +0 -7
- data/spec/unit/provider/service/daemontools_spec.rb +0 -24
- data/spec/unit/provider/service/launchd_spec.rb +0 -28
- data/spec/unit/provider/service/runit_spec.rb +0 -24
- data/spec/unit/provider/service/systemd_spec.rb +25 -39
- data/spec/unit/provider/service/windows_spec.rb +0 -20
- data/spec/unit/provider/user/hpux_spec.rb +2 -2
- data/spec/unit/provider/user/pw_spec.rb +0 -37
- data/spec/unit/provider/user/useradd_spec.rb +0 -88
- data/spec/unit/resource_spec.rb +1 -26
- data/spec/unit/ssl/host_spec.rb +5 -0
- data/spec/unit/ssl/ssl_provider_spec.rb +36 -11
- data/spec/unit/ssl/state_machine_spec.rb +233 -158
- data/spec/unit/transaction_spec.rb +0 -64
- data/spec/unit/type/exec_spec.rb +12 -15
- data/spec/unit/type/file/content_spec.rb +3 -9
- data/spec/unit/type/file/source_spec.rb +4 -4
- data/spec/unit/type/file_spec.rb +15 -11
- data/spec/unit/type/package_spec.rb +0 -5
- data/spec/unit/type/schedule_spec.rb +1 -3
- data/spec/unit/type/service_spec.rb +0 -16
- data/spec/unit/util/execution_spec.rb +0 -16
- data/spec/unit/util/http_proxy_spec.rb +21 -151
- data/spec/unit/util/ldap/manager_spec.rb +0 -15
- data/spec/unit/util/log/destinations_spec.rb +3 -7
- data/spec/unit/util/log_spec.rb +138 -0
- data/spec/unit/util/logging_spec.rb +0 -200
- data/spec/unit/util/pidlock_spec.rb +0 -26
- data/spec/unit/util/skip_tags_spec.rb +14 -0
- data/spec/unit/util/windows/adsi_spec.rb +0 -51
- data/spec/unit/util/windows/service_spec.rb +0 -9
- data/spec/unit/util_spec.rb +10 -0
- data/spec/unit/x509/cert_provider_spec.rb +82 -43
- data/tasks/generate_cert_fixtures.rake +13 -1
- data/tasks/manpages.rake +0 -1
- metadata +28 -22
- data/ext/cert_inspector +0 -140
- data/ext/envpuppet +0 -139
- data/ext/envpuppet.bat +0 -14
- data/ext/puppet-test +0 -476
- data/ext/pure_ruby_dsl/dsl_test.rb +0 -7
- data/ext/upload_facts.rb +0 -119
- data/lib/puppet/provider/package/dnfmodule.rb +0 -87
- data/spec/fixtures/unit/provider/package/dnfmodule/dnf-module-list-installed.txt +0 -11
- data/spec/integration/type/notify_spec.rb +0 -46
- data/spec/unit/provider/package/dnfmodule_spec.rb +0 -186
- data/spec/unit/provider/package_targetable_spec.rb +0 -60
@@ -532,21 +532,6 @@ describe Puppet::Util::Ldap::Manager, :if => Puppet.features.ldap? do
|
|
532
532
|
@manager.update(@name, @is, @should)
|
533
533
|
end
|
534
534
|
|
535
|
-
it "should convert the property names to strings" do
|
536
|
-
expect(@manager).to receive(:create).with(anything, hash_including("uno" => ["yay"]))
|
537
|
-
@manager.update(@name, @is, @should)
|
538
|
-
end
|
539
|
-
|
540
|
-
it "should convert the property values to arrays if necessary" do
|
541
|
-
expect(@manager).to receive(:create).with(anything, hash_including("uno" => ["yay"]))
|
542
|
-
@manager.update(@name, @is, @should)
|
543
|
-
end
|
544
|
-
|
545
|
-
it "should convert the property values to strings if necessary" do
|
546
|
-
expect(@manager).to receive(:create).with(anything, hash_including("uno" => ["yay"]))
|
547
|
-
@manager.update(@name, @is, @should)
|
548
|
-
end
|
549
|
-
|
550
535
|
it "should not include :ensure in the properties sent" do
|
551
536
|
expect(@manager).to receive(:create).with(anything, hash_excluding(:ensure))
|
552
537
|
@manager.update(@name, @is, @should)
|
@@ -46,15 +46,13 @@ describe Puppet::Util::Log.desttypes[:file] do
|
|
46
46
|
|
47
47
|
describe "on POSIX systems", :if => Puppet.features.posix? do
|
48
48
|
describe "with a normal file" do
|
49
|
-
let (:parent) { Pathname.new('/tmp') }
|
50
49
|
let (:abspath) { '/tmp/log' }
|
51
50
|
let (:relpath) { 'log' }
|
52
51
|
|
53
52
|
it_behaves_like "file destination"
|
54
53
|
|
55
54
|
it "logs an error if it can't chown the file owner & group" do
|
56
|
-
|
57
|
-
expect(File).to receive(:exist?).with(Pathname.new(abspath)).and_return(false)
|
55
|
+
expect(File).to receive(:exists?).with(abspath).and_return(false)
|
58
56
|
expect(FileUtils).to receive(:chown).with(Puppet[:user], Puppet[:group], abspath).and_raise(Errno::EPERM)
|
59
57
|
expect(Puppet.features).to receive(:root?).and_return(true)
|
60
58
|
expect(Puppet).to receive(:err).with("Unable to set ownership to #{Puppet[:user]}:#{Puppet[:group]} for log file: #{abspath}")
|
@@ -63,8 +61,7 @@ describe Puppet::Util::Log.desttypes[:file] do
|
|
63
61
|
end
|
64
62
|
|
65
63
|
it "doesn't attempt to chown when running as non-root" do
|
66
|
-
|
67
|
-
expect(File).to receive(:exist?).with(Pathname.new(abspath)).and_return(false)
|
64
|
+
expect(File).to receive(:exists?).with(abspath).and_return(false)
|
68
65
|
expect(FileUtils).not_to receive(:chown).with(Puppet[:user], Puppet[:group], abspath)
|
69
66
|
expect(Puppet.features).to receive(:root?).and_return(false)
|
70
67
|
|
@@ -72,8 +69,7 @@ describe Puppet::Util::Log.desttypes[:file] do
|
|
72
69
|
end
|
73
70
|
|
74
71
|
it "doesn't attempt to chown when file already exists" do
|
75
|
-
|
76
|
-
expect(File).to receive(:exist?).with(Pathname.new(abspath)).and_return(true)
|
72
|
+
expect(File).to receive(:exists?).with(abspath).and_return(true)
|
77
73
|
expect(FileUtils).not_to receive(:chown).with(Puppet[:user], Puppet[:group], abspath)
|
78
74
|
expect(Puppet.features).to receive(:root?).and_return(true)
|
79
75
|
|
data/spec/unit/util/log_spec.rb
CHANGED
@@ -177,6 +177,144 @@ describe Puppet::Util::Log do
|
|
177
177
|
|
178
178
|
expect(logs.collect(&:message)).to include("Inner block", "Outer block")
|
179
179
|
end
|
180
|
+
|
181
|
+
it 'includes backtrace for RuntimeError in log message when trace option is passed' do
|
182
|
+
logs = []
|
183
|
+
destination = Puppet::Test::LogCollector.new(logs)
|
184
|
+
|
185
|
+
Puppet::Util::Log.newdestination(destination)
|
186
|
+
Puppet::Util::Log.with_destination(destination) do
|
187
|
+
begin
|
188
|
+
raise RuntimeError, 'Oops'
|
189
|
+
rescue RuntimeError => e
|
190
|
+
Puppet.log_exception(e, :default, :trace => true)
|
191
|
+
end
|
192
|
+
end
|
193
|
+
expect(logs.size).to eq(1)
|
194
|
+
log = logs[0]
|
195
|
+
expect(log.message).to match('/log_spec.rb')
|
196
|
+
expect(log.backtrace).to be_nil
|
197
|
+
end
|
198
|
+
|
199
|
+
context "global options" do
|
200
|
+
around :each do |example|
|
201
|
+
Puppet[:trace] = true
|
202
|
+
example.run
|
203
|
+
Puppet[:trace] = false
|
204
|
+
end
|
205
|
+
|
206
|
+
it 'includes backtrace for RuntimeError in log message when trace is enabled globally' do
|
207
|
+
logs = []
|
208
|
+
destination = Puppet::Test::LogCollector.new(logs)
|
209
|
+
|
210
|
+
Puppet::Util::Log.newdestination(destination)
|
211
|
+
Puppet::Util::Log.with_destination(destination) do
|
212
|
+
begin
|
213
|
+
raise RuntimeError, 'Oops'
|
214
|
+
rescue RuntimeError => e
|
215
|
+
Puppet.log_exception(e, :default)
|
216
|
+
end
|
217
|
+
end
|
218
|
+
expect(logs.size).to eq(1)
|
219
|
+
log = logs[0]
|
220
|
+
expect(log.message).to match('/log_spec.rb')
|
221
|
+
expect(log.backtrace).to be_nil
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
it 'excludes backtrace for RuntimeError in log message when trace is disabled' do
|
226
|
+
logs = []
|
227
|
+
destination = Puppet::Test::LogCollector.new(logs)
|
228
|
+
|
229
|
+
Puppet::Util::Log.newdestination(destination)
|
230
|
+
Puppet::Util::Log.with_destination(destination) do
|
231
|
+
begin
|
232
|
+
raise RuntimeError, 'Oops'
|
233
|
+
rescue RuntimeError => e
|
234
|
+
Puppet.log_exception(e)
|
235
|
+
end
|
236
|
+
end
|
237
|
+
expect(logs.size).to eq(1)
|
238
|
+
log = logs[0]
|
239
|
+
expect(log.message).to_not match('/log_spec.rb')
|
240
|
+
expect(log.backtrace).to be_nil
|
241
|
+
end
|
242
|
+
|
243
|
+
it "backtrace is Array in 'backtrace' and excluded from 'message' when logging ParseErrorWithIssue with trace enabled" do
|
244
|
+
logs = []
|
245
|
+
destination = Puppet::Test::LogCollector.new(logs)
|
246
|
+
|
247
|
+
Puppet::Util::Log.newdestination(destination)
|
248
|
+
Puppet::Util::Log.with_destination(destination) do
|
249
|
+
begin
|
250
|
+
raise Puppet::ParseErrorWithIssue.new('Oops', '/tmp/test.pp', 30, 15, nil, :SYNTAX_ERROR)
|
251
|
+
rescue RuntimeError => e
|
252
|
+
Puppet.log_exception(e, :default, :trace => true)
|
253
|
+
end
|
254
|
+
end
|
255
|
+
expect(logs.size).to eq(1)
|
256
|
+
log = logs[0]
|
257
|
+
expect(log.message).to_not match('/log_spec.rb')
|
258
|
+
expect(log.backtrace).to be_a(Array)
|
259
|
+
end
|
260
|
+
|
261
|
+
it "backtrace is excluded when logging ParseErrorWithIssue with trace disabled" do
|
262
|
+
logs = []
|
263
|
+
destination = Puppet::Test::LogCollector.new(logs)
|
264
|
+
|
265
|
+
Puppet::Util::Log.newdestination(destination)
|
266
|
+
Puppet::Util::Log.with_destination(destination) do
|
267
|
+
begin
|
268
|
+
raise Puppet::ParseErrorWithIssue.new('Oops', '/tmp/test.pp', 30, 15, nil, :SYNTAX_ERROR)
|
269
|
+
rescue RuntimeError => e
|
270
|
+
Puppet.log_exception(e)
|
271
|
+
end
|
272
|
+
end
|
273
|
+
expect(logs.size).to eq(1)
|
274
|
+
log = logs[0]
|
275
|
+
expect(log.message).to_not match('/log_spec.rb')
|
276
|
+
expect(log.backtrace).to be_nil
|
277
|
+
end
|
278
|
+
|
279
|
+
it 'includes position details for ParseError in log message' do
|
280
|
+
logs = []
|
281
|
+
destination = Puppet::Test::LogCollector.new(logs)
|
282
|
+
|
283
|
+
Puppet::Util::Log.newdestination(destination)
|
284
|
+
Puppet::Util::Log.with_destination(destination) do
|
285
|
+
begin
|
286
|
+
raise Puppet::ParseError.new('Oops', '/tmp/test.pp', 30, 15)
|
287
|
+
rescue RuntimeError => e
|
288
|
+
Puppet.log_exception(e)
|
289
|
+
end
|
290
|
+
end
|
291
|
+
expect(logs.size).to eq(1)
|
292
|
+
log = logs[0]
|
293
|
+
expect(log.message).to match(/ \(file: \/tmp\/test\.pp, line: 30, column: 15\)/)
|
294
|
+
expect(log.message).to be(log.to_s)
|
295
|
+
end
|
296
|
+
|
297
|
+
it 'excludes position details for ParseErrorWithIssue from log message' do
|
298
|
+
logs = []
|
299
|
+
destination = Puppet::Test::LogCollector.new(logs)
|
300
|
+
|
301
|
+
Puppet::Util::Log.newdestination(destination)
|
302
|
+
Puppet::Util::Log.with_destination(destination) do
|
303
|
+
begin
|
304
|
+
raise Puppet::ParseErrorWithIssue.new('Oops', '/tmp/test.pp', 30, 15, nil, :SYNTAX_ERROR)
|
305
|
+
rescue RuntimeError => e
|
306
|
+
Puppet.log_exception(e)
|
307
|
+
end
|
308
|
+
end
|
309
|
+
expect(logs.size).to eq(1)
|
310
|
+
log = logs[0]
|
311
|
+
expect(log.message).to_not match(/ \(file: \/tmp\/test\.pp, line: 30, column: 15\)/)
|
312
|
+
expect(log.to_s).to match(/ \(file: \/tmp\/test\.pp, line: 30, column: 15\)/)
|
313
|
+
expect(log.issue_code).to eq(:SYNTAX_ERROR)
|
314
|
+
expect(log.file).to eq('/tmp/test.pp')
|
315
|
+
expect(log.line).to eq(30)
|
316
|
+
expect(log.pos).to eq(15)
|
317
|
+
end
|
180
318
|
end
|
181
319
|
|
182
320
|
describe Puppet::Util::Log::DestConsole do
|
@@ -13,39 +13,6 @@ 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
|
-
|
49
16
|
describe Puppet::Util::Logging do
|
50
17
|
before do
|
51
18
|
@logger = LoggingTester.new
|
@@ -373,173 +340,6 @@ original
|
|
373
340
|
.*2\.rb:2:in `b'
|
374
341
|
.*3\.rb:1/)
|
375
342
|
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
|
543
343
|
end
|
544
344
|
|
545
345
|
describe 'when Facter' do
|
@@ -26,18 +26,6 @@ describe Puppet::Util::Pidlock, if: !Puppet::Util::Platform.jruby? do
|
|
26
26
|
allow(Puppet::Util::Windows::Process).to receive(:get_process_image_name_by_pid).with(@lock.lock_pid).and_return('C:\Program Files\Puppet Labs\Puppet\puppet\bin\ruby.exe')
|
27
27
|
else
|
28
28
|
allow(Puppet::Util::Execution).to receive(:execute).with(['ps', '-p', @lock.lock_pid, '-o', 'comm=']).and_return('puppet')
|
29
|
-
allow(Puppet::Util::Execution).to receive(:execute).with(['ps', '-p', @lock.lock_pid, '-o', 'args=']).and_return('puppet')
|
30
|
-
end
|
31
|
-
expect(@lock).to be_locked
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should become locked if puppet is a gem" do
|
35
|
-
@lock.lock
|
36
|
-
unless Puppet::Util::Platform.windows?
|
37
|
-
expect(Puppet::Util::Execution).to receive(:execute).with(['ps', '-p', @lock.lock_pid, '-o', 'comm=']).and_return('ruby')
|
38
|
-
expect(Puppet::Util::Execution).to receive(:execute).with(['ps', '-p', @lock.lock_pid, '-o', 'args=']).and_return('ruby /root/puppet/.bundle/ruby/2.3.0/bin/puppet agent --no-daemonize -v')
|
39
|
-
else
|
40
|
-
allow(Puppet::Util::Windows::Process).to receive(:get_process_image_name_by_pid).with(@lock.lock_pid).and_return('C:\tools\ruby25\bin\ruby.exe')
|
41
29
|
end
|
42
30
|
expect(@lock).to be_locked
|
43
31
|
end
|
@@ -121,18 +109,6 @@ describe Puppet::Util::Pidlock, if: !Puppet::Util::Platform.jruby? do
|
|
121
109
|
allow(Puppet::Util::Windows::Process).to receive(:get_process_image_name_by_pid).with(@lock.lock_pid).and_return('C:\Program Files\Puppet Labs\Puppet\puppet\bin\ruby.exe')
|
122
110
|
else
|
123
111
|
allow(Puppet::Util::Execution).to receive(:execute).with(['ps', '-p', @lock.lock_pid, '-o', 'comm=']).and_return('puppet')
|
124
|
-
allow(Puppet::Util::Execution).to receive(:execute).with(['ps', '-p', @lock.lock_pid, '-o', 'args=']).and_return('puppet')
|
125
|
-
end
|
126
|
-
expect(@lock).to be_locked
|
127
|
-
end
|
128
|
-
|
129
|
-
it "should return true if locked when puppet as gem" do
|
130
|
-
@lock.lock
|
131
|
-
unless Puppet::Util::Platform.windows?
|
132
|
-
expect(Puppet::Util::Execution).to receive(:execute).with(['ps', '-p', @lock.lock_pid, '-o', 'comm=']).and_return('ruby')
|
133
|
-
expect(Puppet::Util::Execution).to receive(:execute).with(['ps', '-p', @lock.lock_pid, '-o', 'args=']).and_return('ruby /root/puppet/.bundle/ruby/2.3.0/bin/puppet agent --no-daemonize -v')
|
134
|
-
else
|
135
|
-
allow(Puppet::Util::Windows::Process).to receive(:get_process_image_name_by_pid).with(@lock.lock_pid).and_return('C:\tools\ruby25\bin\ruby.exe')
|
136
112
|
end
|
137
113
|
expect(@lock).to be_locked
|
138
114
|
end
|
@@ -183,7 +159,6 @@ describe Puppet::Util::Pidlock, if: !Puppet::Util::Platform.jruby? do
|
|
183
159
|
allow(Puppet::Util::Windows::Process).to receive(:get_process_image_name_by_pid).with(6789).and_return('C:\Program Files\Puppet Labs\Puppet\puppet\bin\ruby.exe')
|
184
160
|
else
|
185
161
|
allow(Puppet::Util::Execution).to receive(:execute).with(['ps', '-p', 6789, '-o', 'comm=']).and_return('puppet')
|
186
|
-
allow(Puppet::Util::Execution).to receive(:execute).with(['ps', '-p', 6789, '-o', 'args=']).and_return('puppet')
|
187
162
|
end
|
188
163
|
@lock.lock
|
189
164
|
expect(Puppet::FileSystem.exist?(@lockfile)).to be_truthy
|
@@ -213,7 +188,6 @@ describe Puppet::Util::Pidlock, if: !Puppet::Util::Platform.jruby? do
|
|
213
188
|
allow(Puppet::Util::Windows::Process).to receive(:get_process_image_name_by_pid).with(1234).and_return('C:\Program Files\Puppet Labs\Puppet\puppet\bin\ruby.exe')
|
214
189
|
else
|
215
190
|
allow(Puppet::Util::Execution).to receive(:execute).with(['ps', '-p', 1234, '-o', 'comm=']).and_return('puppet')
|
216
|
-
allow(Puppet::Util::Execution).to receive(:execute).with(['ps', '-p', 1234, '-o', 'args=']).and_return('puppet')
|
217
191
|
end
|
218
192
|
# lock the file
|
219
193
|
@lock.lock
|