puppet 5.5.17-x64-mingw32 → 5.5.22-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 +1 -1
- data/Gemfile +4 -5
- data/Gemfile.lock +59 -55
- 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 +54 -8
- data/install.rb +6 -6
- data/lib/puppet.rb +5 -2
- data/lib/puppet/agent.rb +5 -13
- data/lib/puppet/application.rb +1 -1
- data/lib/puppet/application/agent.rb +3 -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/filebucket.rb +13 -0
- data/lib/puppet/application/lookup.rb +1 -1
- data/lib/puppet/application/script.rb +2 -2
- data/lib/puppet/configurer.rb +106 -31
- data/lib/puppet/configurer/downloader.rb +33 -16
- data/lib/puppet/daemon.rb +1 -1
- data/lib/puppet/defaults.rb +86 -40
- data/lib/puppet/error.rb +9 -1
- data/lib/puppet/external/nagios/base.rb +1 -1
- data/lib/puppet/face/ca.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/file_serving/http_metadata.rb +1 -1
- data/lib/puppet/file_serving/mount/locales.rb +1 -2
- data/lib/puppet/file_serving/mount/pluginfacts.rb +1 -2
- data/lib/puppet/file_serving/mount/plugins.rb +1 -2
- 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/file_system/uniquefile.rb +4 -0
- data/lib/puppet/forge.rb +3 -3
- data/lib/puppet/functions/epp.rb +4 -4
- data/lib/puppet/functions/inline_epp.rb +5 -5
- data/lib/puppet/functions/new.rb +8 -3
- data/lib/puppet/functions/reduce.rb +2 -4
- data/lib/puppet/functions/reverse_each.rb +1 -1
- data/lib/puppet/functions/step.rb +1 -1
- 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 +6 -5
- data/lib/puppet/indirector/catalog/compiler.rb +8 -0
- data/lib/puppet/indirector/file_bucket_file/file.rb +1 -1
- data/lib/puppet/indirector/hiera.rb +6 -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_tool/applications/builder.rb +1 -1
- 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 +13 -12
- data/lib/puppet/network/http/api/master/v3/environment.rb +3 -0
- data/lib/puppet/network/http/connection.rb +14 -12
- data/lib/puppet/network/http/pool.rb +7 -1
- data/lib/puppet/network/http/rack/rest.rb +2 -2
- data/lib/puppet/network/http/site.rb +1 -1
- data/lib/puppet/network/resolver.rb +2 -2
- data/lib/puppet/node/environment.rb +11 -3
- data/lib/puppet/parser/ast.rb +1 -1
- data/lib/puppet/parser/ast/resourceparam.rb +1 -1
- data/lib/puppet/parser/compiler/catalog_validator/env_relationship_validator.rb +2 -0
- data/lib/puppet/parser/compiler/catalog_validator/site_validator.rb +2 -0
- data/lib/puppet/parser/environment_compiler.rb +3 -0
- data/lib/puppet/parser/functions.rb +14 -10
- data/lib/puppet/parser/functions/epp.rb +3 -3
- data/lib/puppet/parser/functions/inline_epp.rb +5 -5
- data/lib/puppet/parser/resource.rb +3 -2
- data/lib/puppet/parser/resource/param.rb +6 -0
- data/lib/puppet/pops/adaptable.rb +7 -13
- data/lib/puppet/pops/adapters.rb +8 -4
- data/lib/puppet/pops/evaluator/access_operator.rb +2 -2
- data/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +1 -3
- 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/evaluator_impl.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/issues.rb +5 -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 -48
- data/lib/puppet/pops/resource/resource_type_impl.rb +2 -0
- data/lib/puppet/pops/types/iterable.rb +34 -8
- data/lib/puppet/pops/types/p_meta_type.rb +1 -1
- data/lib/puppet/pops/types/p_sensitive_type.rb +1 -1
- data/lib/puppet/pops/types/p_type_set_type.rb +4 -0
- data/lib/puppet/pops/types/string_converter.rb +10 -10
- data/lib/puppet/pops/types/type_calculator.rb +24 -0
- data/lib/puppet/pops/types/types.rb +3 -3
- data/lib/puppet/pops/validation/checker4_0.rb +29 -15
- data/lib/puppet/pops/validation/validator_factory_4_0.rb +1 -0
- data/lib/puppet/property.rb +1 -1
- data/lib/puppet/property/ensure.rb +1 -1
- data/lib/puppet/provider/augeas/augeas.rb +1 -1
- data/lib/puppet/provider/cron/crontab.rb +1 -1
- data/lib/puppet/provider/exec.rb +6 -2
- data/lib/puppet/provider/group/groupadd.rb +19 -19
- data/lib/puppet/provider/group/windows_adsi.rb +3 -3
- data/lib/puppet/provider/mailalias/aliases.rb +1 -1
- data/lib/puppet/provider/mount.rb +1 -1
- data/lib/puppet/provider/mount/parsed.rb +8 -8
- data/lib/puppet/provider/nameservice/directoryservice.rb +1 -1
- data/lib/puppet/provider/nameservice/pw.rb +2 -2
- data/lib/puppet/provider/package/aix.rb +17 -2
- data/lib/puppet/provider/package/apt.rb +14 -3
- data/lib/puppet/provider/package/dnfmodule.rb +141 -0
- data/lib/puppet/provider/package/dpkg.rb +16 -18
- data/lib/puppet/provider/package/fink.rb +20 -3
- data/lib/puppet/provider/package/gem.rb +4 -2
- data/lib/puppet/provider/package/openbsd.rb +14 -2
- data/lib/puppet/provider/package/pip.rb +37 -10
- data/lib/puppet/provider/package/pkg.rb +18 -5
- data/lib/puppet/provider/package/pkgdmg.rb +1 -1
- data/lib/puppet/provider/package/pkgng.rb +16 -4
- data/lib/puppet/provider/package/portage.rb +4 -4
- data/lib/puppet/provider/package/puppet_gem.rb +5 -0
- data/lib/puppet/provider/package/rpm.rb +6 -6
- data/lib/puppet/provider/package/windows/package.rb +1 -1
- data/lib/puppet/provider/package/yum.rb +28 -20
- data/lib/puppet/provider/package/zypper.rb +1 -0
- data/lib/puppet/provider/package_targetable.rb +5 -4
- data/lib/puppet/provider/parsedfile.rb +1 -1
- data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +3 -3
- data/lib/puppet/provider/selmodule/semodule.rb +43 -26
- 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 +31 -13
- data/lib/puppet/provider/user/directoryservice.rb +31 -6
- 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 +39 -20
- data/lib/puppet/provider/user/windows_adsi.rb +4 -5
- data/lib/puppet/provider/yumrepo/inifile.rb +2 -2
- data/lib/puppet/reference/indirection.rb +2 -2
- data/lib/puppet/reference/metaparameter.rb +1 -3
- data/lib/puppet/reference/providers.rb +1 -1
- 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/resource/type.rb +10 -1
- data/lib/puppet/settings.rb +3 -3
- data/lib/puppet/settings/environment_conf.rb +1 -0
- data/lib/puppet/ssl/certificate.rb +2 -1
- data/lib/puppet/ssl/certificate_authority.rb +6 -5
- data/lib/puppet/ssl/certificate_authority/interface.rb +1 -1
- data/lib/puppet/ssl/certificate_factory.rb +2 -2
- data/lib/puppet/ssl/host.rb +3 -3
- data/lib/puppet/ssl/oids.rb +1 -1
- data/lib/puppet/test/test_helper.rb +20 -12
- data/lib/puppet/transaction/report.rb +1 -1
- data/lib/puppet/transaction/resource_harness.rb +1 -1
- data/lib/puppet/type.rb +8 -4
- data/lib/puppet/type/cron.rb +1 -1
- data/lib/puppet/type/exec.rb +7 -3
- data/lib/puppet/type/file.rb +14 -2
- data/lib/puppet/type/file/data_sync.rb +5 -1
- data/lib/puppet/type/group.rb +4 -2
- data/lib/puppet/type/interface.rb +1 -1
- data/lib/puppet/type/notify.rb +3 -2
- data/lib/puppet/type/package.rb +97 -8
- data/lib/puppet/type/schedule.rb +1 -1
- data/lib/puppet/type/selboolean.rb +17 -3
- data/lib/puppet/type/service.rb +2 -8
- data/lib/puppet/type/user.rb +5 -9
- data/lib/puppet/util.rb +35 -12
- data/lib/puppet/util/autoload.rb +9 -7
- data/lib/puppet/util/command_line/trollop.rb +1 -1
- data/lib/puppet/util/http_proxy.rb +8 -14
- data/lib/puppet/util/instance_loader.rb +1 -1
- data/lib/puppet/util/log.rb +1 -1
- data/lib/puppet/util/log/destinations.rb +3 -12
- data/lib/puppet/util/logging.rb +30 -18
- data/lib/puppet/util/metric.rb +2 -2
- data/lib/puppet/util/monkey_patches.rb +1 -1
- data/lib/puppet/util/nagios_maker.rb +2 -2
- data/lib/puppet/util/network_device/cisco/device.rb +1 -1
- data/lib/puppet/util/network_device/cisco/interface.rb +2 -2
- data/lib/puppet/util/network_device/transport/ssh.rb +1 -1
- data/lib/puppet/util/pidlock.rb +12 -6
- data/lib/puppet/util/plist.rb +6 -0
- 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 +60 -30
- data/lib/puppet/util/windows/api_types.rb +45 -32
- data/lib/puppet/util/windows/eventlog.rb +1 -6
- data/lib/puppet/util/windows/principal.rb +8 -6
- data/lib/puppet/util/windows/process.rb +16 -15
- data/lib/puppet/util/windows/registry.rb +17 -15
- data/lib/puppet/util/windows/security.rb +1 -0
- data/lib/puppet/util/windows/sid.rb +3 -3
- data/lib/puppet/vendor.rb +1 -1
- data/lib/puppet/version.rb +1 -1
- data/lib/puppet_pal.rb +2 -2
- data/locales/puppet.pot +362 -318
- data/man/man5/puppet.conf.5 +39 -9
- data/man/man8/puppet-agent.8 +2 -2
- data/man/man8/puppet-apply.8 +1 -1
- data/man/man8/puppet-ca.8 +1 -1
- data/man/man8/puppet-catalog.8 +1 -1
- data/man/man8/puppet-cert.8 +1 -1
- data/man/man8/puppet-certificate.8 +1 -1
- data/man/man8/puppet-certificate_request.8 +1 -1
- data/man/man8/puppet-certificate_revocation_list.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 +16 -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-master.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-status.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/fixtures/integration/provider/mailalias/aliases/test1 +1 -0
- data/spec/fixtures/unit/provider/package/dnfmodule/dnf-module-list.txt +19 -0
- data/spec/fixtures/unit/provider/package/pkgng/pkg.version +2 -0
- data/spec/fixtures/unit/provider/package/yum/yum-check-update-subscription-manager.txt +9 -0
- data/spec/fixtures/unit/provider/service/systemd/list_unit_files_services +9 -0
- data/spec/integration/configurer_spec.rb +66 -0
- data/spec/integration/data_binding_spec.rb +1 -0
- data/spec/integration/defaults_spec.rb +1 -2
- data/spec/integration/faces/plugin_spec.rb +29 -47
- data/spec/integration/indirector/facts/facter_spec.rb +4 -0
- data/spec/integration/parser/compiler_spec.rb +11 -0
- data/spec/integration/type/notify_spec.rb +46 -0
- data/spec/integration/util/windows/adsi_spec.rb +6 -1
- data/spec/integration/util/windows/registry_spec.rb +7 -7
- data/spec/shared_contexts/types_setup.rb +2 -0
- data/spec/unit/agent_spec.rb +34 -26
- data/spec/unit/application/apply_spec.rb +2 -12
- data/spec/unit/configurer/downloader_spec.rb +10 -0
- data/spec/unit/configurer/fact_handler_spec.rb +0 -4
- data/spec/unit/configurer_spec.rb +430 -415
- data/spec/unit/daemon_spec.rb +0 -1
- data/spec/unit/file_serving/mount/locales_spec.rb +2 -2
- data/spec/unit/file_serving/mount/pluginfacts_spec.rb +2 -2
- data/spec/unit/file_serving/mount/plugins_spec.rb +2 -2
- data/spec/unit/file_system/uniquefile_spec.rb +11 -0
- data/spec/unit/forge/forge_spec.rb +1 -3
- data/spec/unit/forge/repository_spec.rb +1 -3
- data/spec/unit/indirector/catalog/compiler_spec.rb +45 -26
- data/spec/unit/indirector/resource/ral_spec.rb +4 -4
- data/spec/unit/network/http/api/indirected_routes_spec.rb +2 -1
- data/spec/unit/network/http/connection_spec.rb +43 -1
- data/spec/unit/network/http/pool_spec.rb +32 -0
- data/spec/unit/node_spec.rb +7 -4
- data/spec/unit/parser/environment_compiler_spec.rb +7 -0
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +8 -3
- data/spec/unit/provider/exec_spec.rb +209 -0
- data/spec/unit/provider/group/groupadd_spec.rb +30 -1
- data/spec/unit/provider/group/windows_adsi_spec.rb +43 -10
- data/spec/unit/provider/package/aix_spec.rb +29 -0
- data/spec/unit/provider/package/apt_spec.rb +13 -2
- data/spec/unit/provider/package/aptitude_spec.rb +1 -0
- data/spec/unit/provider/package/dnfmodule_spec.rb +247 -0
- data/spec/unit/provider/package/dpkg_spec.rb +35 -7
- data/spec/unit/provider/package/openbsd_spec.rb +17 -0
- data/spec/unit/provider/package/pip_spec.rb +93 -22
- data/spec/unit/provider/package/pkg_spec.rb +13 -1
- data/spec/unit/provider/package/pkgdmg_spec.rb +1 -1
- data/spec/unit/provider/package/pkgng_spec.rb +36 -0
- data/spec/unit/provider/package/portage_spec.rb +4 -4
- data/spec/unit/provider/package/puppet_gem_spec.rb +4 -1
- data/spec/unit/provider/package/yum_spec.rb +90 -0
- data/spec/unit/provider/package/zypper_spec.rb +13 -0
- data/spec/unit/provider/package_targetable_spec.rb +60 -0
- data/spec/unit/provider/selmodule_spec.rb +118 -47
- 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 +109 -36
- data/spec/unit/provider/user/directoryservice_spec.rb +41 -0
- data/spec/unit/provider/user/hpux_spec.rb +2 -2
- data/spec/unit/provider/user/openbsd_spec.rb +1 -0
- data/spec/unit/provider/user/useradd_spec.rb +81 -16
- data/spec/unit/provider/user/windows_adsi_spec.rb +3 -3
- data/spec/unit/puppet_pal_2pec.rb +3 -0
- data/spec/unit/ssl/certificate_authority_spec.rb +2 -3
- data/spec/unit/ssl/certificate_spec.rb +7 -0
- data/spec/unit/ssl/host_spec.rb +2 -0
- data/spec/unit/test/test_helper_spec.rb +17 -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 +8 -0
- data/spec/unit/type/selboolean_spec.rb +4 -6
- data/spec/unit/type/service_spec.rb +9 -8
- data/spec/unit/type/user_spec.rb +19 -13
- data/spec/unit/util/execution_spec.rb +16 -0
- data/spec/unit/util/http_proxy_spec.rb +97 -0
- data/spec/unit/util/log/destinations_spec.rb +2 -26
- data/spec/unit/util/log_spec.rb +0 -138
- data/spec/unit/util/logging_spec.rb +200 -0
- data/spec/unit/util/pidlock_spec.rb +67 -40
- data/spec/unit/util/plist_spec.rb +20 -0
- data/spec/unit/util/windows/adsi_spec.rb +55 -4
- data/spec/unit/util/windows/api_types_spec.rb +104 -40
- data/spec/unit/util/windows/sid_spec.rb +2 -2
- data/tasks/manpages.rake +1 -0
- metadata +16 -7
- data/lib/puppet/pops/loader/null_loader.rb +0 -60
- data/locales/ja/puppet.po +0 -12114
- data/spec/integration/test/test_helper_spec.rb +0 -31
data/spec/unit/daemon_spec.rb
CHANGED
@@ -224,7 +224,6 @@ describe Puppet::Daemon, :unless => Puppet.features.microsoft_windows? do
|
|
224
224
|
end
|
225
225
|
|
226
226
|
it "should reexec itself if the agent is not running" do
|
227
|
-
expect(agent).to receive(:running?).and_return(false)
|
228
227
|
daemon.agent = agent
|
229
228
|
expect(daemon).to receive(:reexec)
|
230
229
|
|
@@ -52,13 +52,13 @@ describe Puppet::FileServing::Mount::Locales do
|
|
52
52
|
expect(@mount.search("foo/bar", @request)).to eq(["/"])
|
53
53
|
end
|
54
54
|
|
55
|
-
it "should return
|
55
|
+
it "should return the default search module path if no modules can be found that have locales and modulepath is invalid" do
|
56
56
|
mod = double('module')
|
57
57
|
allow(mod).to receive(:locales?).and_return(false)
|
58
58
|
|
59
59
|
allow(@environment).to receive(:modules).and_return([])
|
60
60
|
allow(@environment).to receive(:modulepath).and_return([])
|
61
|
-
expect(@mount.search("foo/bar", @request)).to
|
61
|
+
expect(@mount.search("foo/bar", @request)).to eq([Puppet[:codedir]])
|
62
62
|
end
|
63
63
|
|
64
64
|
it "should return the locale paths for each module that has locales" do
|
@@ -52,13 +52,13 @@ describe Puppet::FileServing::Mount::PluginFacts do
|
|
52
52
|
expect(@mount.search("foo/bar", @request)).to eq(["/"])
|
53
53
|
end
|
54
54
|
|
55
|
-
it "should return
|
55
|
+
it "should return the default search module path if no modules can be found that have plugins and modulepath is invalid" do
|
56
56
|
mod = double('module')
|
57
57
|
allow(mod).to receive(:pluginfacts?).and_return(false)
|
58
58
|
|
59
59
|
allow(@environment).to receive(:modules).and_return([])
|
60
60
|
allow(@environment).to receive(:modulepath).and_return([])
|
61
|
-
expect(@mount.search("foo/bar", @request)).to
|
61
|
+
expect(@mount.search("foo/bar", @request)).to eq([Puppet[:codedir]])
|
62
62
|
end
|
63
63
|
|
64
64
|
it "should return the plugin paths for each module that has plugins" do
|
@@ -52,13 +52,13 @@ describe Puppet::FileServing::Mount::Plugins do
|
|
52
52
|
expect(@mount.search("foo/bar", @request)).to eq(["/"])
|
53
53
|
end
|
54
54
|
|
55
|
-
it "should return
|
55
|
+
it "should return the default search module path if no modules can be found that have plugins and modulepath is invalid" do
|
56
56
|
mod = double('module')
|
57
57
|
allow(mod).to receive(:plugins?).and_return(false)
|
58
58
|
|
59
59
|
allow(@environment).to receive(:modules).and_return([])
|
60
60
|
allow(@environment).to receive(:modulepath).and_return([])
|
61
|
-
expect(@mount.search("foo/bar", @request)).to
|
61
|
+
expect(@mount.search("foo/bar", @request)).to eq([Puppet[:codedir]])
|
62
62
|
end
|
63
63
|
|
64
64
|
it "should return the plugin paths for each module that has plugins" do
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Puppet::FileSystem::Uniquefile do
|
4
|
+
include PuppetSpec::Files
|
5
|
+
|
4
6
|
it "makes the name of the file available" do
|
5
7
|
Puppet::FileSystem::Uniquefile.open_tmp('foo') do |file|
|
6
8
|
expect(file.path).to match(/foo/)
|
@@ -67,6 +69,15 @@ describe Puppet::FileSystem::Uniquefile do
|
|
67
69
|
Puppet::FileSystem::Uniquefile.open_tmp('foo') { |tmp| }
|
68
70
|
end
|
69
71
|
|
72
|
+
it "reports when a parent directory does not exist" do
|
73
|
+
dir = tmpdir('uniquefile')
|
74
|
+
lock = File.join(dir, 'path', 'to', 'lock')
|
75
|
+
|
76
|
+
expect {
|
77
|
+
Puppet::FileSystem::Uniquefile.open_tmp(lock) { |tmp| }
|
78
|
+
}.to raise_error(Errno::ENOENT, %r{No such file or directory - A directory component in .* does not exist or is a dangling symbolic link})
|
79
|
+
end
|
80
|
+
|
70
81
|
context "Ruby 1.9.3 Tempfile tests" do
|
71
82
|
# the remaining tests in this file are ported directly from the ruby 1.9.3 source,
|
72
83
|
# since most of this file was ported from there
|
@@ -97,10 +97,8 @@ describe Puppet::Forge do
|
|
97
97
|
def mock_proxy(port, proxy_args, result, &block)
|
98
98
|
http = double("http client")
|
99
99
|
proxy = double("http proxy")
|
100
|
-
proxy_class = double("http proxy class")
|
101
100
|
|
102
|
-
expect(Net::HTTP).to receive(:
|
103
|
-
expect(proxy_class).to receive(:new).with(host, port).and_return(proxy)
|
101
|
+
expect(Net::HTTP).to receive(:new).with(host, port, *proxy_args).and_return(proxy)
|
104
102
|
|
105
103
|
expect(proxy).to receive(:open_timeout=)
|
106
104
|
expect(proxy).to receive(:read_timeout=)
|
@@ -234,10 +234,8 @@ describe Puppet::Forge::Repository do
|
|
234
234
|
def mock_proxy(port, proxy_args, result, &block)
|
235
235
|
http = double("http client")
|
236
236
|
proxy = double("http proxy")
|
237
|
-
proxy_class = double("http proxy class")
|
238
237
|
|
239
|
-
expect(Net::HTTP).to receive(:
|
240
|
-
expect(proxy_class).to receive(:new).with("fake.com", port).and_return(proxy)
|
238
|
+
expect(Net::HTTP).to receive(:new).with("fake.com", port, *proxy_args).and_return(proxy)
|
241
239
|
|
242
240
|
expect(proxy).to receive(:open_timeout=)
|
243
241
|
expect(proxy).to receive(:read_timeout=)
|
@@ -9,19 +9,9 @@ describe Puppet::Resource::Catalog::Compiler do
|
|
9
9
|
let(:node_name) { "foo" }
|
10
10
|
let(:node) { Puppet::Node.new(node_name)}
|
11
11
|
|
12
|
-
before do
|
13
|
-
allow(Facter).to receive(:to_hash).and_return({})
|
14
|
-
end
|
15
|
-
|
16
12
|
describe "when initializing" do
|
17
13
|
before do
|
18
|
-
|
19
|
-
expect(Facter).to receive(:value).with('fqdn').and_return("my.server.com")
|
20
|
-
expect(Facter).to receive(:value).with('ipaddress').and_return("my.ip.address")
|
21
|
-
end
|
22
|
-
|
23
|
-
it "should gather data about itself" do
|
24
|
-
Puppet::Resource::Catalog::Compiler.new
|
14
|
+
allow(Puppet).to receive(:version).and_return(1)
|
25
15
|
end
|
26
16
|
|
27
17
|
it "should cache the server metadata and reuse it" do
|
@@ -38,8 +28,6 @@ describe Puppet::Resource::Catalog::Compiler do
|
|
38
28
|
|
39
29
|
describe "when finding catalogs" do
|
40
30
|
before do
|
41
|
-
allow(Facter).to receive(:value).and_return("whatever")
|
42
|
-
|
43
31
|
allow(node).to receive(:merge)
|
44
32
|
allow(Puppet::Node.indirection).to receive(:find).and_return(node)
|
45
33
|
@request = Puppet::Indirector::Request.new(:catalog, :find, node_name, nil, :node => node_name)
|
@@ -246,10 +234,10 @@ describe Puppet::Resource::Catalog::Compiler do
|
|
246
234
|
|
247
235
|
describe "when handling a request with facts" do
|
248
236
|
before do
|
249
|
-
Puppet::Node::Facts.indirection.terminus_class = :memory
|
250
237
|
allow(Facter).to receive(:value).and_return("something")
|
251
238
|
|
252
|
-
|
239
|
+
facts = Puppet::Node::Facts.new('hostname', "fact" => "value", "architecture" => "i386")
|
240
|
+
Puppet::Node::Facts.indirection.save(facts)
|
253
241
|
end
|
254
242
|
|
255
243
|
def a_legacy_request_that_contains(facts, format = :pson)
|
@@ -267,6 +255,8 @@ describe Puppet::Resource::Catalog::Compiler do
|
|
267
255
|
end
|
268
256
|
|
269
257
|
context "when extracting facts from the request" do
|
258
|
+
let(:facts) { Puppet::Node::Facts.new("hostname") }
|
259
|
+
|
270
260
|
it "should do nothing if no facts are provided" do
|
271
261
|
request = Puppet::Indirector::Request.new(:catalog, :find, "hostname", nil)
|
272
262
|
request.options[:facts] = nil
|
@@ -276,21 +266,21 @@ describe Puppet::Resource::Catalog::Compiler do
|
|
276
266
|
|
277
267
|
it "should deserialize the facts without changing the timestamp" do
|
278
268
|
time = Time.now
|
279
|
-
|
280
|
-
request = a_request_that_contains(
|
269
|
+
facts.timestamp = time
|
270
|
+
request = a_request_that_contains(facts)
|
281
271
|
facts = compiler.extract_facts_from_request(request)
|
282
272
|
expect(facts.timestamp).to eq(time)
|
283
273
|
end
|
284
274
|
|
285
275
|
it "accepts PSON facts from older agents" do
|
286
|
-
request = a_legacy_request_that_contains(
|
276
|
+
request = a_legacy_request_that_contains(facts)
|
287
277
|
|
288
278
|
facts = compiler.extract_facts_from_request(request)
|
289
|
-
expect(facts).to eq(
|
279
|
+
expect(facts).to eq(facts)
|
290
280
|
end
|
291
281
|
|
292
282
|
it "rejects YAML facts" do
|
293
|
-
request = a_legacy_request_that_contains(
|
283
|
+
request = a_legacy_request_that_contains(facts, :yaml)
|
294
284
|
|
295
285
|
expect {
|
296
286
|
compiler.extract_facts_from_request(request)
|
@@ -298,7 +288,7 @@ describe Puppet::Resource::Catalog::Compiler do
|
|
298
288
|
end
|
299
289
|
|
300
290
|
it "rejects unknown fact formats" do
|
301
|
-
request = a_request_that_contains(
|
291
|
+
request = a_request_that_contains(facts)
|
302
292
|
request.options[:facts_format] = 'unknown-format'
|
303
293
|
|
304
294
|
expect {
|
@@ -308,15 +298,17 @@ describe Puppet::Resource::Catalog::Compiler do
|
|
308
298
|
end
|
309
299
|
|
310
300
|
context "when saving facts from the request" do
|
301
|
+
let(:facts) { Puppet::Node::Facts.new("hostname") }
|
302
|
+
|
311
303
|
it "should save facts if they were issued by the request" do
|
312
|
-
request = a_request_that_contains(
|
304
|
+
request = a_request_that_contains(facts)
|
313
305
|
|
314
306
|
options = {
|
315
307
|
:environment => request.environment,
|
316
308
|
:transaction_uuid => request.options[:transaction_uuid],
|
317
309
|
}
|
318
310
|
|
319
|
-
expect(Puppet::Node::Facts.indirection).to receive(:save).with(
|
311
|
+
expect(Puppet::Node::Facts.indirection).to receive(:save).with(facts, nil, options)
|
320
312
|
compiler.find(request)
|
321
313
|
end
|
322
314
|
|
@@ -328,7 +320,7 @@ describe Puppet::Resource::Catalog::Compiler do
|
|
328
320
|
:transaction_uuid => request.options[:transaction_uuid],
|
329
321
|
}
|
330
322
|
|
331
|
-
expect(Puppet::Node::Facts.indirection).not_to receive(:save).with(
|
323
|
+
expect(Puppet::Node::Facts.indirection).not_to receive(:save).with(facts, nil, options)
|
332
324
|
compiler.find(request)
|
333
325
|
end
|
334
326
|
end
|
@@ -336,7 +328,6 @@ describe Puppet::Resource::Catalog::Compiler do
|
|
336
328
|
|
337
329
|
describe "when finding nodes" do
|
338
330
|
it "should look node information up via the Node class with the provided key" do
|
339
|
-
allow(Facter).to receive(:value).and_return("whatever")
|
340
331
|
request = Puppet::Indirector::Request.new(:catalog, :find, node_name, nil)
|
341
332
|
allow(compiler).to receive(:compile)
|
342
333
|
|
@@ -414,9 +405,37 @@ describe Puppet::Resource::Catalog::Compiler do
|
|
414
405
|
end
|
415
406
|
end
|
416
407
|
|
408
|
+
describe "after finding nodes when checking for a PE version" do
|
409
|
+
include PuppetSpec::Compiler
|
410
|
+
|
411
|
+
let(:pe_version_file) { '/opt/puppetlabs/server/pe_version' }
|
412
|
+
let(:request) { Puppet::Indirector::Request.new(:catalog, :find, node_name, nil) }
|
413
|
+
|
414
|
+
before :each do
|
415
|
+
Puppet[:code] = 'notify { "PE Version: $pe_serverversion": }'
|
416
|
+
end
|
417
|
+
|
418
|
+
it "should not add 'pe_serverversion' when FOSS" do
|
419
|
+
allow(Puppet::Node.indirection).to receive(:find).with(node_name, anything).and_return(node)
|
420
|
+
catalog = compiler.find(request)
|
421
|
+
|
422
|
+
expect(catalog.resource('notify', 'PE Version: 2019.2.0')).to be_nil
|
423
|
+
end
|
424
|
+
|
425
|
+
it "should add 'pe_serverversion' when PE" do
|
426
|
+
allow(File).to receive(:readable?).with(pe_version_file).and_return(true)
|
427
|
+
allow(File).to receive(:zero?).with(pe_version_file).and_return(false)
|
428
|
+
allow(File).to receive(:read).with(pe_version_file).and_return('2019.2.0')
|
429
|
+
|
430
|
+
allow(Puppet::Node.indirection).to receive(:find).with(node_name, anything).and_return(node)
|
431
|
+
catalog = compiler.find(request)
|
432
|
+
|
433
|
+
expect(catalog.resource('notify', 'PE Version: 2019.2.0')).to be
|
434
|
+
end
|
435
|
+
end
|
436
|
+
|
417
437
|
describe "when filtering resources" do
|
418
438
|
before :each do
|
419
|
-
allow(Facter).to receive(:value)
|
420
439
|
@catalog = double('catalog')
|
421
440
|
allow(@catalog).to receive(:respond_to?).with(:filter).and_return(true)
|
422
441
|
end
|
@@ -47,7 +47,7 @@ describe "Puppet::Resource::Ral" do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
it "should convert ral resources into regular resources" do
|
50
|
-
my_resource = double("my user resource")
|
50
|
+
my_resource = double("my user resource", :title => "my user resource")
|
51
51
|
my_instance = double("my user", :name => "root", :to_resource => my_resource)
|
52
52
|
|
53
53
|
expect(Puppet::Type::User).to receive(:instances).and_return([ my_instance ])
|
@@ -55,7 +55,7 @@ describe "Puppet::Resource::Ral" do
|
|
55
55
|
end
|
56
56
|
|
57
57
|
it "should filter results by name if there's a name in the key" do
|
58
|
-
my_resource = double("my user resource")
|
58
|
+
my_resource = double("my user resource", title: "my user resource")
|
59
59
|
allow(my_resource).to receive(:to_resource).and_return(my_resource)
|
60
60
|
allow(my_resource).to receive(:[]).with(:name).and_return("root")
|
61
61
|
|
@@ -73,11 +73,11 @@ describe "Puppet::Resource::Ral" do
|
|
73
73
|
end
|
74
74
|
|
75
75
|
it "should filter results by query parameters" do
|
76
|
-
wrong_resource = double("my user resource")
|
76
|
+
wrong_resource = double("my user resource", title: "my user resource")
|
77
77
|
allow(wrong_resource).to receive(:to_resource).and_return(wrong_resource)
|
78
78
|
allow(wrong_resource).to receive(:[]).with(:name).and_return("root")
|
79
79
|
|
80
|
-
my_resource = double("wrong resource")
|
80
|
+
my_resource = double("wrong resource", title: "wrong resource")
|
81
81
|
allow(my_resource).to receive(:to_resource).and_return(my_resource)
|
82
82
|
allow(my_resource).to receive(:[]).with(:name).and_return("bob")
|
83
83
|
|
@@ -343,7 +343,8 @@ describe Puppet::Network::HTTP::API::IndirectedRoutes do
|
|
343
343
|
|
344
344
|
expect {
|
345
345
|
handler.call(request, response)
|
346
|
-
}.to raise_error(Puppet::Network::HTTP::Error::HTTPNotAcceptableError,
|
346
|
+
}.to raise_error(Puppet::Network::HTTP::Error::HTTPNotAcceptableError,
|
347
|
+
%r{No supported formats are acceptable \(Accept: application/json, text/pson\)})
|
347
348
|
end
|
348
349
|
|
349
350
|
it "should return [] when searching returns an empty array" do
|
@@ -135,7 +135,7 @@ describe Puppet::Network::HTTP::Connection do
|
|
135
135
|
end
|
136
136
|
|
137
137
|
context "when response indicates an overloaded server" do
|
138
|
-
let(:http) { double('http') }
|
138
|
+
let(:http) { double('http', :started? => true) }
|
139
139
|
let(:site) { Puppet::Network::HTTP::Site.new('http', 'my_server', 8140) }
|
140
140
|
let(:verify) { Puppet::SSL::Validator.no_validator }
|
141
141
|
let(:httpunavailable) { Net::HTTPServiceUnavailable.new('1.1', 503, 'Service Unavailable') }
|
@@ -158,6 +158,7 @@ describe Puppet::Network::HTTP::Connection do
|
|
158
158
|
|
159
159
|
pool = Puppet.lookup(:http_pool)
|
160
160
|
expect(pool).to receive(:with_connection).with(site, anything).and_yield(http)
|
161
|
+
allow(http).to receive(:finish)
|
161
162
|
|
162
163
|
result = subject.get('/foo')
|
163
164
|
|
@@ -167,6 +168,7 @@ describe Puppet::Network::HTTP::Connection do
|
|
167
168
|
it "should return a 503 response if Retry-After is not convertible to an Integer or RFC 2822 Date" do
|
168
169
|
httpunavailable['Retry-After'] = 'foo'
|
169
170
|
allow(http).to receive(:request).and_return(httpunavailable)
|
171
|
+
allow(http).to receive(:finish)
|
170
172
|
|
171
173
|
pool = Puppet.lookup(:http_pool)
|
172
174
|
expect(pool).to receive(:with_connection).with(site, anything).and_yield(http)
|
@@ -176,9 +178,21 @@ describe Puppet::Network::HTTP::Connection do
|
|
176
178
|
expect(result.code).to eq(503)
|
177
179
|
end
|
178
180
|
|
181
|
+
it "should close the connection before sleeping" do
|
182
|
+
allow(http).to receive(:request).and_return(httpunavailable, httpok)
|
183
|
+
|
184
|
+
pool = Puppet.lookup(:http_pool)
|
185
|
+
expect(pool).to receive(:with_connection).with(site, anything).and_yield(http)
|
186
|
+
|
187
|
+
expect(http).to receive(:finish)
|
188
|
+
|
189
|
+
subject.get('/foo')
|
190
|
+
end
|
191
|
+
|
179
192
|
it "should sleep and retry if Retry-After is an Integer" do
|
180
193
|
httpunavailable['Retry-After'] = '42'
|
181
194
|
allow(http).to receive(:request).and_return(httpunavailable, httpok)
|
195
|
+
allow(http).to receive(:finish)
|
182
196
|
|
183
197
|
pool = Puppet.lookup(:http_pool)
|
184
198
|
expect(pool).to receive(:with_connection).with(site, anything).twice.and_yield(http)
|
@@ -193,6 +207,7 @@ describe Puppet::Network::HTTP::Connection do
|
|
193
207
|
it "should sleep and retry if Retry-After is an RFC 2822 Date" do
|
194
208
|
httpunavailable['Retry-After'] = 'Wed, 13 Apr 2005 15:18:05 GMT'
|
195
209
|
allow(http).to receive(:request).and_return(httpunavailable, httpok)
|
210
|
+
allow(http).to receive(:finish)
|
196
211
|
|
197
212
|
now = DateTime.new(2005, 4, 13, 8, 17, 5, '-07:00')
|
198
213
|
allow(DateTime).to receive(:now).and_return(now)
|
@@ -210,6 +225,7 @@ describe Puppet::Network::HTTP::Connection do
|
|
210
225
|
it "should sleep for no more than the Puppet runinterval" do
|
211
226
|
httpunavailable['Retry-After'] = '60'
|
212
227
|
allow(http).to receive(:request).and_return(httpunavailable, httpok)
|
228
|
+
allow(http).to receive(:finish)
|
213
229
|
Puppet[:runinterval] = 30
|
214
230
|
|
215
231
|
pool = Puppet.lookup(:http_pool)
|
@@ -266,4 +282,30 @@ describe Puppet::Network::HTTP::Connection do
|
|
266
282
|
|
267
283
|
subject.get('/path')
|
268
284
|
end
|
285
|
+
|
286
|
+
describe 'connection request errors' do
|
287
|
+
it "logs and raises generic http errors" do
|
288
|
+
generic_error = Net::HTTPError.new('generic error', double("response"))
|
289
|
+
expect_any_instance_of(Net::HTTP).to receive(:request).and_raise(generic_error)
|
290
|
+
|
291
|
+
expect(Puppet).to receive(:log_exception).with(anything, /^.*failed: generic error$/)
|
292
|
+
expect { subject.get('/foo') }.to raise_error(generic_error)
|
293
|
+
end
|
294
|
+
|
295
|
+
it "logs and raises timeout errors" do
|
296
|
+
timeout_error = Timeout::Error.new
|
297
|
+
expect_any_instance_of(Net::HTTP).to receive(:request).and_raise(timeout_error)
|
298
|
+
|
299
|
+
expect(Puppet).to receive(:log_exception).with(anything, /^.*timed out after .* seconds$/)
|
300
|
+
expect { subject.get('/foo') }.to raise_error(timeout_error)
|
301
|
+
end
|
302
|
+
|
303
|
+
it "logs and raises eof errors" do
|
304
|
+
eof_error = EOFError
|
305
|
+
expect_any_instance_of(Net::HTTP).to receive(:request).and_raise(eof_error)
|
306
|
+
|
307
|
+
expect(Puppet).to receive(:log_exception).with(anything, /^.*interrupted after .* seconds$/)
|
308
|
+
expect { subject.get('/foo') }.to raise_error(eof_error)
|
309
|
+
end
|
310
|
+
end
|
269
311
|
end
|
@@ -60,6 +60,8 @@ describe Puppet::Network::HTTP::Pool do
|
|
60
60
|
|
61
61
|
it 'returns the connection to the pool' do
|
62
62
|
conn = create_connection(site)
|
63
|
+
expect(conn).to receive(:started?).and_return(true)
|
64
|
+
|
63
65
|
pool = create_pool
|
64
66
|
pool.release(site, conn)
|
65
67
|
|
@@ -137,6 +139,7 @@ describe Puppet::Network::HTTP::Pool do
|
|
137
139
|
it 'releases HTTP connections' do
|
138
140
|
conn = create_connection(site)
|
139
141
|
expect(conn).to receive(:use_ssl?).and_return(false)
|
142
|
+
expect(conn).to receive(:started?).and_return(true)
|
140
143
|
|
141
144
|
pool = create_pool_with_connections(site, conn)
|
142
145
|
expect(pool).to receive(:release).with(site, conn)
|
@@ -148,6 +151,7 @@ describe Puppet::Network::HTTP::Pool do
|
|
148
151
|
conn = create_connection(site)
|
149
152
|
expect(conn).to receive(:use_ssl?).and_return(true)
|
150
153
|
expect(conn).to receive(:verify_mode).and_return(OpenSSL::SSL::VERIFY_PEER)
|
154
|
+
expect(conn).to receive(:started?).and_return(true)
|
151
155
|
|
152
156
|
pool = create_pool_with_connections(site, conn)
|
153
157
|
expect(pool).to receive(:release).with(site, conn)
|
@@ -166,6 +170,19 @@ describe Puppet::Network::HTTP::Pool do
|
|
166
170
|
|
167
171
|
pool.with_connection(site, verify) {|c| }
|
168
172
|
end
|
173
|
+
|
174
|
+
it "doesn't add a closed connection back to the pool" do
|
175
|
+
http = Net::HTTP.new(site.addr)
|
176
|
+
http.use_ssl = true
|
177
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
178
|
+
http.start
|
179
|
+
|
180
|
+
pool = create_pool_with_connections(site, http)
|
181
|
+
|
182
|
+
pool.with_connection(site, verify) {|c| c.finish}
|
183
|
+
|
184
|
+
expect(pool.pool[site]).to be_empty
|
185
|
+
end
|
169
186
|
end
|
170
187
|
end
|
171
188
|
|
@@ -228,6 +245,7 @@ describe Puppet::Network::HTTP::Pool do
|
|
228
245
|
|
229
246
|
it 'finishes expired connections' do
|
230
247
|
conn = create_connection(site)
|
248
|
+
allow(conn).to receive(:started?).and_return(true)
|
231
249
|
expect(conn).to receive(:finish)
|
232
250
|
|
233
251
|
pool = create_pool_with_expired_connections(site, conn)
|
@@ -241,6 +259,7 @@ describe Puppet::Network::HTTP::Pool do
|
|
241
259
|
expect(Puppet).to receive(:log_exception).with(be_a(IOError), "Failed to close connection for #{site}: read timeout")
|
242
260
|
|
243
261
|
conn = create_connection(site)
|
262
|
+
expect(conn).to receive(:started?).and_return(true)
|
244
263
|
expect(conn).to receive(:finish).and_raise(IOError, 'read timeout')
|
245
264
|
|
246
265
|
pool = create_pool_with_expired_connections(site, conn)
|
@@ -289,10 +308,23 @@ describe Puppet::Network::HTTP::Pool do
|
|
289
308
|
|
290
309
|
it 'closes all cached connections' do
|
291
310
|
conn = create_connection(site)
|
311
|
+
allow(conn).to receive(:started?).and_return(true)
|
292
312
|
expect(conn).to receive(:finish)
|
293
313
|
|
294
314
|
pool = create_pool_with_connections(site, conn)
|
295
315
|
pool.close
|
296
316
|
end
|
317
|
+
|
318
|
+
it 'allows a connection to be closed multiple times safely' do
|
319
|
+
http = Net::HTTP.new(site.addr)
|
320
|
+
http.use_ssl = true
|
321
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
322
|
+
http.start
|
323
|
+
|
324
|
+
pool = create_pool
|
325
|
+
|
326
|
+
expect(pool.close_connection(site, http)).to eq(true)
|
327
|
+
expect(pool.close_connection(site, http)).to eq(false)
|
328
|
+
end
|
297
329
|
end
|
298
330
|
end
|