puppet 6.12.0-universal-darwin → 6.17.0-universal-darwin
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 +2 -7
- data/CONTRIBUTING.md +7 -13
- data/Gemfile +4 -2
- data/Gemfile.lock +39 -36
- data/README.md +18 -25
- data/ext/project_data.yaml +1 -1
- data/ext/windows/service/daemon.rb +3 -3
- data/lib/puppet.rb +52 -13
- data/lib/puppet/agent.rb +20 -14
- data/lib/puppet/application/agent.rb +26 -17
- data/lib/puppet/application/describe.rb +7 -5
- data/lib/puppet/application/device.rb +2 -2
- data/lib/puppet/application/filebucket.rb +19 -15
- data/lib/puppet/application/plugin.rb +1 -0
- data/lib/puppet/application/resource.rb +1 -1
- data/lib/puppet/application/ssl.rb +4 -4
- data/lib/puppet/configurer.rb +65 -69
- data/lib/puppet/configurer/plugin_handler.rb +10 -1
- data/lib/puppet/confine.rb +1 -1
- data/lib/puppet/context/trusted_information.rb +14 -8
- data/lib/puppet/daemon.rb +13 -27
- data/lib/puppet/defaults.rb +154 -58
- data/lib/puppet/environments.rb +27 -20
- data/lib/puppet/face/facts.rb +8 -5
- data/lib/puppet/face/help.rb +29 -3
- data/lib/puppet/face/module/search.rb +5 -0
- data/lib/puppet/face/plugin.rb +2 -2
- data/lib/puppet/file_serving/http_metadata.rb +14 -2
- data/lib/puppet/file_serving/metadata.rb +4 -1
- data/lib/puppet/file_serving/terminus_selector.rb +7 -8
- data/lib/puppet/file_system/file_impl.rb +14 -10
- data/lib/puppet/file_system/memory_file.rb +6 -0
- data/lib/puppet/file_system/memory_impl.rb +13 -0
- data/lib/puppet/file_system/uniquefile.rb +12 -16
- data/lib/puppet/file_system/windows.rb +7 -10
- data/lib/puppet/forge.rb +1 -1
- data/lib/puppet/forge/cache.rb +1 -1
- data/lib/puppet/forge/repository.rb +4 -7
- data/lib/puppet/functions/call.rb +1 -1
- data/lib/puppet/functions/eyaml_lookup_key.rb +13 -8
- data/lib/puppet/functions/filter.rb +1 -0
- data/lib/puppet/functions/reduce.rb +2 -4
- data/lib/puppet/http.rb +5 -0
- data/lib/puppet/http/client.rb +293 -73
- data/lib/puppet/http/errors.rb +2 -0
- data/lib/puppet/http/external_client.rb +90 -0
- data/lib/puppet/http/redirector.rb +43 -7
- data/lib/puppet/http/resolver.rb +46 -3
- data/lib/puppet/http/resolver/server_list.rb +76 -16
- data/lib/puppet/http/resolver/settings.rb +23 -3
- data/lib/puppet/http/resolver/srv.rb +29 -3
- data/lib/puppet/http/response.rb +87 -1
- data/lib/puppet/http/retry_after_handler.rb +39 -0
- data/lib/puppet/http/service.rb +151 -7
- data/lib/puppet/http/service/ca.rb +76 -14
- data/lib/puppet/http/service/compiler.rb +319 -0
- data/lib/puppet/http/service/file_server.rb +206 -0
- data/lib/puppet/http/service/report.rb +49 -23
- data/lib/puppet/http/session.rb +103 -7
- data/lib/puppet/indirector.rb +1 -1
- data/lib/puppet/indirector/catalog/compiler.rb +10 -0
- data/lib/puppet/indirector/catalog/rest.rb +34 -0
- data/lib/puppet/indirector/facts/rest.rb +42 -0
- data/lib/puppet/indirector/file_bucket_file/file.rb +1 -1
- data/lib/puppet/indirector/file_bucket_file/rest.rb +48 -0
- data/lib/puppet/indirector/file_content/http.rb +5 -0
- data/lib/puppet/indirector/file_content/rest.rb +30 -0
- data/lib/puppet/indirector/file_metadata/http.rb +27 -8
- data/lib/puppet/indirector/file_metadata/rest.rb +52 -0
- data/lib/puppet/indirector/json.rb +1 -1
- data/lib/puppet/indirector/msgpack.rb +1 -1
- data/lib/puppet/indirector/node/rest.rb +24 -0
- data/lib/puppet/indirector/report/rest.rb +19 -0
- data/lib/puppet/indirector/report/yaml.rb +23 -0
- data/lib/puppet/indirector/request.rb +1 -1
- data/lib/puppet/indirector/rest.rb +12 -0
- data/lib/puppet/indirector/status/rest.rb +18 -0
- data/lib/puppet/loaders.rb +6 -0
- data/lib/puppet/metatype/manager.rb +80 -80
- data/lib/puppet/network/http/api/indirected_routes.rb +1 -1
- data/lib/puppet/network/http/api/master/v3/environment.rb +3 -0
- data/lib/puppet/network/http/base_pool.rb +7 -2
- data/lib/puppet/network/http/compression.rb +7 -0
- data/lib/puppet/network/http/connection.rb +6 -0
- data/lib/puppet/network/http/connection_adapter.rb +184 -0
- data/lib/puppet/network/http/nocache_pool.rb +2 -0
- data/lib/puppet/network/http/pool.rb +13 -6
- data/lib/puppet/network/http_pool.rb +2 -1
- data/lib/puppet/node/environment.rb +11 -1
- data/lib/puppet/pal/catalog_compiler.rb +5 -0
- data/lib/puppet/pal/pal_impl.rb +4 -29
- data/lib/puppet/parser/ast/leaf.rb +5 -5
- data/lib/puppet/parser/ast/pops_bridge.rb +6 -15
- data/lib/puppet/parser/compiler.rb +43 -33
- 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 +4 -1
- data/lib/puppet/parser/functions.rb +18 -13
- data/lib/puppet/parser/functions/filter.rb +1 -0
- data/lib/puppet/parser/resource.rb +3 -2
- data/lib/puppet/parser/resource/param.rb +6 -0
- data/lib/puppet/pops/evaluator/access_operator.rb +2 -2
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +6 -6
- data/lib/puppet/pops/issues.rb +5 -0
- data/lib/puppet/pops/loader/puppet_plan_instantiator.rb +12 -3
- data/lib/puppet/pops/loaders.rb +7 -5
- data/lib/puppet/pops/parser/evaluating_parser.rb +5 -7
- data/lib/puppet/pops/resource/resource_type_impl.rb +2 -0
- data/lib/puppet/pops/types/p_object_type_extension.rb +10 -0
- data/lib/puppet/pops/types/type_calculator.rb +24 -0
- data/lib/puppet/pops/validation/checker4_0.rb +11 -1
- data/lib/puppet/pops/validation/tasks_checker.rb +5 -1
- data/lib/puppet/pops/validation/validator_factory_4_0.rb +1 -0
- data/lib/puppet/provider/aix_object.rb +4 -2
- data/lib/puppet/provider/group/aix.rb +1 -0
- data/lib/puppet/provider/group/groupadd.rb +57 -24
- data/lib/puppet/provider/group/windows_adsi.rb +3 -3
- data/lib/puppet/provider/package/aix.rb +17 -2
- data/lib/puppet/provider/package/apt.rb +78 -4
- data/lib/puppet/provider/package/aptitude.rb +1 -1
- data/lib/puppet/provider/package/dnfmodule.rb +69 -15
- data/lib/puppet/provider/package/dpkg.rb +14 -7
- data/lib/puppet/provider/package/fink.rb +20 -3
- data/lib/puppet/provider/package/gem.rb +41 -7
- data/lib/puppet/provider/package/openbsd.rb +13 -1
- data/lib/puppet/provider/package/pacman.rb +2 -5
- data/lib/puppet/provider/package/pip.rb +143 -48
- data/lib/puppet/provider/package/pip3.rb +0 -2
- 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 +2 -2
- data/lib/puppet/provider/package/puppet_gem.rb +6 -2
- data/lib/puppet/provider/package/rpm.rb +6 -213
- data/lib/puppet/provider/package/yum.rb +109 -25
- data/lib/puppet/provider/package/zypper.rb +59 -1
- data/lib/puppet/provider/service/systemd.rb +22 -4
- data/lib/puppet/provider/service/windows.rb +23 -7
- data/lib/puppet/provider/user/aix.rb +1 -0
- data/lib/puppet/provider/user/directoryservice.rb +30 -5
- data/lib/puppet/provider/user/useradd.rb +22 -12
- data/lib/puppet/reports/http.rb +15 -9
- data/lib/puppet/reports/store.rb +1 -1
- data/lib/puppet/resource.rb +2 -1
- data/lib/puppet/resource/type.rb +8 -0
- data/lib/puppet/resource/type_collection.rb +20 -16
- data/lib/puppet/runtime.rb +31 -1
- data/lib/puppet/settings.rb +4 -0
- data/lib/puppet/settings/http_extra_headers_setting.rb +25 -0
- data/lib/puppet/ssl.rb +1 -0
- data/lib/puppet/ssl/certificate.rb +2 -1
- data/lib/puppet/ssl/host.rb +4 -4
- data/lib/puppet/ssl/oids.rb +1 -0
- data/lib/puppet/ssl/ssl_context.rb +2 -2
- data/lib/puppet/ssl/ssl_provider.rb +20 -1
- data/lib/puppet/ssl/state_machine.rb +81 -35
- data/lib/puppet/ssl/verifier_adapter.rb +9 -1
- data/lib/puppet/test/test_helper.rb +15 -11
- data/lib/puppet/transaction/report.rb +2 -2
- data/lib/puppet/transaction/resource_harness.rb +1 -1
- data/lib/puppet/trusted_external.rb +29 -1
- data/lib/puppet/type.rb +18 -6
- data/lib/puppet/type/file.rb +51 -13
- data/lib/puppet/type/file/checksum.rb +4 -4
- data/lib/puppet/type/file/source.rb +51 -60
- data/lib/puppet/type/group.rb +2 -2
- data/lib/puppet/type/package.rb +102 -10
- data/lib/puppet/type/service.rb +55 -8
- data/lib/puppet/type/user.rb +3 -28
- data/lib/puppet/util.rb +39 -15
- data/lib/puppet/util/at_fork.rb +1 -1
- data/lib/puppet/util/autoload.rb +4 -18
- data/lib/puppet/util/checksums.rb +19 -4
- data/lib/puppet/util/fileparsing.rb +2 -2
- data/lib/puppet/util/instance_loader.rb +14 -10
- data/lib/puppet/util/log/destinations.rb +2 -11
- data/lib/puppet/util/package/version/debian.rb +175 -0
- data/lib/puppet/util/package/version/gem.rb +15 -0
- data/lib/puppet/util/package/version/pip.rb +167 -0
- data/lib/puppet/util/package/version/range.rb +53 -0
- data/lib/puppet/util/package/version/range/eq.rb +14 -0
- data/lib/puppet/util/package/version/range/gt.rb +14 -0
- data/lib/puppet/util/package/version/range/gt_eq.rb +14 -0
- data/lib/puppet/util/package/version/range/lt.rb +14 -0
- data/lib/puppet/util/package/version/range/lt_eq.rb +14 -0
- data/lib/puppet/util/package/version/range/min_max.rb +21 -0
- data/lib/puppet/util/package/version/range/simple.rb +11 -0
- data/lib/puppet/util/package/version/rpm.rb +73 -0
- data/lib/puppet/util/pidlock.rb +36 -10
- data/lib/puppet/util/platform.rb +5 -0
- data/lib/puppet/util/plist.rb +6 -0
- data/lib/puppet/util/provider_features.rb +1 -1
- data/lib/puppet/util/reference.rb +1 -1
- data/lib/puppet/util/rpm_compare.rb +193 -0
- data/lib/puppet/util/storage.rb +0 -1
- data/lib/puppet/util/windows/adsi.rb +2 -2
- 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 +15 -14
- data/lib/puppet/util/windows/registry.rb +11 -11
- data/lib/puppet/util/windows/security.rb +1 -0
- data/lib/puppet/util/windows/service.rb +43 -26
- data/lib/puppet/util/windows/sid.rb +3 -3
- data/lib/puppet/util/windows/user.rb +23 -8
- data/lib/puppet/util/yaml.rb +1 -1
- data/lib/puppet/version.rb +1 -1
- data/locales/puppet.pot +707 -574
- data/man/man5/puppet.conf.5 +74 -14
- data/man/man8/puppet-agent.8 +7 -7
- 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 +2 -2
- 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 +17 -2
- data/man/man8/puppet-generate.8 +1 -1
- data/man/man8/puppet-help.8 +6 -3
- 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 +4 -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 +2 -2
- data/man/man8/puppet-status.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/fixtures/ssl/unknown-127.0.0.1-key.pem +67 -0
- data/spec/fixtures/ssl/unknown-127.0.0.1.pem +48 -0
- data/spec/fixtures/ssl/unknown-ca-key.pem +67 -0
- data/spec/fixtures/ssl/unknown-ca.pem +59 -0
- data/spec/fixtures/unit/provider/package/dnfmodule/{dnf-module-list-installed.txt → dnf-module-list.txt} +8 -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/package/zypper/zypper-search-uninstalled.out +13 -0
- data/spec/fixtures/unit/provider/service/systemd/list_unit_files_services +9 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_fetch_if_not_on_the_local_disk.yml +1 -102
- data/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 +1 -106
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_update_if_content_differs_on_disk.yml +1 -106
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_mtime_is_older_on_disk.yml +1 -102
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_no_header_specified.yml +1 -98
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_not_on_the_local_disk.yml +1 -102
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_not_update_if_mtime_is_newer_on_disk.yml +1 -102
- data/spec/integration/application/agent_spec.rb +483 -0
- data/spec/integration/application/apply_spec.rb +132 -3
- data/spec/integration/application/filebucket_spec.rb +190 -0
- data/spec/integration/application/plugin_spec.rb +73 -0
- data/spec/integration/configurer_spec.rb +26 -7
- data/spec/integration/defaults_spec.rb +1 -2
- data/spec/integration/http/client_spec.rb +47 -37
- data/spec/integration/indirector/facts/facter_spec.rb +4 -0
- data/spec/integration/indirector/report/yaml.rb +83 -0
- data/spec/integration/module_tool/forge_spec.rb +2 -15
- data/spec/integration/network/http_pool_spec.rb +93 -20
- data/spec/integration/node/environment_spec.rb +15 -0
- data/spec/integration/parser/compiler_spec.rb +11 -0
- data/spec/integration/type/file_spec.rb +1 -1
- data/spec/integration/util/windows/adsi_spec.rb +6 -1
- data/spec/integration/util/windows/registry_spec.rb +7 -7
- data/spec/integration/util/windows/user_spec.rb +40 -5
- data/spec/lib/puppet/test_ca.rb +2 -2
- data/spec/lib/puppet_spec/https.rb +16 -7
- data/spec/lib/puppet_spec/puppetserver.rb +119 -0
- data/spec/shared_contexts/https.rb +29 -0
- data/spec/unit/agent_spec.rb +80 -26
- data/spec/unit/application/agent_spec.rb +9 -5
- data/spec/unit/application/apply_spec.rb +2 -12
- data/spec/unit/application/describe_spec.rb +88 -50
- data/spec/unit/application/device_spec.rb +2 -2
- data/spec/unit/application/filebucket_spec.rb +22 -2
- data/spec/unit/application/resource_spec.rb +2 -2
- data/spec/unit/configurer/fact_handler_spec.rb +4 -8
- data/spec/unit/configurer/plugin_handler_spec.rb +36 -19
- data/spec/unit/configurer_spec.rb +17 -18
- data/spec/unit/context/trusted_information_spec.rb +25 -2
- data/spec/unit/daemon_spec.rb +5 -64
- data/spec/unit/defaults_spec.rb +25 -2
- data/spec/unit/environments_spec.rb +65 -28
- data/spec/unit/face/facts_spec.rb +24 -20
- data/spec/unit/face/module/search_spec.rb +17 -0
- data/spec/unit/face/plugin_spec.rb +12 -10
- data/spec/unit/file_serving/http_metadata_spec.rb +37 -14
- data/spec/unit/file_serving/terminus_selector_spec.rb +45 -26
- data/spec/unit/file_system/uniquefile_spec.rb +11 -0
- data/spec/unit/file_system_spec.rb +26 -2
- data/spec/unit/functions/lookup_spec.rb +13 -0
- data/spec/unit/http/client_spec.rb +327 -35
- data/spec/unit/http/external_client_spec.rb +201 -0
- data/spec/unit/http/resolver_spec.rb +34 -2
- data/spec/unit/http/response_spec.rb +75 -0
- data/spec/unit/http/service/ca_spec.rb +53 -11
- data/spec/unit/http/service/compiler_spec.rb +627 -0
- data/spec/unit/http/service/file_server_spec.rb +308 -0
- data/spec/unit/http/service/report_spec.rb +27 -9
- data/spec/unit/http/service_spec.rb +98 -5
- data/spec/unit/http/session_spec.rb +190 -7
- data/spec/unit/indirector/catalog/compiler_spec.rb +47 -29
- data/spec/unit/indirector/catalog/rest_spec.rb +59 -2
- data/spec/unit/indirector/facts/rest_spec.rb +79 -24
- data/spec/unit/indirector/file_bucket_file/rest_spec.rb +82 -2
- data/spec/unit/indirector/file_content/rest_spec.rb +53 -2
- data/spec/unit/indirector/file_metadata/http_spec.rb +194 -0
- data/spec/unit/indirector/file_metadata/rest_spec.rb +110 -2
- data/spec/unit/indirector/node/rest_spec.rb +57 -2
- data/spec/unit/indirector/report/rest_spec.rb +58 -51
- data/spec/unit/indirector/request_spec.rb +1 -1
- data/spec/unit/indirector/resource/ral_spec.rb +7 -8
- data/spec/unit/indirector/rest_spec.rb +13 -0
- data/spec/unit/indirector/status/rest_spec.rb +43 -2
- data/spec/unit/interface_spec.rb +3 -3
- data/spec/unit/network/http/api/indirected_routes_spec.rb +2 -1
- data/spec/unit/network/http/connection_spec.rb +559 -175
- data/spec/unit/network/http/nocache_pool_spec.rb +25 -3
- data/spec/unit/network/http/pool_spec.rb +89 -11
- data/spec/unit/network/http_pool_spec.rb +63 -57
- data/spec/unit/network/http_spec.rb +1 -1
- data/spec/unit/node/environment_spec.rb +16 -0
- data/spec/unit/node/facts_spec.rb +2 -1
- data/spec/unit/node_spec.rb +7 -4
- data/spec/unit/parser/ast/block_expression_spec.rb +1 -1
- data/spec/unit/parser/environment_compiler_spec.rb +7 -0
- data/spec/unit/parser/scope_spec.rb +1 -1
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +15 -1
- data/spec/unit/pops/loaders/loaders_spec.rb +1 -1
- data/spec/unit/pops/serialization/to_from_hr_spec.rb +6 -1
- data/spec/unit/pops/types/type_calculator_spec.rb +1 -11
- data/spec/unit/pops/validator/validator_spec.rb +7 -2
- data/spec/unit/provider/aix_object_spec.rb +16 -2
- data/spec/unit/provider/group/groupadd_spec.rb +181 -56
- 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 +43 -2
- data/spec/unit/provider/package/aptitude_spec.rb +1 -0
- data/spec/unit/provider/package/dnfmodule_spec.rb +76 -15
- data/spec/unit/provider/package/dpkg_spec.rb +28 -6
- data/spec/unit/provider/package/gem_spec.rb +40 -0
- data/spec/unit/provider/package/openbsd_spec.rb +17 -0
- data/spec/unit/provider/package/pacman_spec.rb +6 -21
- data/spec/unit/provider/package/pip_spec.rb +68 -19
- data/spec/unit/provider/package/pkg_spec.rb +15 -1
- data/spec/unit/provider/package/pkgdmg_spec.rb +1 -1
- data/spec/unit/provider/package/pkgng_spec.rb +38 -0
- data/spec/unit/provider/package/portage_spec.rb +5 -0
- data/spec/unit/provider/package/puppet_gem_spec.rb +8 -0
- data/spec/unit/provider/package/rpm_spec.rb +0 -212
- data/spec/unit/provider/package/yum_spec.rb +292 -0
- data/spec/unit/provider/package/zypper_spec.rb +84 -0
- data/spec/unit/provider/service/init_spec.rb +1 -0
- data/spec/unit/provider/service/openbsd_spec.rb +9 -0
- data/spec/unit/provider/service/openwrt_spec.rb +1 -0
- data/spec/unit/provider/service/redhat_spec.rb +9 -0
- data/spec/unit/provider/service/systemd_spec.rb +92 -12
- data/spec/unit/provider/service/windows_spec.rb +22 -14
- data/spec/unit/provider/user/directoryservice_spec.rb +41 -0
- data/spec/unit/provider/user/openbsd_spec.rb +1 -0
- data/spec/unit/provider/user/useradd_spec.rb +43 -24
- data/spec/unit/provider/user/windows_adsi_spec.rb +3 -3
- data/spec/unit/puppet_pal_2pec.rb +0 -26
- data/spec/unit/puppet_pal_catalog_spec.rb +46 -0
- data/spec/unit/puppet_spec.rb +47 -0
- data/spec/unit/reports/http_spec.rb +70 -52
- data/spec/unit/resource_spec.rb +3 -3
- data/spec/unit/settings/autosign_setting_spec.rb +1 -1
- data/spec/unit/settings/http_extra_headers_spec.rb +64 -0
- data/spec/unit/ssl/certificate_spec.rb +7 -0
- data/spec/unit/ssl/host_spec.rb +4 -2
- data/spec/unit/ssl/oids_spec.rb +1 -0
- data/spec/unit/ssl/ssl_provider_spec.rb +69 -43
- data/spec/unit/ssl/state_machine_spec.rb +99 -13
- data/spec/unit/test/test_helper_spec.rb +17 -0
- data/spec/unit/transaction/persistence_spec.rb +1 -10
- data/spec/unit/transaction/report_spec.rb +5 -1
- data/spec/unit/transaction_spec.rb +0 -2
- data/spec/unit/type/file/ensure_spec.rb +1 -2
- data/spec/unit/type/file/source_spec.rb +89 -38
- data/spec/unit/type/file_spec.rb +122 -96
- data/spec/unit/type/package_spec.rb +8 -0
- data/spec/unit/type/service_spec.rb +185 -8
- data/spec/unit/type/user_spec.rb +1 -2
- data/spec/unit/type_spec.rb +50 -0
- data/spec/unit/util/at_fork_spec.rb +3 -2
- data/spec/unit/util/autoload_spec.rb +2 -1
- data/spec/unit/util/checksums_spec.rb +16 -0
- data/spec/unit/util/log/destinations_spec.rb +1 -29
- data/spec/unit/util/package/version/debian_spec.rb +83 -0
- data/spec/unit/util/package/version/pip_spec.rb +464 -0
- data/spec/unit/util/package/version/range_spec.rb +175 -0
- data/spec/unit/util/package/version/rpm_spec.rb +121 -0
- data/spec/unit/util/pidlock_spec.rb +112 -42
- data/spec/unit/util/plist_spec.rb +20 -0
- data/spec/unit/util/rpm_compare_spec.rb +196 -0
- data/spec/unit/util/storage_spec.rb +1 -8
- data/spec/unit/util/windows/adsi_spec.rb +4 -4
- data/spec/unit/util/windows/api_types_spec.rb +104 -40
- data/spec/unit/util/windows/service_spec.rb +4 -4
- data/spec/unit/util/windows/sid_spec.rb +2 -2
- data/spec/unit/util_spec.rb +3 -3
- data/spec/unit/x509/cert_provider_spec.rb +1 -1
- data/tasks/generate_cert_fixtures.rake +15 -1
- data/tasks/manpages.rake +5 -35
- metadata +73 -12
- data/COMMITTERS.md +0 -244
- data/spec/integration/faces/plugin_spec.rb +0 -61
- data/spec/integration/test/test_helper_spec.rb +0 -31
data/lib/puppet/type/group.rb
CHANGED
@@ -22,7 +22,7 @@ module Puppet
|
|
22
22
|
feature :system_groups,
|
23
23
|
"The provider allows you to create system groups with lower GIDs."
|
24
24
|
|
25
|
-
feature :
|
25
|
+
feature :manages_local_users_and_groups,
|
26
26
|
"Allows local groups to be managed on systems that also use some other
|
27
27
|
remote Name Switch Service (NSS) method of managing accounts."
|
28
28
|
|
@@ -214,7 +214,7 @@ module Puppet
|
|
214
214
|
end
|
215
215
|
|
216
216
|
newparam(:forcelocal, :boolean => true,
|
217
|
-
:required_features => :
|
217
|
+
:required_features => :manages_local_users_and_groups,
|
218
218
|
:parent => Puppet::Parameter::Boolean) do
|
219
219
|
desc "Forces the management of local accounts when accounts are also
|
220
220
|
being managed by some other Name Switch Service (NSS). For AIX, refer to the `ia_load_module` parameter.
|
data/lib/puppet/type/package.rb
CHANGED
@@ -51,17 +51,21 @@ module Puppet
|
|
51
51
|
package database for installed version(s), and can select
|
52
52
|
which out of a set of available versions of a package to
|
53
53
|
install if asked."
|
54
|
+
feature :version_ranges, "The provider can ensure version ranges."
|
54
55
|
feature :holdable, "The provider is capable of placing packages on hold
|
55
56
|
such that they are not automatically upgraded as a result of
|
56
57
|
other package dependencies unless explicit action is taken by
|
57
|
-
a user or another package.
|
58
|
-
|
59
|
-
:methods => [:hold]
|
58
|
+
a user or another package.",
|
59
|
+
:methods => [:hold, :unhold]
|
60
60
|
feature :install_only, "The provider accepts options to only install packages never update (kernels, etc.)"
|
61
61
|
feature :install_options, "The provider accepts options to be
|
62
62
|
passed to the installer command."
|
63
63
|
feature :uninstall_options, "The provider accepts options to be
|
64
64
|
passed to the uninstaller command."
|
65
|
+
feature :disableable, "The provider can disable packages. This feature is used by specifying `disabled` as the
|
66
|
+
desired value for the package.",
|
67
|
+
:methods => [:disable]
|
68
|
+
feature :supports_flavors, "The provider accepts flavors, which are specific variants of packages."
|
65
69
|
feature :package_settings, "The provider accepts package_settings to be
|
66
70
|
ensured for the given package. The meaning and format of these settings is
|
67
71
|
provider-specific.",
|
@@ -80,10 +84,12 @@ module Puppet
|
|
80
84
|
specifying `purged` as the ensure value. This defaults to `installed`.
|
81
85
|
|
82
86
|
Version numbers must match the full version to install, including
|
83
|
-
release if the provider uses a release moniker.
|
84
|
-
patterns are not accepted except for the `gem` package provider. For
|
87
|
+
release if the provider uses a release moniker. For
|
85
88
|
example, to install the bash package from the rpm
|
86
89
|
`bash-4.1.2-29.el6.x86_64.rpm`, use the string `'4.1.2-29.el6'`.
|
90
|
+
|
91
|
+
On supported providers, version ranges can also be ensured. For example,
|
92
|
+
inequalities: `<2.0.0`, or intersections: `>1.0.0 <2.0.0`.
|
87
93
|
EOT
|
88
94
|
|
89
95
|
attr_accessor :latest
|
@@ -101,7 +107,11 @@ module Puppet
|
|
101
107
|
end
|
102
108
|
|
103
109
|
newvalue(:held, :event => :package_held, :required_features => :holdable) do
|
104
|
-
provider.
|
110
|
+
provider.deprecated_hold
|
111
|
+
end
|
112
|
+
|
113
|
+
newvalue(:disabled, :required_features => :disableable) do
|
114
|
+
provider.disable
|
105
115
|
end
|
106
116
|
|
107
117
|
# Alias the 'present' value.
|
@@ -151,7 +161,7 @@ module Puppet
|
|
151
161
|
@should.each { |should|
|
152
162
|
case should
|
153
163
|
when :present
|
154
|
-
return true unless [:absent, :purged, :held].include?(is)
|
164
|
+
return true unless [:absent, :purged, :held, :disabled].include?(is)
|
155
165
|
when :latest
|
156
166
|
# Short-circuit packages that are not present
|
157
167
|
return false if is == :absent || is == :purged
|
@@ -405,6 +415,16 @@ module Puppet
|
|
405
415
|
end
|
406
416
|
end
|
407
417
|
|
418
|
+
newproperty(:flavor, :required_features => :supports_flavors) do
|
419
|
+
desc "OpenBSD and DNF modules support 'flavors', which are
|
420
|
+
further specifications for which type of package you want."
|
421
|
+
validate do |value|
|
422
|
+
if [:disabled, "disabled"].include?(@resource[:ensure]) && value
|
423
|
+
raise ArgumentError, _('Cannot have both `ensure => disabled` and `flavor`')
|
424
|
+
end
|
425
|
+
end
|
426
|
+
end
|
427
|
+
|
408
428
|
newparam(:source) do
|
409
429
|
desc "Where to find the package file. This is only used by providers that don't
|
410
430
|
automatically download packages from a central repository. (For example:
|
@@ -484,9 +504,27 @@ module Puppet
|
|
484
504
|
newvalues(:true, :false)
|
485
505
|
end
|
486
506
|
|
487
|
-
newparam(:
|
488
|
-
desc
|
489
|
-
|
507
|
+
newparam(:enable_only, :boolean => false, :parent => Puppet::Parameter::Boolean) do
|
508
|
+
desc <<-EOT
|
509
|
+
Tells `dnf module` to only enable a specific module, instead
|
510
|
+
of installing its default profile.
|
511
|
+
|
512
|
+
Modules with no default profile will be enabled automatically
|
513
|
+
without the use of this parameter.
|
514
|
+
|
515
|
+
Conflicts with the `flavor` property, which selects a profile
|
516
|
+
to install.
|
517
|
+
EOT
|
518
|
+
defaultto false
|
519
|
+
|
520
|
+
validate do |value|
|
521
|
+
if [true, :true, "true"].include?(value) && @resource[:flavor]
|
522
|
+
raise ArgumentError, _('Cannot have both `enable_only => true` and `flavor`')
|
523
|
+
end
|
524
|
+
if [:disabled, "disabled"].include?(@resource[:ensure])
|
525
|
+
raise ArgumentError, _('Cannot have both `ensure => disabled` and `enable_only => true`')
|
526
|
+
end
|
527
|
+
end
|
490
528
|
end
|
491
529
|
|
492
530
|
newparam(:install_only, :boolean => false, :parent => Puppet::Parameter::Boolean, :required_features => :install_only) do
|
@@ -625,5 +663,59 @@ module Puppet
|
|
625
663
|
provider.reinstall
|
626
664
|
end
|
627
665
|
end
|
666
|
+
|
667
|
+
newproperty(:mark, :required_features => :holdable) do
|
668
|
+
mark_doc='Valid values are: hold/none'
|
669
|
+
desc <<-EOT
|
670
|
+
Set to hold to tell Debian apt/Solaris pkg to hold the package version
|
671
|
+
|
672
|
+
#{mark_doc}
|
673
|
+
Default is "none". Mark can be specified with or without `ensure`,
|
674
|
+
if `ensure` is missing will default to "present".
|
675
|
+
|
676
|
+
Mark cannot be specified together with "purged", "absent" or "held"
|
677
|
+
values for `ensure`.
|
678
|
+
EOT
|
679
|
+
newvalues(:hold, :none)
|
680
|
+
munge do |value|
|
681
|
+
case value
|
682
|
+
when "hold", :hold
|
683
|
+
:hold
|
684
|
+
when "none", :none
|
685
|
+
:none
|
686
|
+
else
|
687
|
+
raise ArgumentError, _('Invalid hold value %{value}. %{doc}') % { value: value.inspect, doc: mark_doc}
|
688
|
+
end
|
689
|
+
end
|
690
|
+
|
691
|
+
def insync?(is)
|
692
|
+
@should[0] == is
|
693
|
+
end
|
694
|
+
|
695
|
+
def should
|
696
|
+
@should[0] if @should && @should.is_a?(Array) && @should.size == 1
|
697
|
+
end
|
698
|
+
|
699
|
+
def retrieve
|
700
|
+
provider.properties[:mark]
|
701
|
+
end
|
702
|
+
|
703
|
+
def sync
|
704
|
+
if @should[0] == :hold
|
705
|
+
provider.hold
|
706
|
+
else
|
707
|
+
provider.unhold
|
708
|
+
end
|
709
|
+
end
|
710
|
+
end
|
711
|
+
|
712
|
+
validate do
|
713
|
+
if :held == @parameters[:ensure].should
|
714
|
+
warning '"ensure=>held" has been deprecated and will be removed in a future version, use "mark=hold" instead'
|
715
|
+
end
|
716
|
+
if @parameters[:mark] && [:absent, :purged, :held].include?(@parameters[:ensure].should)
|
717
|
+
raise ArgumentError, _('You cannot use "mark" property while "ensure" is one of ["absent", "purged", "held"]')
|
718
|
+
end
|
719
|
+
end
|
628
720
|
end
|
629
721
|
end
|
data/lib/puppet/type/service.rb
CHANGED
@@ -47,11 +47,17 @@ module Puppet
|
|
47
47
|
|
48
48
|
feature :configurable_timeout, "The provider can specify a minumum timeout for syncing service properties"
|
49
49
|
|
50
|
+
feature :manages_logon_credentials, "The provider can specify the logon credentials used for a service"
|
51
|
+
|
50
52
|
newproperty(:enable, :required_features => :enableable) do
|
51
53
|
desc "Whether a service should be enabled to start at boot.
|
52
54
|
This property behaves differently depending on the platform;
|
53
55
|
wherever possible, it relies on local tools to enable or disable
|
54
|
-
a given service. Default values depend on the platform.
|
56
|
+
a given service. Default values depend on the platform.
|
57
|
+
|
58
|
+
If you don't specify a value for the `enable` attribute, Puppet leaves
|
59
|
+
that aspect of the service alone and your operating system determines
|
60
|
+
the behavior."
|
55
61
|
|
56
62
|
newvalue(:true, :event => :service_enabled) do
|
57
63
|
provider.enable
|
@@ -80,14 +86,8 @@ module Puppet
|
|
80
86
|
provider.delayed_start
|
81
87
|
end
|
82
88
|
|
83
|
-
# This only makes sense on systemd systems. Static services cannot be enabled
|
84
|
-
# or disabled manually.
|
85
89
|
def insync?(current)
|
86
|
-
|
87
|
-
Puppet.debug("Unable to enable or disable static service #{@resource[:name]}")
|
88
|
-
return true
|
89
|
-
end
|
90
|
-
|
90
|
+
return provider.enabled_insync?(current) if provider.respond_to?(:enabled_insync?)
|
91
91
|
super(current)
|
92
92
|
end
|
93
93
|
|
@@ -118,6 +118,12 @@ module Puppet
|
|
118
118
|
end
|
119
119
|
|
120
120
|
def sync
|
121
|
+
property = @resource.property(:logonaccount)
|
122
|
+
if property
|
123
|
+
val = property.retrieve
|
124
|
+
property.sync unless property.safe_insync?(val)
|
125
|
+
end
|
126
|
+
|
121
127
|
event = super()
|
122
128
|
|
123
129
|
property = @resource.property(:enable)
|
@@ -130,6 +136,47 @@ module Puppet
|
|
130
136
|
end
|
131
137
|
end
|
132
138
|
|
139
|
+
newproperty(:logonaccount, :required_features => :manages_logon_credentials) do
|
140
|
+
desc "Specify an account for service logon"
|
141
|
+
|
142
|
+
munge do |value|
|
143
|
+
return value unless Puppet::Util::Platform.windows?
|
144
|
+
return 'LocalSystem' if Puppet::Util::Windows::User::localsystem?(value)
|
145
|
+
|
146
|
+
value.sub!(/^\.\\/, "#{Puppet::Util::Windows::ADSI.computer_name}\\")
|
147
|
+
user_information = Puppet::Util::Windows::SID.name_to_principal(value)
|
148
|
+
raise Puppet::Error.new("\"#{value}\" is not a valid account") unless user_information && [:SidTypeUser, :SidTypeWellKnownGroup].include?(user_information.account_type)
|
149
|
+
|
150
|
+
if user_information.domain == Puppet::Util::Windows::ADSI.computer_name
|
151
|
+
".\\#{user_information.account}"
|
152
|
+
else
|
153
|
+
user_information.domain_account
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
newparam(:logonpassword, :required_features => :manages_logon_credentials) do
|
159
|
+
desc "Specify a password for service logon. Default value is an empty string (when logonaccount is specified)."
|
160
|
+
|
161
|
+
validate do |value|
|
162
|
+
raise Puppet::Error.new(_"The 'logonaccount' parameter is mandatory when setting 'logonpassword'.") unless @resource[:logonaccount]
|
163
|
+
raise ArgumentError, _("Passwords cannot include ':'") if value.is_a?(String) and value.include?(":")
|
164
|
+
return unless Puppet::Util::Platform.windows?
|
165
|
+
|
166
|
+
is_a_predefined_local_account = Puppet::Util::Windows::User::default_system_account?(@resource[:logonaccount]) || @resource[:logonaccount] == 'LocalSystem'
|
167
|
+
|
168
|
+
account_info = @resource[:logonaccount].split("\\")
|
169
|
+
able_to_logon = Puppet::Util::Windows::User.password_is?(account_info[1], value, account_info[0]) unless is_a_predefined_local_account
|
170
|
+
|
171
|
+
raise Puppet::Error.new("The given password is invalid for user '#{@resource[:logonaccount]}'.") unless is_a_predefined_local_account || able_to_logon
|
172
|
+
|
173
|
+
provider.logonpassword=(value)
|
174
|
+
end
|
175
|
+
|
176
|
+
sensitive true
|
177
|
+
defaultto { @resource[:logonaccount] ? "" : nil }
|
178
|
+
end
|
179
|
+
|
133
180
|
newproperty(:flags, :required_features => :flaggable) do
|
134
181
|
desc "Specify a string of flags to pass to the startup script."
|
135
182
|
end
|
data/lib/puppet/type/user.rb
CHANGED
@@ -51,7 +51,7 @@ module Puppet
|
|
51
51
|
feature :manages_aix_lam,
|
52
52
|
"The provider can manage AIX Loadable Authentication Module (LAM) system."
|
53
53
|
|
54
|
-
feature :
|
54
|
+
feature :manages_local_users_and_groups,
|
55
55
|
"Allows local users to be managed on systems that also use some other
|
56
56
|
remote Name Service Switch (NSS) method of managing accounts."
|
57
57
|
|
@@ -493,25 +493,6 @@ module Puppet
|
|
493
493
|
provider.exists?
|
494
494
|
end
|
495
495
|
|
496
|
-
def retrieve
|
497
|
-
absent = false
|
498
|
-
properties.inject({}) { |prophash, property|
|
499
|
-
current_value = :absent
|
500
|
-
|
501
|
-
if absent
|
502
|
-
prophash[property] = :absent
|
503
|
-
else
|
504
|
-
current_value = property.retrieve
|
505
|
-
prophash[property] = current_value
|
506
|
-
end
|
507
|
-
|
508
|
-
if property.name == :ensure and current_value == :absent
|
509
|
-
absent = true
|
510
|
-
end
|
511
|
-
prophash
|
512
|
-
}
|
513
|
-
end
|
514
|
-
|
515
496
|
newproperty(:roles, :parent => Puppet::Property::List, :required_features => :manages_solaris_rbac) do
|
516
497
|
desc "The roles the user has. Multiple roles should be
|
517
498
|
specified as an array."
|
@@ -688,7 +669,7 @@ module Puppet
|
|
688
669
|
end
|
689
670
|
|
690
671
|
newparam(:forcelocal, :boolean => true,
|
691
|
-
:required_features => :
|
672
|
+
:required_features => :manages_local_users_and_groups,
|
692
673
|
:parent => Puppet::Parameter::Boolean) do
|
693
674
|
desc "Forces the management of local accounts when accounts are also
|
694
675
|
being managed by some other Name Service Switch (NSS). For AIX, refer to the `ia_load_module` parameter.
|
@@ -755,17 +736,11 @@ module Puppet
|
|
755
736
|
value = test_sym if [:true, :false].include? test_sym
|
756
737
|
|
757
738
|
return [] if value == :false
|
758
|
-
home = resource[:home]
|
759
|
-
if value == :true and not home
|
760
|
-
raise ArgumentError, _("purge_ssh_keys can only be true for users with a defined home directory")
|
761
|
-
end
|
739
|
+
home = resource[:home] || Dir.home(resource[:name])
|
762
740
|
|
763
741
|
return [ "#{home}/.ssh/authorized_keys" ] if value == :true
|
764
742
|
# value is an array - munge each value
|
765
743
|
[ value ].flatten.map do |entry|
|
766
|
-
if entry =~ /^~|^%h/ and not home
|
767
|
-
raise ArgumentError, _("purge_ssh_keys value '%{value}' meta character ~ or %{home_placeholder} only allowed for users with a defined home directory") % { value: value, home_placeholder: '%h' }
|
768
|
-
end
|
769
744
|
# make sure frozen value is duplicated by using a gsub, second mutating gsub! is then ok
|
770
745
|
entry = entry.gsub(/^~\//, "#{home}/")
|
771
746
|
entry.gsub!(/^%h\//, "#{home}/")
|
data/lib/puppet/util.rb
CHANGED
@@ -26,21 +26,20 @@ module Util
|
|
26
26
|
|
27
27
|
extend Puppet::Util::SymbolicFileMode
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
module_function :default_env
|
29
|
+
DEFAULT_ENV = if Puppet::Util::Platform.windows?
|
30
|
+
:windows
|
31
|
+
else
|
32
|
+
:posix
|
33
|
+
end.freeze
|
35
34
|
|
36
35
|
# @param name [String] The name of the environment variable to retrieve
|
37
36
|
# @param mode [Symbol] Which operating system mode to use e.g. :posix or :windows. Use nil to autodetect
|
38
37
|
# @return [String] Value of the specified environment variable. nil if it does not exist
|
39
38
|
# @api private
|
40
|
-
def get_env(name, mode =
|
39
|
+
def get_env(name, mode = DEFAULT_ENV)
|
41
40
|
if mode == :windows
|
42
|
-
Puppet::Util::Windows::Process.get_environment_strings.
|
43
|
-
if name.casecmp(key) == 0
|
41
|
+
Puppet::Util::Windows::Process.get_environment_strings.find do |key, value|
|
42
|
+
if name.casecmp(key) == 0
|
44
43
|
return value
|
45
44
|
end
|
46
45
|
end
|
@@ -54,7 +53,7 @@ module Util
|
|
54
53
|
# @param mode [Symbol] Which operating system mode to use e.g. :posix or :windows. Use nil to autodetect
|
55
54
|
# @return [Hash] A hashtable of all environment variables
|
56
55
|
# @api private
|
57
|
-
def get_environment(mode =
|
56
|
+
def get_environment(mode = DEFAULT_ENV)
|
58
57
|
case mode
|
59
58
|
when :posix
|
60
59
|
ENV.to_hash
|
@@ -69,7 +68,7 @@ module Util
|
|
69
68
|
# Removes all environment variables
|
70
69
|
# @param mode [Symbol] Which operating system mode to use e.g. :posix or :windows. Use nil to autodetect
|
71
70
|
# @api private
|
72
|
-
def clear_environment(mode =
|
71
|
+
def clear_environment(mode = DEFAULT_ENV)
|
73
72
|
case mode
|
74
73
|
when :posix
|
75
74
|
ENV.clear
|
@@ -87,7 +86,7 @@ module Util
|
|
87
86
|
# @param value [String] The value to set the variable to. nil deletes the environment variable
|
88
87
|
# @param mode [Symbol] Which operating system mode to use e.g. :posix or :windows. Use nil to autodetect
|
89
88
|
# @api private
|
90
|
-
def set_env(name, value = nil, mode =
|
89
|
+
def set_env(name, value = nil, mode = DEFAULT_ENV)
|
91
90
|
case mode
|
92
91
|
when :posix
|
93
92
|
ENV[name] = value
|
@@ -102,7 +101,7 @@ module Util
|
|
102
101
|
# @param name [Hash] Environment variables to merge into the existing environment. nil values will remove the variable
|
103
102
|
# @param mode [Symbol] Which operating system mode to use e.g. :posix or :windows. Use nil to autodetect
|
104
103
|
# @api private
|
105
|
-
def merge_environment(env_hash, mode =
|
104
|
+
def merge_environment(env_hash, mode = DEFAULT_ENV)
|
106
105
|
case mode
|
107
106
|
when :posix
|
108
107
|
env_hash.each { |name, val| ENV[name.to_s] = val }
|
@@ -296,6 +295,11 @@ module Util
|
|
296
295
|
AbsolutePathWindows = %r!^(?:(?:[A-Z]:#{slash})|(?:#{slash}#{slash}#{label}#{slash}#{label})|(?:#{slash}#{slash}\?#{slash}#{label}))!io
|
297
296
|
AbsolutePathPosix = %r!^/!
|
298
297
|
def absolute_path?(path, platform=nil)
|
298
|
+
unless path.is_a?(String)
|
299
|
+
Puppet.warning("Cannot check if #{path} is an absolute path because it is a '#{path.class}' and not a String'")
|
300
|
+
return false
|
301
|
+
end
|
302
|
+
|
299
303
|
# Ruby only sets File::ALT_SEPARATOR on Windows and the Ruby standard
|
300
304
|
# library uses that to test what platform it's on. Normally in Puppet we
|
301
305
|
# would use Puppet.features.microsoft_windows?, but this method needs to
|
@@ -356,7 +360,7 @@ module Util
|
|
356
360
|
|
357
361
|
# CGI.unescape doesn't handle space rules properly in uri paths
|
358
362
|
# URI.unescape does, but returns strings in their original encoding
|
359
|
-
path =
|
363
|
+
path = uri_unescape(uri.path.encode(Encoding::UTF_8))
|
360
364
|
|
361
365
|
if Puppet::Util::Platform.windows? && uri.scheme == 'file'
|
362
366
|
if uri.host && !uri.host.empty?
|
@@ -460,7 +464,18 @@ module Util
|
|
460
464
|
# + should be left unencoded
|
461
465
|
# URI::parse and URI::Generic.build don't like paths encoded with CGI.escape
|
462
466
|
# URI.escape does not change / to %2F and : to %3A like CGI.escape
|
463
|
-
|
467
|
+
#
|
468
|
+
# URI.escape is obsolete in Ruby 2.7. Ignore this error until we're able to
|
469
|
+
# switch to a different escape mechanism. If this is JRuby, we can't mask
|
470
|
+
# the error message, because this isn't thread safe. JRuby shouldn't be
|
471
|
+
# using Ruby 2.7 or raising the warning anyway.
|
472
|
+
orig_verbose = $VERBOSE
|
473
|
+
$VERBOSE = nil unless Puppet::Util::Platform.jruby?
|
474
|
+
begin
|
475
|
+
encoded += URI.escape(parts[:path]) unless parts[:path].nil?
|
476
|
+
ensure
|
477
|
+
$VERBOSE = orig_verbose unless Puppet::Util::Platform.jruby?
|
478
|
+
end
|
464
479
|
|
465
480
|
# each query parameter
|
466
481
|
if !parts[:query].nil?
|
@@ -479,6 +494,15 @@ module Util
|
|
479
494
|
end
|
480
495
|
module_function :uri_encode
|
481
496
|
|
497
|
+
def uri_unescape(path)
|
498
|
+
orig_verbose = $VERBOSE
|
499
|
+
$VERBOSE = nil unless Puppet::Util::Platform.jruby?
|
500
|
+
return URI.unescape(path)
|
501
|
+
ensure
|
502
|
+
$VERBOSE = orig_verbose unless Puppet::Util::Platform.jruby?
|
503
|
+
end
|
504
|
+
module_function :uri_unescape
|
505
|
+
|
482
506
|
def safe_posix_fork(stdin=$stdin, stdout=$stdout, stderr=$stderr, &block)
|
483
507
|
child_pid = Kernel.fork do
|
484
508
|
STDIN.reopen(stdin)
|