puppet 4.2.3-x86-mingw32 → 4.3.0-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/Gemfile +3 -0
- data/README.md +1 -1
- data/ext/debian/puppet.init +0 -1
- data/ext/debian/puppet.logrotate +14 -5
- data/ext/osx/puppet.plist +0 -2
- data/ext/redhat/client.init +13 -5
- data/ext/redhat/logrotate +15 -3
- data/ext/redhat/puppet.spec.erb +5 -1
- data/ext/redhat/server.init +1 -1
- data/ext/systemd/puppet.service +1 -0
- data/lib/puppet.rb +12 -0
- data/lib/puppet/agent.rb +4 -4
- data/lib/puppet/agent/locker.rb +11 -2
- data/lib/puppet/application/agent.rb +5 -1
- data/lib/puppet/application/apply.rb +4 -0
- data/lib/puppet/application/filebucket.rb +78 -4
- data/lib/puppet/application/lookup.rb +356 -0
- data/lib/puppet/application/master.rb +3 -0
- data/lib/puppet/configurer.rb +9 -5
- data/lib/puppet/context.rb +16 -1
- data/lib/puppet/context/trusted_information.rb +21 -1
- data/lib/puppet/daemon.rb +17 -13
- data/lib/puppet/data_binding.rb +4 -2
- data/lib/puppet/data_providers.rb +12 -13
- data/lib/puppet/data_providers/data_adapter.rb +7 -68
- data/lib/puppet/data_providers/data_function_support.rb +5 -26
- data/lib/puppet/data_providers/function_env_data_provider.rb +0 -10
- data/lib/puppet/data_providers/function_module_data_provider.rb +0 -22
- data/lib/puppet/data_providers/hiera_config.rb +106 -0
- data/lib/puppet/data_providers/hiera_env_data_provider.rb +18 -0
- data/lib/puppet/data_providers/hiera_interpolate.rb +97 -0
- data/lib/puppet/data_providers/hiera_module_data_provider.rb +23 -0
- data/lib/puppet/data_providers/hiera_support.rb +37 -0
- data/lib/puppet/data_providers/json_data_provider_factory.rb +31 -0
- data/lib/puppet/data_providers/lookup_adapter.rb +200 -0
- data/lib/puppet/data_providers/yaml_data_provider_factory.rb +32 -0
- data/lib/puppet/defaults.rb +12 -2
- data/lib/puppet/error.rb +4 -0
- data/lib/puppet/face/module/changes.rb +2 -1
- data/lib/puppet/feature/cfacter.rb +1 -0
- data/lib/puppet/file_bucket/dipper.rb +58 -2
- data/lib/puppet/functions.rb +2 -4
- data/lib/puppet/functions/assert_type.rb +48 -12
- data/lib/puppet/functions/defined.rb +79 -48
- data/lib/puppet/functions/each.rb +85 -27
- data/lib/puppet/functions/filter.rb +58 -23
- data/lib/puppet/functions/hiera.rb +76 -3
- data/lib/puppet/functions/hiera_array.rb +65 -3
- data/lib/puppet/functions/hiera_hash.rb +74 -2
- data/lib/puppet/functions/hiera_include.rb +75 -2
- data/lib/puppet/functions/lookup.rb +19 -17
- data/lib/puppet/functions/map.rb +56 -21
- data/lib/puppet/functions/match.rb +29 -12
- data/lib/puppet/functions/reduce.rb +95 -58
- data/lib/puppet/functions/versioncmp.rb +36 -0
- data/lib/puppet/functions/with.rb +15 -7
- data/lib/puppet/indirector/catalog/compiler.rb +3 -3
- data/lib/puppet/indirector/catalog/static_compiler.rb +46 -30
- data/lib/puppet/indirector/data_binding/none.rb +4 -1
- data/lib/puppet/indirector/file_bucket_file/file.rb +58 -1
- data/lib/puppet/indirector/hiera.rb +4 -0
- data/lib/puppet/indirector/json.rb +1 -1
- data/lib/puppet/indirector/msgpack.rb +1 -1
- data/lib/puppet/indirector/request.rb +7 -8
- data/lib/puppet/indirector/resource_type/parser.rb +5 -3
- data/lib/puppet/info_service.rb +7 -0
- data/lib/puppet/info_service/class_information_service.rb +111 -0
- data/lib/puppet/module_tool/metadata.rb +32 -9
- data/lib/puppet/module_tool/skeleton/templates/generator/README.md.erb +42 -38
- data/lib/puppet/network/authconfig.rb +21 -1
- data/lib/puppet/network/authorization.rb +8 -1
- data/lib/puppet/network/http/api/master/v3.rb +7 -1
- data/lib/puppet/network/http/api/master/v3/environment.rb +59 -0
- data/lib/puppet/node/environment.rb +9 -2
- data/lib/puppet/parser.rb +3 -0
- data/lib/puppet/parser/ast/pops_bridge.rb +39 -1
- data/lib/puppet/parser/compiler.rb +302 -12
- data/lib/puppet/parser/compiler/catalog_validator.rb +33 -0
- data/lib/puppet/parser/compiler/catalog_validator/env_relationship_validator.rb +64 -0
- data/lib/puppet/parser/compiler/catalog_validator/relationship_validator.rb +38 -0
- data/lib/puppet/parser/compiler/catalog_validator/site_validator.rb +20 -0
- data/lib/puppet/parser/environment_compiler.rb +165 -0
- data/lib/puppet/parser/functions/assert_type.rb +46 -16
- data/lib/puppet/parser/functions/defined.rb +105 -68
- data/lib/puppet/parser/functions/each.rb +85 -27
- data/lib/puppet/parser/functions/filter.rb +59 -23
- data/lib/puppet/parser/functions/hiera.rb +83 -27
- data/lib/puppet/parser/functions/hiera_array.rb +71 -28
- data/lib/puppet/parser/functions/hiera_hash.rb +81 -30
- data/lib/puppet/parser/functions/hiera_include.rb +81 -40
- data/lib/puppet/parser/functions/map.rb +55 -20
- data/lib/puppet/parser/functions/match.rb +27 -12
- data/lib/puppet/parser/functions/reduce.rb +97 -60
- data/lib/puppet/parser/functions/with.rb +16 -8
- data/lib/puppet/parser/resource.rb +98 -19
- data/lib/puppet/plugins/configuration.rb +3 -2
- data/lib/puppet/plugins/data_providers.rb +12 -60
- data/lib/puppet/plugins/data_providers/data_provider.rb +283 -0
- data/lib/puppet/plugins/data_providers/registry.rb +84 -0
- data/lib/puppet/pops.rb +19 -17
- data/lib/puppet/pops/adapters.rb +12 -0
- data/lib/puppet/pops/binder/binder.rb +2 -2
- data/lib/puppet/pops/binder/bindings_checker.rb +1 -1
- data/lib/puppet/pops/binder/bindings_label_provider.rb +3 -1
- data/lib/puppet/pops/binder/bindings_loader.rb +6 -2
- data/lib/puppet/pops/binder/bindings_model_meta.rb +2 -2
- data/lib/puppet/pops/binder/config/binder_config.rb +1 -1
- data/lib/puppet/pops/binder/injector.rb +4 -4
- data/lib/puppet/pops/binder/key_factory.rb +3 -9
- data/lib/puppet/pops/binder/scheme_handler/module_scheme.rb +68 -9
- data/lib/puppet/pops/evaluator/access_operator.rb +27 -60
- data/lib/puppet/pops/evaluator/closure.rb +8 -8
- data/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +1 -1
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +5 -5
- data/lib/puppet/pops/evaluator/literal_evaluator.rb +87 -0
- data/lib/puppet/pops/evaluator/relationship_operator.rb +7 -1
- data/lib/puppet/pops/functions/dispatcher.rb +3 -3
- data/lib/puppet/pops/issues.rb +1 -1
- data/lib/puppet/pops/label_provider.rb +1 -1
- data/lib/puppet/pops/lookup.rb +25 -47
- data/lib/puppet/pops/lookup/explainer.rb +402 -0
- data/lib/puppet/pops/lookup/invocation.rb +117 -0
- data/lib/puppet/pops/merge_strategy.rb +73 -5
- data/lib/puppet/pops/model/factory.rb +34 -0
- data/lib/puppet/pops/model/model_label_provider.rb +10 -1
- data/lib/puppet/pops/model/model_meta.rb +15 -0
- data/lib/puppet/pops/model/model_tree_dumper.rb +18 -0
- data/lib/puppet/pops/parser/code_merger.rb +13 -1
- data/lib/puppet/pops/parser/egrammar.ra +56 -3
- data/lib/puppet/pops/parser/eparser.rb +1549 -1352
- data/lib/puppet/pops/parser/lexer2.rb +31 -6
- data/lib/puppet/pops/parser/locator.rb +1 -1
- data/lib/puppet/pops/parser/parser_support.rb +25 -13
- data/lib/puppet/pops/types/enumeration.rb +1 -2
- data/lib/puppet/pops/types/type_asserter.rb +16 -15
- data/lib/puppet/pops/types/type_assertion_error.rb +1 -0
- data/lib/puppet/pops/types/type_calculator.rb +171 -1020
- data/lib/puppet/pops/types/type_factory.rb +87 -148
- data/lib/puppet/pops/types/type_mismatch_describer.rb +743 -0
- data/lib/puppet/pops/types/type_parser.rb +116 -127
- data/lib/puppet/pops/types/types.rb +1394 -255
- data/lib/puppet/pops/types/types_meta.rb +0 -234
- data/lib/puppet/pops/validation.rb +7 -2
- data/lib/puppet/pops/validation/checker4_0.rb +28 -0
- data/lib/puppet/provider/augeas/augeas.rb +50 -0
- data/lib/puppet/provider/group/directoryservice.rb +10 -0
- data/lib/puppet/provider/package/dnf.rb +41 -0
- data/lib/puppet/provider/package/gem.rb +7 -2
- data/lib/puppet/provider/package/rpm.rb +1 -0
- data/lib/puppet/provider/package/windows/exe_package.rb +10 -8
- data/lib/puppet/provider/package/windows/msi_package.rb +4 -3
- data/lib/puppet/provider/package/windows/package.rb +9 -1
- data/lib/puppet/provider/package/yum.rb +14 -9
- data/lib/puppet/provider/service/bsd.rb +1 -1
- data/lib/puppet/provider/service/debian.rb +21 -0
- data/lib/puppet/provider/service/init.rb +6 -0
- data/lib/puppet/provider/service/rcng.rb +51 -0
- data/lib/puppet/provider/service/redhat.rb +2 -1
- data/lib/puppet/provider/service/smf.rb +43 -2
- data/lib/puppet/provider/service/src.rb +27 -0
- data/lib/puppet/provider/service/systemd.rb +15 -3
- data/lib/puppet/provider/sshkey/parsed.rb +19 -9
- data/lib/puppet/reference/report.rb +9 -12
- data/lib/puppet/reports.rb +5 -1
- data/lib/puppet/resource.rb +50 -73
- data/lib/puppet/resource/capability_finder.rb +95 -0
- data/lib/puppet/resource/catalog.rb +47 -7
- data/lib/puppet/resource/status.rb +0 -2
- data/lib/puppet/resource/type.rb +238 -44
- data/lib/puppet/resource/type_collection.rb +60 -2
- data/lib/puppet/settings.rb +2 -2
- data/lib/puppet/ssl/certificate_authority/interface.rb +2 -2
- data/lib/puppet/ssl/oids.rb +9 -1
- data/lib/puppet/transaction.rb +4 -1
- data/lib/puppet/transaction/additional_resource_generator.rb +71 -8
- data/lib/puppet/transaction/resource_harness.rb +9 -4
- data/lib/puppet/type.rb +74 -3
- data/lib/puppet/type/augeas.rb +8 -0
- data/lib/puppet/type/file/source.rb +14 -12
- data/lib/puppet/type/user.rb +4 -2
- data/lib/puppet/util/windows/security.rb +4 -1
- data/lib/puppet/util/windows/taskscheduler.rb +1 -1
- data/lib/puppet/version.rb +1 -1
- data/spec/fixtures/unit/application/environments/production/data/common.yaml +3 -0
- data/spec/fixtures/unit/application/environments/production/environment.conf +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_json/data/bad.json +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_json/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_json/hiera.yaml +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_json/manifests/site.pp +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_yaml/data/bad.yaml +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_yaml/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_yaml/hiera.yaml +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_yaml/manifests/site.pp +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/data/common.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/manifests/site.pp +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/modules/one/data/common.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/modules/one/manifests/init.pp +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/modules/one/metadata.json +9 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data1/first.json +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data1/name.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data1/second.json +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data1/single.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data2/single.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/hiera.yaml +18 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/manifests/site.pp +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/data/common.yaml +46 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/manifests/site.pp +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/modules/one/data/common.yaml +30 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/modules/one/manifests/init.pp +13 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/modules/one/metadata.json +9 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/manifests/site.pp +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data1/first.json +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data1/name.yaml +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data1/second.json +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data1/single.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data2/single.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/hiera.yaml +18 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/manifests/init.pp +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/metadata.json +9 -0
- data/spec/fixtures/unit/data_providers/environments/sample/modules/dataprovider/lib/puppet_x/helindbe/sample_env_data.rb +1 -0
- data/spec/fixtures/unit/data_providers/environments/sample/modules/dataprovider/lib/puppet_x/helindbe/sample_module_data.rb +1 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/hieraprovider/data/first.json +3 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/hieraprovider/hiera.yaml +8 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/hieraprovider/manifests/init.pp +5 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/hieraprovider/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/meta/lib/puppet/functions/meta/data.rb +9 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/meta/manifests/init.pp +3 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/meta/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/metawcp/lib/puppet/bindings/metawcp/default.rb +10 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/metawcp/lib/puppet_x/thallgren/sample_module_data.rb +23 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/metawcp/manifests/init.pp +3 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/metawcp/metadata.json +9 -0
- data/spec/fixtures/unit/provider/package/yum/yum-check-update-security.txt +184 -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/data_binding_spec.rb +229 -0
- data/spec/integration/file_bucket/file_spec.rb +2 -2
- data/spec/integration/parser/compiler_spec.rb +23 -19
- data/spec/integration/parser/resource_expressions_spec.rb +4 -4
- data/spec/integration/parser/undef_param_spec.rb +1 -1
- data/spec/integration/resource/catalog_spec.rb +1 -1
- data/spec/integration/type/package_spec.rb +2 -0
- data/spec/integration/util/windows/security_spec.rb +18 -0
- data/spec/lib/matchers/include_in_order.rb +2 -2
- data/spec/shared_behaviours/iterative_functions.rb +8 -8
- data/spec/spec_helper.rb +7 -0
- data/spec/unit/agent/locker_spec.rb +4 -4
- data/spec/unit/agent_spec.rb +0 -8
- data/spec/unit/application/agent_spec.rb +5 -0
- data/spec/unit/application/apply_spec.rb +8 -0
- data/spec/unit/application/filebucket_spec.rb +87 -1
- data/spec/unit/application/lookup_spec.rb +195 -0
- data/spec/unit/appmgmt_spec.rb +657 -0
- data/spec/unit/capability_spec.rb +414 -0
- data/spec/unit/configurer_spec.rb +7 -1
- data/spec/unit/context/trusted_information_spec.rb +24 -1
- data/spec/unit/daemon_spec.rb +18 -8
- data/spec/unit/data_providers/hiera_data_provider_spec.rb +201 -0
- data/spec/unit/file_bucket/dipper_spec.rb +210 -1
- data/spec/unit/functions/assert_type_spec.rb +5 -7
- data/spec/unit/functions/defined_spec.rb +2 -2
- data/spec/unit/functions/epp_spec.rb +2 -2
- data/spec/unit/functions/lookup_spec.rb +200 -9
- data/spec/unit/functions/regsubst_spec.rb +17 -8
- data/spec/unit/functions/scanf_spec.rb +1 -1
- data/spec/unit/functions/split_spec.rb +2 -2
- data/spec/unit/functions/versioncmp_spec.rb +36 -0
- data/spec/unit/functions4_spec.rb +58 -72
- data/spec/unit/indirector/catalog/compiler_spec.rb +28 -8
- data/spec/unit/indirector/catalog/static_compiler_spec.rb +38 -20
- data/spec/unit/indirector/data_binding/none_spec.rb +2 -2
- data/spec/unit/indirector/file_bucket_file/file_spec.rb +52 -1
- data/spec/unit/indirector/request_spec.rb +8 -8
- data/spec/unit/info_service_spec.rb +236 -0
- data/spec/unit/module_tool/metadata_spec.rb +31 -2
- data/spec/unit/network/authconfig_spec.rb +62 -32
- data/spec/unit/network/authorization_spec.rb +30 -2
- data/spec/unit/network/http/connection_spec.rb +14 -19
- data/spec/unit/parser/compiler_spec.rb +86 -2
- data/spec/unit/parser/functions/create_resources_spec.rb +1 -1
- data/spec/unit/parser/resource_spec.rb +2 -20
- data/spec/unit/pops/binder/config/binder_config_spec.rb +1 -1
- data/spec/unit/pops/binder/injector_spec.rb +3 -3
- data/spec/unit/pops/evaluator/access_ops_spec.rb +13 -11
- data/spec/unit/pops/evaluator/basic_expressions_spec.rb +1 -2
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +19 -11
- data/spec/unit/pops/evaluator/literal_evaluator_spec.rb +43 -0
- data/spec/unit/pops/label_provider_spec.rb +5 -1
- data/spec/unit/pops/parser/lexer2_spec.rb +33 -7
- data/spec/unit/pops/parser/parse_application_spec.rb +40 -0
- data/spec/unit/pops/parser/parse_basic_expressions_spec.rb +4 -0
- data/spec/unit/pops/parser/parse_capabilities_spec.rb +47 -0
- data/spec/unit/pops/parser/parse_site_spec.rb +38 -0
- data/spec/unit/pops/parser/parser_rspec_helper.rb +5 -0
- data/spec/unit/pops/parser/parser_spec.rb +18 -0
- data/spec/unit/pops/types/type_calculator_spec.rb +427 -444
- data/spec/unit/pops/types/type_factory_spec.rb +12 -12
- data/spec/unit/pops/types/type_parser_spec.rb +7 -12
- data/spec/unit/pops/validator/validator_spec.rb +25 -0
- data/spec/unit/provider/augeas/augeas_spec.rb +50 -0
- data/spec/unit/provider/group/directoryservice_spec.rb +33 -0
- data/spec/unit/provider/group/windows_adsi_spec.rb +3 -0
- data/spec/unit/provider/package/dnf_spec.rb +92 -0
- data/spec/unit/provider/package/gem_spec.rb +7 -0
- data/spec/unit/provider/package/rpm_spec.rb +25 -2
- data/spec/unit/provider/package/windows/package_spec.rb +41 -0
- data/spec/unit/provider/package/yum_spec.rb +21 -13
- data/spec/unit/provider/scheduled_task/win32_taskscheduler_spec.rb +10 -0
- data/spec/unit/provider/service/debian_spec.rb +27 -0
- data/spec/unit/provider/service/rcng_spec.rb +41 -0
- data/spec/unit/provider/service/redhat_spec.rb +8 -1
- data/spec/unit/provider/service/smf_spec.rb +30 -5
- data/spec/unit/provider/service/src_spec.rb +19 -4
- data/spec/unit/provider/service/systemd_spec.rb +78 -29
- data/spec/unit/provider/sshkey/parsed_spec.rb +23 -0
- data/spec/unit/reports_spec.rb +10 -0
- data/spec/unit/resource/capability_finder_spec.rb +56 -0
- data/spec/unit/resource/catalog_spec.rb +31 -8
- data/spec/unit/resource/type_collection_spec.rb +23 -2
- data/spec/unit/resource/type_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +22 -4
- data/spec/unit/settings_spec.rb +90 -1
- data/spec/unit/ssl/certificate_authority/interface_spec.rb +4 -3
- data/spec/unit/ssl/oids_spec.rb +8 -0
- data/spec/unit/transaction/additional_resource_generator_spec.rb +78 -5
- data/spec/unit/transaction/report_spec.rb +24 -1
- data/spec/unit/type/package_spec.rb +1 -0
- data/spec/unit/type/user_spec.rb +14 -7
- data/spec/unit/type_spec.rb +1 -1
- metadata +169 -5
- data/lib/puppet/pops/evaluator/callable_mismatch_describer.rb +0 -175
- data/spec/integration/data_binding.rb +0 -104
@@ -0,0 +1,18 @@
|
|
1
|
+
# This file is loaded by the autoloader, and it does not find the hiera support unless required relative
|
2
|
+
require_relative 'hiera_support'
|
3
|
+
|
4
|
+
module Puppet::DataProviders
|
5
|
+
class HieraEnvDataProvider < Puppet::Plugins::DataProviders::EnvironmentDataProvider
|
6
|
+
include HieraSupport
|
7
|
+
|
8
|
+
# Return the root of the environment found in the given _scope_
|
9
|
+
#
|
10
|
+
# @param data_key [String] not used
|
11
|
+
# @param scope [Puppet::Parser::Scope] the parser scope where the environment is found
|
12
|
+
# @return [Pathname] Path to root of the environment
|
13
|
+
def provider_root(_, scope)
|
14
|
+
Pathname.new(scope.environment.configuration.path_to_env)
|
15
|
+
end
|
16
|
+
protected :provider_root
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require_relative 'hiera_config'
|
2
|
+
|
3
|
+
# Add support for Hiera-like interpolation expressions. The expressions may contain keys that uses dot-notation
|
4
|
+
# to further navigate into hashes and arrays
|
5
|
+
#
|
6
|
+
module Puppet::DataProviders::HieraInterpolate
|
7
|
+
def interpolate(subject, lookup_invocation, allow_methods)
|
8
|
+
return subject unless subject.is_a?(String) && !subject.index('%{').nil?
|
9
|
+
|
10
|
+
lookup_invocation.with(:interpolate, subject) do
|
11
|
+
subject.gsub(/%\{([^\}]+)\}/) do |match|
|
12
|
+
method_key, key = get_method_and_data($1, allow_methods)
|
13
|
+
is_alias = method_key == 'alias'
|
14
|
+
|
15
|
+
# Alias is only permitted if the entire string is equal to the interpolate expression
|
16
|
+
raise Puppet::DataBinding::LookupError, "'alias' interpolation is only permitted if the expression is equal to the entire string" if is_alias && subject != match
|
17
|
+
|
18
|
+
segments = key.split('.')
|
19
|
+
value = interpolate_method(method_key).call(segments[0], lookup_invocation)
|
20
|
+
value = qualified_lookup(segments.drop(1), value) if segments.size > 1
|
21
|
+
value = lookup_invocation.check(key) { interpolate(value, lookup_invocation, allow_methods) } if value.is_a?(String)
|
22
|
+
|
23
|
+
# break gsub and return value immediately if this was an alias substitution. The value might be something other than a String
|
24
|
+
return value if is_alias
|
25
|
+
|
26
|
+
value || ''
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def interpolate_method(method_key)
|
34
|
+
@@interpolate_methods ||= begin
|
35
|
+
global_lookup = lambda { |key, lookup_invocation| Puppet::Pops::Lookup.lookup(key, nil, '', true, nil, lookup_invocation) }
|
36
|
+
scope_lookup = lambda do |key, lookup_invocation|
|
37
|
+
lookup_invocation.with(:scope, nil) do
|
38
|
+
ovr = lookup_invocation.override_values
|
39
|
+
if ovr.include?(key)
|
40
|
+
lookup_invocation.report_found_in_overrides(key, ovr[key])
|
41
|
+
else
|
42
|
+
scope = lookup_invocation.scope
|
43
|
+
if scope.include?(key)
|
44
|
+
lookup_invocation.report_found(key, scope[key])
|
45
|
+
else
|
46
|
+
defaults = lookup_invocation.default_values
|
47
|
+
if defaults.include?(key)
|
48
|
+
lookup_invocation.report_found_in_defaults(key, defaults[key])
|
49
|
+
else
|
50
|
+
nil
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
{
|
59
|
+
'lookup' => global_lookup,
|
60
|
+
'hiera' => global_lookup, # this is just an alias for 'lookup'
|
61
|
+
'alias' => global_lookup, # same as 'lookup' but expression must be entire string. The result that is not subject to string substitution
|
62
|
+
'scope' => scope_lookup,
|
63
|
+
'literal' => lambda { |key, _| key }
|
64
|
+
}
|
65
|
+
end
|
66
|
+
interpolate_method = @@interpolate_methods[method_key]
|
67
|
+
raise Puppet::DataBinding::LookupError, "Unknown interpolation method '#{method_key}'" unless interpolate_method
|
68
|
+
interpolate_method
|
69
|
+
end
|
70
|
+
|
71
|
+
def qualified_lookup(segments, value)
|
72
|
+
segments.each do |segment|
|
73
|
+
throw :no_such_key if value.nil?
|
74
|
+
if segment =~ /^[0-9]+$/
|
75
|
+
segment = segment.to_i
|
76
|
+
raise Puppet::DataBinding::LookupError, "Data provider type mismatch: Got #{value.class.name} when Array was expected to enable lookup using key '#{segment}'" unless value.instance_of?(Array)
|
77
|
+
throw :no_such_key unless segment < value.size
|
78
|
+
else
|
79
|
+
raise Puppet::DataBinding::LookupError, "Data provider type mismatch: Got #{value.class.name} when a non Array object that responds to '[]' was expected to enable lookup using key '#{segment}'" unless value.respond_to?(:'[]') && !value.instance_of?(Array)
|
80
|
+
throw :no_such_key unless value.include?(segment)
|
81
|
+
end
|
82
|
+
value = value[segment]
|
83
|
+
end
|
84
|
+
value
|
85
|
+
end
|
86
|
+
|
87
|
+
def get_method_and_data(data, allow_methods)
|
88
|
+
if match = data.match(/^(\w+)\((?:["]([^"]+)["]|[']([^']+)['])\)$/)
|
89
|
+
raise Puppet::DataBinding::LoookupError, 'Interpolation using method syntax is not allowed in this context' unless allow_methods
|
90
|
+
key = match[1]
|
91
|
+
data = match[2] || match[3] # double or single qouted
|
92
|
+
else
|
93
|
+
key = 'scope'
|
94
|
+
end
|
95
|
+
[key, data]
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# This file is loaded by the autoloader, and it does not find the hiera support unless required relative
|
2
|
+
require_relative 'hiera_support'
|
3
|
+
|
4
|
+
module Puppet::DataProviders
|
5
|
+
class HieraModuleDataProvider < Puppet::Plugins::DataProviders::ModuleDataProvider
|
6
|
+
include HieraSupport
|
7
|
+
|
8
|
+
# Return the root of the module with the name equal to _data_key_ found in the environment of the given _scope_
|
9
|
+
#
|
10
|
+
# @param data_key [String] the name of the module
|
11
|
+
# @param scope [Puppet::Parser::Scope] the parser scope where the environment is found
|
12
|
+
# @return [Pathname] Path to root of the environment
|
13
|
+
# @raise [Puppet::DataBinder::LookupError] if the given module is can not be found
|
14
|
+
#
|
15
|
+
def provider_root(module_name, scope)
|
16
|
+
env = scope.environment
|
17
|
+
mod = env.modules.find { |m| m.name == module_name }
|
18
|
+
raise Puppet::DataBinder::LookupError, "Environment '#{env.name}', cannot find module '#{module_name}'" unless mod
|
19
|
+
Pathname.new(mod.path)
|
20
|
+
end
|
21
|
+
protected :provider_root
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require_relative 'hiera_config'
|
2
|
+
|
3
|
+
module Puppet::DataProviders::HieraSupport
|
4
|
+
def config_path
|
5
|
+
@hiera_config.nil? ? 'not yet configured' : @hiera_config.config_path
|
6
|
+
end
|
7
|
+
|
8
|
+
def name
|
9
|
+
'Hiera Data Provider' + (@hiera_config.nil? ? '' : ", version #{@hiera_config.version}")
|
10
|
+
end
|
11
|
+
|
12
|
+
# Performs a lookup by searching all given paths for the given _key_. A merge will be performed if
|
13
|
+
# the value is found in more than one location and _merge_ is not nil.
|
14
|
+
#
|
15
|
+
# @param key [String] The key to lookup
|
16
|
+
# @param lookup_invocation [Puppet::Pops::Lookup::Invocation] The current lookup invocation
|
17
|
+
# @param merge [Puppet::Pops::MergeStrategy,String,Hash<String,Object>,nil] Merge strategy or hash with strategy and options
|
18
|
+
#
|
19
|
+
# @api public
|
20
|
+
def unchecked_lookup(key, lookup_invocation, merge)
|
21
|
+
lookup_invocation.with(:data_provider, self) do
|
22
|
+
merge_strategy = Puppet::Pops::MergeStrategy.strategy(merge)
|
23
|
+
lookup_invocation.with(:merge, merge_strategy) do
|
24
|
+
merged_result = merge_strategy.merge_lookup(data_providers(data_key(key, lookup_invocation), lookup_invocation)) do |data_provider|
|
25
|
+
data_provider.unchecked_lookup(key, lookup_invocation, merge_strategy)
|
26
|
+
end
|
27
|
+
lookup_invocation.report_result(merged_result)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def data_providers(data_key, lookup_invocation)
|
33
|
+
@hiera_config ||= Puppet::DataProviders::HieraConfig.new(provider_root(data_key, lookup_invocation.scope))
|
34
|
+
@data_providers ||= @hiera_config.create_data_providers(lookup_invocation)
|
35
|
+
end
|
36
|
+
private :data_providers
|
37
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# This file is loaded by the autoloader, and it does not find the data function support unless required relative
|
2
|
+
#
|
3
|
+
require 'json'
|
4
|
+
require_relative 'hiera_interpolate'
|
5
|
+
|
6
|
+
module Puppet::DataProviders
|
7
|
+
class JsonDataProviderFactory < Puppet::Plugins::DataProviders::FileBasedDataProviderFactory
|
8
|
+
def create(name, paths)
|
9
|
+
JsonDataProvider.new(name, paths)
|
10
|
+
end
|
11
|
+
|
12
|
+
def path_extension
|
13
|
+
'.json'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class JsonDataProvider < Puppet::Plugins::DataProviders::PathBasedDataProvider
|
18
|
+
include HieraInterpolate
|
19
|
+
|
20
|
+
def initialize_data(path, lookup_invocation)
|
21
|
+
JSON.parse(File.read(path))
|
22
|
+
rescue JSON::ParserError => ex
|
23
|
+
# Filename not included in message, so we add it here.
|
24
|
+
raise Puppet::DataBinding::LookupError, "Unable to parse (#{path}): #{ex.message}"
|
25
|
+
end
|
26
|
+
|
27
|
+
def post_process(value, lookup_invocation)
|
28
|
+
interpolate(value, lookup_invocation, true)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,200 @@
|
|
1
|
+
# A LookupAdapter is a specialized DataAdapter that uses its hash to store module providers. It also remembers the environment
|
2
|
+
# that it is attached to and maintains a cache of _lookup options_ retrieved from its data providers.
|
3
|
+
#
|
4
|
+
class Puppet::DataProviders::LookupAdapter < Puppet::DataProviders::DataAdapter
|
5
|
+
|
6
|
+
LOOKUP_OPTIONS = 'lookup_options'.freeze
|
7
|
+
HASH = 'hash'.freeze
|
8
|
+
MERGE = 'merge'.freeze
|
9
|
+
|
10
|
+
def self.create_adapter(env)
|
11
|
+
new(env)
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(env)
|
15
|
+
super()
|
16
|
+
@env = env
|
17
|
+
@lookup_options = {}
|
18
|
+
end
|
19
|
+
|
20
|
+
# Performs a lookup using global, environment, and module data providers. Merge the result using the given
|
21
|
+
# _merge_ strategy. If the merge strategy is nil, then an attempt is made to find merge options in the
|
22
|
+
# `lookup_options` hash for an entry associated with the key. If no options are found, the no merge is performed
|
23
|
+
# and the first found entry is returned.
|
24
|
+
#
|
25
|
+
# @param key [String] The key to lookup
|
26
|
+
# @param merge [Puppet::Pops::MergeStrategy,String,Hash<String,Object>,nil] Merge strategy or hash with strategy and options
|
27
|
+
# @param lookup_invocation [Puppet::Pops::Lookup::Invocation] Invocation data containing scope, overrides, and defaults
|
28
|
+
# @return [Object] The found value
|
29
|
+
# @throws :no_such_key if the given key is not found
|
30
|
+
#
|
31
|
+
def lookup(key, lookup_invocation, merge)
|
32
|
+
merge = lookup_merge_options(key, lookup_invocation) if merge.nil?
|
33
|
+
merge_strategy = Puppet::Pops::MergeStrategy.strategy(merge)
|
34
|
+
lookup_invocation.with(:merge, merge_strategy) do
|
35
|
+
result = merge_strategy.merge_lookup([:lookup_global, :lookup_in_environment, :lookup_in_module]) { |m| send(m, key, lookup_invocation, merge_strategy) }
|
36
|
+
lookup_invocation.report_result(result)
|
37
|
+
result
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# @api private
|
42
|
+
def lookup_global(name, lookup_invocation, merge_strategy)
|
43
|
+
terminus = Puppet[:data_binding_terminus]
|
44
|
+
lookup_invocation.with(:global, terminus) do
|
45
|
+
catch(:no_such_key) do
|
46
|
+
return lookup_invocation.report_found(name, Puppet::DataBinding.indirection.find(name,
|
47
|
+
{ :environment => @env.to_s, :variables => lookup_invocation.scope, :merge => merge_strategy }))
|
48
|
+
end
|
49
|
+
lookup_invocation.report_not_found(name)
|
50
|
+
throw :no_such_key
|
51
|
+
end
|
52
|
+
rescue Puppet::DataBinding::LookupError => e
|
53
|
+
raise Puppet::Error.new("Error from DataBinding '#{terminus}' while looking up '#{name}': #{e.message}", e)
|
54
|
+
end
|
55
|
+
|
56
|
+
# @api private
|
57
|
+
def lookup_in_environment(name, lookup_invocation, merge_strategy)
|
58
|
+
env_provider.lookup(name, lookup_invocation, merge_strategy)
|
59
|
+
end
|
60
|
+
|
61
|
+
# @api private
|
62
|
+
def lookup_in_module(name, lookup_invocation, merge_strategy)
|
63
|
+
module_name = extract_module_name(name)
|
64
|
+
|
65
|
+
# Do not attempt to do a lookup in a module unless the name is qualified.
|
66
|
+
throw :no_such_key if module_name.nil?
|
67
|
+
|
68
|
+
lookup_invocation.with(:module, module_name) do
|
69
|
+
if @env.module(module_name).nil?
|
70
|
+
lookup_invocation.report_module_not_found
|
71
|
+
throw :no_such_key
|
72
|
+
end
|
73
|
+
module_provider(module_name).lookup(name, lookup_invocation, merge_strategy)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# Retrieve the merge options that match the given `name`.
|
78
|
+
#
|
79
|
+
# @param name [String] The key for which we want merge options
|
80
|
+
# @param lookup_invocation [Puppet::Pops::Lookup::Invocation] the lookup invocation
|
81
|
+
# @return [String,Hash,nil] The found merge options or nil
|
82
|
+
#
|
83
|
+
def lookup_merge_options(name, lookup_invocation)
|
84
|
+
lookup_options = lookup_lookup_options(name, lookup_invocation)
|
85
|
+
lookup_options.nil? ? nil : lookup_options[MERGE]
|
86
|
+
end
|
87
|
+
|
88
|
+
# Retrieve the lookup options that match the given `name`.
|
89
|
+
#
|
90
|
+
# @param name [String] The key for which we want lookup options
|
91
|
+
# @param lookup_invocation [Puppet::Pops::Lookup::Invocation] the lookup invocation
|
92
|
+
# @return [String,Hash,nil] The found lookup options or nil
|
93
|
+
#
|
94
|
+
def lookup_lookup_options(name, lookup_invocation)
|
95
|
+
module_name = extract_module_name(name)
|
96
|
+
|
97
|
+
# Retrieve the options for the module. We use nil as a key in case we have none
|
98
|
+
options = @lookup_options[module_name]
|
99
|
+
if options.nil? && !@lookup_options.include?(module_name)
|
100
|
+
options = retrieve_lookup_options(module_name, lookup_invocation, Puppet::Pops::MergeStrategy.strategy(HASH))
|
101
|
+
raise Puppet::DataBinding::LookupError.new("value of #{LOOKUP_OPTIONS} must be a hash") unless options.nil? || options.is_a?(Hash)
|
102
|
+
@lookup_options[module_name] = options
|
103
|
+
end
|
104
|
+
options.nil? ? nil : options[name]
|
105
|
+
end
|
106
|
+
|
107
|
+
private
|
108
|
+
|
109
|
+
# Retrieve lookup options that applies when using a specific module (i.e. a merge of the pre-cached
|
110
|
+
# `env_lookup_options` and the module specific data)
|
111
|
+
def retrieve_lookup_options(module_name, lookup_invocation, merge_strategy)
|
112
|
+
lookup_invocation.with(:meta, module_name) do
|
113
|
+
env_opts = env_lookup_options(lookup_invocation, merge_strategy)
|
114
|
+
options = nil
|
115
|
+
unless module_name.nil?
|
116
|
+
catch(:no_such_key) do
|
117
|
+
options = module_provider(module_name).lookup(LOOKUP_OPTIONS, lookup_invocation, merge_strategy)
|
118
|
+
options = merge_strategy.merge(env_opts, options) unless env_opts.nil?
|
119
|
+
end
|
120
|
+
end
|
121
|
+
options.nil? ? env_opts : options
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
# Retrieve and cache lookup options specific to the environment that this adapter is attached to (i.e. a merge
|
126
|
+
# of global and environment lookup options).
|
127
|
+
def env_lookup_options(lookup_invocation, merge_strategy)
|
128
|
+
unless instance_variable_defined?(:@env_lookup_options)
|
129
|
+
@env_lookup_options = nil
|
130
|
+
catch(:no_such_key) do
|
131
|
+
@env_lookup_options = merge_strategy.merge_lookup([:lookup_global, :lookup_in_environment]) do |m|
|
132
|
+
send(m, LOOKUP_OPTIONS, lookup_invocation, merge_strategy)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
@env_lookup_options
|
137
|
+
end
|
138
|
+
|
139
|
+
def env_provider
|
140
|
+
@env_provider ||= initialize_env_provider
|
141
|
+
end
|
142
|
+
|
143
|
+
def module_provider(module_name)
|
144
|
+
# Test if the key is present for the given module_name. It might be there even if the
|
145
|
+
# value is nil (which indicates that no module provider is configured for the given name)
|
146
|
+
unless data.include?(module_name)
|
147
|
+
data[module_name] = initialize_module_provider(module_name)
|
148
|
+
end
|
149
|
+
data[module_name]
|
150
|
+
end
|
151
|
+
|
152
|
+
def initialize_module_provider(module_name)
|
153
|
+
injector = Puppet.lookup(:injector) { nil }
|
154
|
+
|
155
|
+
# Support running tests without an injector being configured == using a null implementation
|
156
|
+
return ModuleDataProvider.new() unless injector
|
157
|
+
|
158
|
+
# Get the registry of module to provider implementation name
|
159
|
+
module_service_type = Registry.hash_of_per_module_data_provider
|
160
|
+
module_service_name = PER_MODULE_DATA_PROVIDER_KEY
|
161
|
+
module_service = injector.lookup(nil, module_service_type, module_service_name)
|
162
|
+
provider_name = module_service[module_name] || 'none'
|
163
|
+
|
164
|
+
service_type = Registry.hash_of_module_data_providers
|
165
|
+
service_name = MODULE_DATA_PROVIDERS_KEY
|
166
|
+
|
167
|
+
# Get the service (registry of known implementations)
|
168
|
+
service = injector.lookup(nil, service_type, service_name)
|
169
|
+
provider = service[provider_name]
|
170
|
+
unless provider
|
171
|
+
raise Puppet::Error.new("Environment '#{@env.name}', cannot find module_data_provider '#{provider_name}'")
|
172
|
+
end
|
173
|
+
provider
|
174
|
+
end
|
175
|
+
|
176
|
+
def initialize_env_provider
|
177
|
+
injector = Puppet.lookup(:injector) { nil }
|
178
|
+
|
179
|
+
# Support running tests without an injector being configured == using a null implementation
|
180
|
+
return EnvironmentDataProvider.new() unless injector
|
181
|
+
|
182
|
+
# Get the name of the data provider from the environment's configuration and find the bound implementation
|
183
|
+
provider_name = @env.configuration.environment_data_provider
|
184
|
+
service_type = Registry.hash_of_environment_data_providers
|
185
|
+
service_name = ENV_DATA_PROVIDERS_KEY
|
186
|
+
|
187
|
+
# Get the service (registry of known implementations)
|
188
|
+
service = injector.lookup(nil, service_type, service_name)
|
189
|
+
provider = service[provider_name]
|
190
|
+
unless provider
|
191
|
+
raise Puppet::Error.new("Environment '#{@env.name}', cannot find environment_data_provider '#{provider_name}'")
|
192
|
+
end
|
193
|
+
provider
|
194
|
+
end
|
195
|
+
|
196
|
+
def extract_module_name(name)
|
197
|
+
qual_index = name.index('::')
|
198
|
+
qual_index.nil? ? nil : name[0..qual_index-1]
|
199
|
+
end
|
200
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# This file is loaded by the autoloader, and it does not find the data function support unless required relative
|
2
|
+
#
|
3
|
+
require 'yaml'
|
4
|
+
require_relative 'hiera_interpolate'
|
5
|
+
|
6
|
+
module Puppet::DataProviders
|
7
|
+
class YamlDataProviderFactory < Puppet::Plugins::DataProviders::FileBasedDataProviderFactory
|
8
|
+
def create(name, paths)
|
9
|
+
YamlDataProvider.new(name, paths)
|
10
|
+
end
|
11
|
+
|
12
|
+
def path_extension
|
13
|
+
'.yaml'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class YamlDataProvider < Puppet::Plugins::DataProviders::PathBasedDataProvider
|
18
|
+
include HieraInterpolate
|
19
|
+
|
20
|
+
def initialize_data(path, lookup_invocation)
|
21
|
+
HieraConfig.symkeys_to_string(YAML.load_file(path))
|
22
|
+
rescue YAML::SyntaxError => ex
|
23
|
+
# Psych errors includes the absolute path to the file, so no need to add that
|
24
|
+
# to the message
|
25
|
+
raise Puppet::DataBinding::LookupError, "Unable to parse #{ex.message}"
|
26
|
+
end
|
27
|
+
|
28
|
+
def post_process(value, lookup_invocation)
|
29
|
+
interpolate(value, lookup_invocation, true)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|