puppet 4.2.3-x64-mingw32 → 4.3.0-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- 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
@@ -1,175 +0,0 @@
|
|
1
|
-
# @api private
|
2
|
-
module Puppet::Pops::Evaluator::CallableMismatchDescriber
|
3
|
-
# Produces a string with the difference between the given arguments and support signature(s).
|
4
|
-
#
|
5
|
-
# @param name [String] The name of the callable to describe
|
6
|
-
# @param args_type [Puppet::Pops::Types::Tuple] The tuple of argument types.
|
7
|
-
# @param supported_signatures [Array<Puppet::Pops::Types::Callable>] The available signatures that were available for calling.
|
8
|
-
#
|
9
|
-
# @api private
|
10
|
-
def self.diff_string(name, args_type, supported_signatures)
|
11
|
-
result = [ ]
|
12
|
-
if supported_signatures.size == 1
|
13
|
-
signature = supported_signatures[0]
|
14
|
-
params_type = signature.type.param_types
|
15
|
-
block_type = signature.type.block_type
|
16
|
-
params_names = signature.parameter_names
|
17
|
-
result << "expected:\n #{name}(#{signature_string(signature)}) - #{arg_count_string(signature.type)}"
|
18
|
-
else
|
19
|
-
result << "expected one of:\n"
|
20
|
-
result << supported_signatures.map do |sig|
|
21
|
-
params_type = sig.type.param_types
|
22
|
-
" #{name}(#{signature_string(sig)}) - #{arg_count_string(sig.type)}"
|
23
|
-
end.join("\n")
|
24
|
-
end
|
25
|
-
|
26
|
-
result << "\nactual:\n #{name}(#{arg_types_string(args_type)}) - #{arg_count_string(args_type)}"
|
27
|
-
|
28
|
-
result.join('')
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
# Produces a string for the signature(s)
|
34
|
-
#
|
35
|
-
# @api private
|
36
|
-
def self.signature_string(signature)
|
37
|
-
param_types = signature.type.param_types
|
38
|
-
block_type = signature.type.block_type
|
39
|
-
param_names = signature.parameter_names
|
40
|
-
|
41
|
-
from, to = param_types.size_range
|
42
|
-
if from == 0 && to == 0
|
43
|
-
# No parameters function
|
44
|
-
return ''
|
45
|
-
end
|
46
|
-
|
47
|
-
required_count = from
|
48
|
-
# there may be more names than there are types, and count needs to be subtracted from the count
|
49
|
-
# to make it correct for the last named element
|
50
|
-
adjust = max(0, param_names.size() -1)
|
51
|
-
last_range = [max(0, (from - adjust)), (to - adjust)]
|
52
|
-
|
53
|
-
types =
|
54
|
-
case param_types
|
55
|
-
when Puppet::Pops::Types::PTupleType
|
56
|
-
param_types.types
|
57
|
-
when Puppet::Pops::Types::PArrayType
|
58
|
-
[ param_types.element_type ]
|
59
|
-
end
|
60
|
-
tc = Puppet::Pops::Types::TypeCalculator
|
61
|
-
|
62
|
-
# join type with names (types are always present, names are optional)
|
63
|
-
# separate entries with comma
|
64
|
-
#
|
65
|
-
result =
|
66
|
-
if param_names.empty?
|
67
|
-
types.each_with_index.map {|t, index| tc.string(t) + opt_value_indicator(index, required_count, 0) }
|
68
|
-
else
|
69
|
-
limit = param_names.size
|
70
|
-
result = param_names.each_with_index.map do |name, index|
|
71
|
-
[tc.string(types[index] || types[-1]), name].join(' ') + opt_value_indicator(index, required_count, limit)
|
72
|
-
end
|
73
|
-
end.join(', ')
|
74
|
-
|
75
|
-
# Add {from, to} for the last type
|
76
|
-
# This works for both Array and Tuple since it describes the allowed count of the "last" type element
|
77
|
-
# for both. It does not show anything when the range is {1,1}.
|
78
|
-
#
|
79
|
-
result += range_string(last_range)
|
80
|
-
|
81
|
-
# If there is a block, include it with its own optional count {0,1}
|
82
|
-
case signature.type.block_type
|
83
|
-
when Puppet::Pops::Types::POptionalType
|
84
|
-
result << ', ' unless result == ''
|
85
|
-
result << "#{tc.string(signature.type.block_type.optional_type)} #{signature.block_name} {0,1}"
|
86
|
-
when Puppet::Pops::Types::PCallableType
|
87
|
-
result << ', ' unless result == ''
|
88
|
-
result << "#{tc.string(signature.type.block_type)} #{signature.block_name}"
|
89
|
-
when NilClass
|
90
|
-
# nothing
|
91
|
-
end
|
92
|
-
result
|
93
|
-
end
|
94
|
-
|
95
|
-
# Why oh why Ruby do you not have a standard Math.max ?
|
96
|
-
# @api private
|
97
|
-
def self.max(a, b)
|
98
|
-
a >= b ? a : b
|
99
|
-
end
|
100
|
-
|
101
|
-
# @api private
|
102
|
-
def self.opt_value_indicator(index, required_count, limit)
|
103
|
-
count = index + 1
|
104
|
-
(count > required_count && count < limit) ? '?' : ''
|
105
|
-
end
|
106
|
-
|
107
|
-
# @api private
|
108
|
-
def self.arg_count_string(args_type)
|
109
|
-
if args_type.is_a?(Puppet::Pops::Types::PCallableType)
|
110
|
-
size_range = args_type.param_types.size_range # regular parameters
|
111
|
-
adjust_range=
|
112
|
-
case args_type.block_type
|
113
|
-
when Puppet::Pops::Types::POptionalType
|
114
|
-
size_range[1] += 1
|
115
|
-
when Puppet::Pops::Types::PCallableType
|
116
|
-
size_range[0] += 1
|
117
|
-
size_range[1] += 1
|
118
|
-
when NilClass
|
119
|
-
# nothing
|
120
|
-
else
|
121
|
-
raise ArgumentError, "Internal Error, only nil, Callable, and Optional[Callable] supported by Callable block type"
|
122
|
-
end
|
123
|
-
else
|
124
|
-
size_range = args_type.size_range
|
125
|
-
end
|
126
|
-
"arg count #{range_string(size_range, false)}"
|
127
|
-
end
|
128
|
-
|
129
|
-
# @api private
|
130
|
-
def self.arg_types_string(args_type)
|
131
|
-
types =
|
132
|
-
case args_type
|
133
|
-
when Puppet::Pops::Types::PTupleType
|
134
|
-
last_range = args_type.repeat_last_range
|
135
|
-
args_type.types
|
136
|
-
when Puppet::Pops::Types::PArrayType
|
137
|
-
last_range = args_type.size_range
|
138
|
-
[ args_type.element_type ]
|
139
|
-
end
|
140
|
-
# stringify generalized versions or it will display Integer[10,10] for "10", String['the content'] etc.
|
141
|
-
# note that type must be copied since generalize is a mutating operation
|
142
|
-
tc = Puppet::Pops::Types::TypeCalculator
|
143
|
-
result = types.map { |t| tc.string(tc.generalize!(t.copy)) }.join(', ')
|
144
|
-
|
145
|
-
# Add {from, to} for the last type
|
146
|
-
# This works for both Array and Tuple since it describes the allowed count of the "last" type element
|
147
|
-
# for both. It does not show anything when the range is {1,1}.
|
148
|
-
#
|
149
|
-
result += range_string(last_range)
|
150
|
-
result
|
151
|
-
end
|
152
|
-
|
153
|
-
# Formats a range into a string of the form: `{from, to}`
|
154
|
-
#
|
155
|
-
# The following cases are optimized:
|
156
|
-
#
|
157
|
-
# * from and to are equal => `{from}`
|
158
|
-
# * from and to are both and 1 and squelch_one == true => `''`
|
159
|
-
# * from is 0 and to is 1 => `'?'`
|
160
|
-
# * to is Float::INFINITY => `{from, }`
|
161
|
-
#
|
162
|
-
# @api private
|
163
|
-
def self.range_string(size_range, squelch_one = true)
|
164
|
-
from, to = size_range
|
165
|
-
if from == to
|
166
|
-
(squelch_one && from == 1) ? '' : "{#{from}}"
|
167
|
-
elsif to == Float::INFINITY
|
168
|
-
"{#{from},}"
|
169
|
-
elsif from == 0 && to == 1
|
170
|
-
'?'
|
171
|
-
else
|
172
|
-
"{#{from},#{to}}"
|
173
|
-
end
|
174
|
-
end
|
175
|
-
end
|
@@ -1,104 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
require 'puppet_spec/compiler'
|
4
|
-
|
5
|
-
describe "Data binding" do
|
6
|
-
include PuppetSpec::Files
|
7
|
-
include PuppetSpec::Compiler
|
8
|
-
|
9
|
-
let(:dir) { tmpdir("puppetdir") }
|
10
|
-
|
11
|
-
before do
|
12
|
-
Puppet[:data_binding_terminus] = "hiera"
|
13
|
-
Puppet[:modulepath] = dir
|
14
|
-
end
|
15
|
-
|
16
|
-
it "looks up data from hiera" do
|
17
|
-
configure_hiera_for({
|
18
|
-
"testing::binding::value" => "the value",
|
19
|
-
"testing::binding::calling_class" => "%{calling_class}",
|
20
|
-
"testing::binding::calling_class_path" => "%{calling_class_path}",
|
21
|
-
"testing::binding::calling_module" => "%{calling_module}"
|
22
|
-
|
23
|
-
})
|
24
|
-
|
25
|
-
create_manifest_in_module("testing", "binding.pp",
|
26
|
-
<<-MANIFEST)
|
27
|
-
class testing::binding($value,
|
28
|
-
$calling_class,
|
29
|
-
$calling_class_path,
|
30
|
-
$calling_module) {}
|
31
|
-
MANIFEST
|
32
|
-
|
33
|
-
catalog = compile_to_catalog("include testing::binding")
|
34
|
-
resource = catalog.resource('Class[testing::binding]')
|
35
|
-
|
36
|
-
expect(resource[:value]).to eq("the value")
|
37
|
-
expect(resource[:calling_class]).to eq("testing::binding")
|
38
|
-
expect(resource[:calling_class_path]).to eq("testing/binding")
|
39
|
-
expect(resource[:calling_module]).to eq("testing")
|
40
|
-
end
|
41
|
-
|
42
|
-
it "works with the puppet backend configured, although it can't use it for lookup" do
|
43
|
-
configure_hiera_for_puppet
|
44
|
-
create_manifest_in_module("testing", "binding.pp",
|
45
|
-
<<-MANIFEST)
|
46
|
-
# lookup via the puppet backend to ensure it works
|
47
|
-
class testing::binding($value = hiera('variable')) {}
|
48
|
-
MANIFEST
|
49
|
-
|
50
|
-
create_manifest_in_module("testing", "data.pp",
|
51
|
-
<<-MANIFEST)
|
52
|
-
class testing::data {
|
53
|
-
$variable = "the value"
|
54
|
-
}
|
55
|
-
MANIFEST
|
56
|
-
|
57
|
-
catalog = compile_to_catalog("include testing::binding")
|
58
|
-
resource = catalog.resource('Class[testing::binding]')
|
59
|
-
|
60
|
-
expect(resource[:value]).to eq("the value")
|
61
|
-
end
|
62
|
-
|
63
|
-
def configure_hiera_for(data)
|
64
|
-
hiera_config_file = tmpfile("hiera.yaml")
|
65
|
-
|
66
|
-
File.open(hiera_config_file, 'w') do |f|
|
67
|
-
f.write("---
|
68
|
-
:yaml:
|
69
|
-
:datadir: #{dir}
|
70
|
-
:hierarchy: ['global']
|
71
|
-
:logger: 'noop'
|
72
|
-
:backends: ['yaml']
|
73
|
-
")
|
74
|
-
end
|
75
|
-
|
76
|
-
File.open(File.join(dir, 'global.yaml'), 'w') do |f|
|
77
|
-
f.write(YAML.dump(data))
|
78
|
-
end
|
79
|
-
|
80
|
-
Puppet[:hiera_config] = hiera_config_file
|
81
|
-
end
|
82
|
-
|
83
|
-
def configure_hiera_for_puppet
|
84
|
-
hiera_config_file = tmpfile("hiera.yaml")
|
85
|
-
|
86
|
-
File.open(hiera_config_file, 'w') do |f|
|
87
|
-
f.write("---
|
88
|
-
:logger: 'noop'
|
89
|
-
:backends: ['puppet']
|
90
|
-
")
|
91
|
-
end
|
92
|
-
|
93
|
-
Puppet[:hiera_config] = hiera_config_file
|
94
|
-
end
|
95
|
-
|
96
|
-
def create_manifest_in_module(module_name, name, manifest)
|
97
|
-
module_dir = File.join(dir, module_name, 'manifests')
|
98
|
-
FileUtils.mkdir_p(module_dir)
|
99
|
-
|
100
|
-
File.open(File.join(module_dir, name), 'w') do |f|
|
101
|
-
f.write(manifest)
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|