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
@@ -4,49 +4,46 @@
|
|
4
4
|
module Puppet::Pops::Types::TypeFactory
|
5
5
|
Types = Puppet::Pops::Types
|
6
6
|
@type_calculator = Types::TypeCalculator.singleton
|
7
|
-
@undef_t = Types::PUndefType.new
|
8
7
|
|
9
8
|
# Produces the Integer type
|
10
9
|
# @api public
|
11
10
|
#
|
12
|
-
def self.integer
|
13
|
-
Types::PIntegerType
|
11
|
+
def self.integer
|
12
|
+
Types::PIntegerType::DEFAULT
|
14
13
|
end
|
15
14
|
|
16
15
|
# Produces an Integer range type
|
17
16
|
# @api public
|
18
17
|
#
|
19
18
|
def self.range(from, to)
|
20
|
-
t = Types::PIntegerType.new()
|
21
19
|
# optimize eq with symbol (faster when it is left)
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
from = :default == from if from == 'default'
|
21
|
+
to = :default if to == 'default'
|
22
|
+
Types::PIntegerType.new(from, to)
|
25
23
|
end
|
26
24
|
|
27
25
|
# Produces a Float range type
|
28
26
|
# @api public
|
29
27
|
#
|
30
28
|
def self.float_range(from, to)
|
31
|
-
t = Types::PFloatType.new()
|
32
29
|
# optimize eq with symbol (faster when it is left)
|
33
|
-
|
34
|
-
|
35
|
-
|
30
|
+
from = Float(from) unless :default == from || from.nil?
|
31
|
+
to = Float(to) unless :default == to || to.nil?
|
32
|
+
Types::PFloatType.new(from, to)
|
36
33
|
end
|
37
34
|
|
38
35
|
# Produces the Float type
|
39
36
|
# @api public
|
40
37
|
#
|
41
|
-
def self.float
|
42
|
-
Types::PFloatType
|
38
|
+
def self.float
|
39
|
+
Types::PFloatType::DEFAULT
|
43
40
|
end
|
44
41
|
|
45
42
|
# Produces the Numeric type
|
46
43
|
# @api public
|
47
44
|
#
|
48
|
-
def self.numeric
|
49
|
-
Types::PNumericType
|
45
|
+
def self.numeric
|
46
|
+
Types::PNumericType::DEFAULT
|
50
47
|
end
|
51
48
|
|
52
49
|
# Produces a string representation of the type
|
@@ -59,10 +56,8 @@ module Puppet::Pops::Types::TypeFactory
|
|
59
56
|
# Produces the String type, optionally with specific string values
|
60
57
|
# @api public
|
61
58
|
#
|
62
|
-
def self.string(*values)
|
63
|
-
|
64
|
-
values.each {|v| t.addValues(v) }
|
65
|
-
t
|
59
|
+
def self.string(size_type = nil, *values)
|
60
|
+
Types::PStringType.new(size_type, values)
|
66
61
|
end
|
67
62
|
|
68
63
|
# Produces the Optional type, i.e. a short hand for Variant[T, Undef]
|
@@ -75,27 +70,21 @@ module Puppet::Pops::Types::TypeFactory
|
|
75
70
|
# @api public
|
76
71
|
#
|
77
72
|
def self.optional(optional_type = nil)
|
78
|
-
|
79
|
-
t.optional_type = optional_type.is_a?(String) ? string(optional_type) : type_of(optional_type)
|
80
|
-
t
|
73
|
+
Types::POptionalType.new(type_of(optional_type.is_a?(String) ? string(nil, optional_type) : type_of(optional_type)))
|
81
74
|
end
|
82
75
|
|
83
76
|
# Produces the Enum type, optionally with specific string values
|
84
77
|
# @api public
|
85
78
|
#
|
86
79
|
def self.enum(*values)
|
87
|
-
|
88
|
-
values.each {|v| t.addValues(v) }
|
89
|
-
t
|
80
|
+
Types::PEnumType.new(values)
|
90
81
|
end
|
91
82
|
|
92
83
|
# Produces the Variant type, optionally with the "one of" types
|
93
84
|
# @api public
|
94
85
|
#
|
95
86
|
def self.variant(*types)
|
96
|
-
|
97
|
-
t.types = types.map {|v| type_of(v) }
|
98
|
-
t
|
87
|
+
Types::PVariantType.new(types.map {|v| type_of(v) })
|
99
88
|
end
|
100
89
|
|
101
90
|
# Produces the Struct type, either a non parameterized instance representing
|
@@ -111,17 +100,16 @@ module Puppet::Pops::Types::TypeFactory
|
|
111
100
|
#
|
112
101
|
def self.struct(hash = {})
|
113
102
|
tc = @type_calculator
|
114
|
-
|
115
|
-
t.elements = hash.map do |key_type, value_type|
|
103
|
+
elements = hash.map do |key_type, value_type|
|
116
104
|
value_type = type_of(value_type)
|
117
105
|
raise ArgumentError, 'Struct element value_type must be a Type' unless value_type.is_a?(Types::PAnyType)
|
118
106
|
|
119
107
|
# TODO: Should have stricter name rule
|
120
108
|
if key_type.is_a?(String)
|
121
109
|
raise ArgumentError, 'Struct element key cannot be an empty String' if key_type.empty?
|
122
|
-
key_type = string(key_type)
|
110
|
+
key_type = string(nil, key_type)
|
123
111
|
# Must make key optional if the value can be Undef
|
124
|
-
key_type = optional(key_type) if tc.assignable?(value_type,
|
112
|
+
key_type = optional(key_type) if tc.assignable?(value_type, Types::PUndefType::DEFAULT)
|
125
113
|
else
|
126
114
|
# assert that the key type is one of String[1], NotUndef[String[1]] and Optional[String[1]]
|
127
115
|
case key_type
|
@@ -131,39 +119,36 @@ module Puppet::Pops::Types::TypeFactory
|
|
131
119
|
s = key_type
|
132
120
|
when Types::POptionalType
|
133
121
|
s = key_type.optional_type
|
134
|
-
|
122
|
+
when Types::PStringType, Types::PEnumType
|
135
123
|
s = key_type
|
124
|
+
else
|
125
|
+
raise ArgumentError, "Illegal Struct member key type. Expected NotUndef, Optional, String, or Enum. Got: #{key_type.class.name}"
|
136
126
|
end
|
137
127
|
unless (s.is_a?(Puppet::Pops::Types::PStringType) || s.is_a?(Puppet::Pops::Types::PEnumType)) && s.values.size == 1 && !s.values[0].empty?
|
138
|
-
raise ArgumentError,
|
128
|
+
raise ArgumentError, "Unable to extract a non-empty literal string from Struct member key type #{tc.string(key_type)}"
|
139
129
|
end
|
140
130
|
end
|
141
|
-
|
142
|
-
elem.key_type = key_type
|
143
|
-
elem.value_type = value_type
|
144
|
-
elem
|
131
|
+
Types::PStructElement.new(key_type, value_type)
|
145
132
|
end
|
146
|
-
|
133
|
+
Types::PStructType.new(elements)
|
147
134
|
end
|
148
135
|
|
149
|
-
def self.tuple(
|
150
|
-
|
151
|
-
t.types = types.map {|elem| type_of(elem) }
|
152
|
-
t
|
136
|
+
def self.tuple(types = [], size_type = nil)
|
137
|
+
Types::PTupleType.new(types.map {|elem| type_of(elem) }, size_type)
|
153
138
|
end
|
154
139
|
|
155
140
|
# Produces the Boolean type
|
156
141
|
# @api public
|
157
142
|
#
|
158
|
-
def self.boolean
|
159
|
-
Types::PBooleanType
|
143
|
+
def self.boolean
|
144
|
+
Types::PBooleanType::DEFAULT
|
160
145
|
end
|
161
146
|
|
162
147
|
# Produces the Any type
|
163
148
|
# @api public
|
164
149
|
#
|
165
|
-
def self.any
|
166
|
-
Types::PAnyType
|
150
|
+
def self.any
|
151
|
+
Types::PAnyType::DEFAULT
|
167
152
|
end
|
168
153
|
|
169
154
|
# Produces the Regexp type
|
@@ -172,59 +157,54 @@ module Puppet::Pops::Types::TypeFactory
|
|
172
157
|
# @api public
|
173
158
|
#
|
174
159
|
def self.regexp(pattern = nil)
|
175
|
-
t = Types::PRegexpType.new()
|
176
160
|
if pattern
|
177
|
-
t
|
161
|
+
t = Types::PRegexpType.new(pattern.is_a?(Regexp) ? pattern.inspect[1..-2] : pattern)
|
162
|
+
t.regexp unless pattern.nil? # compile pattern to catch errors
|
163
|
+
t
|
164
|
+
else
|
165
|
+
Types::PRegexpType::DEFAULT
|
178
166
|
end
|
179
|
-
t.regexp() unless pattern.nil? # compile pattern to catch errors
|
180
|
-
t
|
181
167
|
end
|
182
168
|
|
183
169
|
def self.pattern(*regular_expressions)
|
184
|
-
|
185
|
-
regular_expressions.each do |re|
|
170
|
+
patterns = regular_expressions.map do |re|
|
186
171
|
case re
|
187
172
|
when String
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
t.addPatterns(re_T)
|
173
|
+
re_t = Types::PRegexpType.new(re)
|
174
|
+
re_t.regexp # compile it to catch errors
|
175
|
+
re_t
|
192
176
|
|
193
177
|
when Regexp
|
194
|
-
re_T = Types::PRegexpType.new()
|
195
178
|
# Regep.to_s includes options user did not enter and does not escape source
|
196
179
|
# to work either as a string or as a // regexp. The inspect method does a better
|
197
180
|
# job, but includes the //
|
198
|
-
|
199
|
-
t.addPatterns(re_T)
|
181
|
+
Types::PRegexpType.new(re.inspect[1..-2])
|
200
182
|
|
201
183
|
when Types::PRegexpType
|
202
|
-
|
184
|
+
re
|
203
185
|
|
204
186
|
when Types::PPatternType
|
205
|
-
re.patterns
|
206
|
-
t.addPatterns(p.copy)
|
207
|
-
end
|
187
|
+
re.patterns
|
208
188
|
|
209
189
|
else
|
210
190
|
raise ArgumentError, "Only String, Regexp, Pattern-Type, and Regexp-Type are allowed: got '#{re.class}"
|
211
191
|
end
|
212
|
-
end
|
213
|
-
|
192
|
+
end.flatten.uniq
|
193
|
+
Types::PPatternType.new(patterns)
|
214
194
|
end
|
215
195
|
|
216
196
|
# Produces the Literal type
|
217
197
|
# @api public
|
218
198
|
#
|
219
|
-
def self.scalar
|
220
|
-
Types::PScalarType
|
199
|
+
def self.scalar
|
200
|
+
Types::PScalarType::DEFAULT
|
221
201
|
end
|
222
202
|
|
223
203
|
# Produces a CallableType matching all callables
|
224
204
|
# @api public
|
225
205
|
#
|
226
|
-
def self.all_callables
|
227
|
-
return Puppet::Pops::Types::PCallableType
|
206
|
+
def self.all_callables
|
207
|
+
return Puppet::Pops::Types::PCallableType::DEFAULT
|
228
208
|
end
|
229
209
|
|
230
210
|
# Produces a Callable type with one signature without support for a block
|
@@ -244,9 +224,7 @@ module Puppet::Pops::Types::TypeFactory
|
|
244
224
|
# Params are given as a sequence of arguments to {#type_of}.
|
245
225
|
#
|
246
226
|
def self.callable(*params)
|
247
|
-
|
248
|
-
last_callable = true
|
249
|
-
end
|
227
|
+
last_callable = Puppet::Pops::Types::TypeCalculator.is_kind_of_callable?(params.last)
|
250
228
|
block_t = last_callable ? params.pop : nil
|
251
229
|
|
252
230
|
# compute a size_type for the signature based on the two last parameters
|
@@ -256,63 +234,50 @@ module Puppet::Pops::Types::TypeFactory
|
|
256
234
|
elsif is_range_parameter?(params[-1])
|
257
235
|
size_type = range(params[-1], :default)
|
258
236
|
params = params[0, params.size - 1]
|
237
|
+
else
|
238
|
+
size_type = nil
|
259
239
|
end
|
260
240
|
|
261
241
|
types = params.map {|p| type_of(p) }
|
262
242
|
|
263
243
|
# If the specification requires types, and none were given, a Unit type is used
|
264
244
|
if types.empty? && !size_type.nil? && size_type.range[1] > 0
|
265
|
-
types << Types::PUnitType
|
245
|
+
types << Types::PUnitType::DEFAULT
|
266
246
|
end
|
267
247
|
# create a signature
|
268
|
-
|
269
|
-
tuple_t
|
270
|
-
tuple_t.size_type = size_type unless size_type.nil?
|
271
|
-
callable_t.param_types = tuple_t
|
272
|
-
|
273
|
-
callable_t.block_type = block_t
|
274
|
-
callable_t
|
275
|
-
end
|
276
|
-
|
277
|
-
def self.with_block(callable, *block_params)
|
278
|
-
callable.block_type = callable(*block_params)
|
279
|
-
callable
|
280
|
-
end
|
281
|
-
|
282
|
-
def self.with_optional_block(callable, *block_params)
|
283
|
-
callable.block_type = optional(callable(*block_params))
|
284
|
-
callable
|
248
|
+
tuple_t = tuple(types, size_type)
|
249
|
+
Types::PCallableType.new(tuple_t, block_t)
|
285
250
|
end
|
286
251
|
|
287
252
|
# Produces the abstract type Collection
|
288
253
|
# @api public
|
289
254
|
#
|
290
|
-
def self.collection()
|
291
|
-
Types::PCollectionType.new()
|
255
|
+
def self.collection(size_type = nil)
|
256
|
+
size_type.nil? ? Types::PCollectionType::DEFAULT : Types::PCollectionType.new(nil, size_type)
|
292
257
|
end
|
293
258
|
|
294
259
|
# Produces the Data type
|
295
260
|
# @api public
|
296
261
|
#
|
297
|
-
def self.data
|
298
|
-
Types::PDataType
|
262
|
+
def self.data
|
263
|
+
Types::PDataType::DEFAULT
|
299
264
|
end
|
300
265
|
|
301
266
|
# Creates an instance of the Undef type
|
302
267
|
# @api public
|
303
|
-
def self.undef
|
304
|
-
Types::PUndefType
|
268
|
+
def self.undef
|
269
|
+
Types::PUndefType::DEFAULT
|
305
270
|
end
|
306
271
|
|
307
272
|
# Creates an instance of the Default type
|
308
273
|
# @api public
|
309
|
-
def self.default
|
310
|
-
Types::PDefaultType
|
274
|
+
def self.default
|
275
|
+
Types::PDefaultType::DEFAULT
|
311
276
|
end
|
312
277
|
|
313
278
|
# Produces an instance of the abstract type PCatalogEntryType
|
314
|
-
def self.catalog_entry
|
315
|
-
Types::PCatalogEntryType
|
279
|
+
def self.catalog_entry
|
280
|
+
Types::PCatalogEntryType::DEFAULT
|
316
281
|
end
|
317
282
|
|
318
283
|
# Produces a PResourceType with a String type_name A PResourceType with a nil
|
@@ -321,18 +286,15 @@ module Puppet::Pops::Types::TypeFactory
|
|
321
286
|
# name. (There is no resource-type subtyping in Puppet (yet)).
|
322
287
|
#
|
323
288
|
def self.resource(type_name = nil, title = nil)
|
324
|
-
type = Types::PResourceType.new()
|
325
289
|
type_name = type_name.type_name if type_name.is_a?(Types::PResourceType)
|
326
290
|
type_name = type_name.downcase unless type_name.nil?
|
327
|
-
type.type_name = type_name
|
328
291
|
unless type_name.nil? || type_name =~ Puppet::Pops::Patterns::CLASSREF
|
329
292
|
raise ArgumentError, "Illegal type name '#{type.type_name}'"
|
330
293
|
end
|
331
294
|
if type_name.nil? && !title.nil?
|
332
|
-
raise ArgumentError,
|
295
|
+
raise ArgumentError, 'The type name cannot be nil, if title is given'
|
333
296
|
end
|
334
|
-
|
335
|
-
type
|
297
|
+
Types::PResourceType.new(type_name, title)
|
336
298
|
end
|
337
299
|
|
338
300
|
# Produces PHostClassType with a string class_name. A PHostClassType with
|
@@ -341,51 +303,41 @@ module Puppet::Pops::Types::TypeFactory
|
|
341
303
|
# with the same name.
|
342
304
|
#
|
343
305
|
def self.host_class(class_name = nil)
|
344
|
-
|
345
|
-
|
346
|
-
|
306
|
+
if class_name.nil?
|
307
|
+
Types::PHostClassType::DEFAULT
|
308
|
+
else
|
309
|
+
Types::PHostClassType.new(class_name.sub(/^::/, ''))
|
347
310
|
end
|
348
|
-
type
|
349
311
|
end
|
350
312
|
|
351
313
|
# Produces a type for Array[o] where o is either a type, or an instance for
|
352
314
|
# which a type is inferred.
|
353
315
|
# @api public
|
354
316
|
#
|
355
|
-
def self.array_of(o)
|
356
|
-
|
357
|
-
type.element_type = type_of(o)
|
358
|
-
type
|
317
|
+
def self.array_of(o, size_type = nil)
|
318
|
+
Types::PArrayType.new(type_of(o), size_type)
|
359
319
|
end
|
360
320
|
|
361
321
|
# Produces a type for Hash[Scalar, o] where o is either a type, or an
|
362
322
|
# instance for which a type is inferred.
|
363
323
|
# @api public
|
364
324
|
#
|
365
|
-
def self.hash_of(value, key = scalar
|
366
|
-
|
367
|
-
type.key_type = type_of(key)
|
368
|
-
type.element_type = type_of(value)
|
369
|
-
type
|
325
|
+
def self.hash_of(value, key = scalar, size_type = nil)
|
326
|
+
Types::PHashType.new(type_of(key), type_of(value), size_type)
|
370
327
|
end
|
371
328
|
|
372
329
|
# Produces a type for Array[Data]
|
373
330
|
# @api public
|
374
331
|
#
|
375
|
-
def self.array_of_data
|
376
|
-
|
377
|
-
type.element_type = data()
|
378
|
-
type
|
332
|
+
def self.array_of_data
|
333
|
+
Types::PArrayType::DATA
|
379
334
|
end
|
380
335
|
|
381
336
|
# Produces a type for Hash[Scalar, Data]
|
382
337
|
# @api public
|
383
338
|
#
|
384
|
-
def self.hash_of_data
|
385
|
-
|
386
|
-
type.key_type = scalar()
|
387
|
-
type.element_type = data()
|
388
|
-
type
|
339
|
+
def self.hash_of_data
|
340
|
+
Types::PHashType::DATA
|
389
341
|
end
|
390
342
|
|
391
343
|
# Produces a type for NotUndef[T]
|
@@ -398,19 +350,15 @@ module Puppet::Pops::Types::TypeFactory
|
|
398
350
|
# @api public
|
399
351
|
#
|
400
352
|
def self.not_undef(inst_type = nil)
|
401
|
-
|
402
|
-
|
403
|
-
type.type = inst_type
|
404
|
-
type
|
353
|
+
inst_type = string(nil, inst_type) if inst_type.is_a?(String)
|
354
|
+
Types::PNotUndefType.new(inst_type)
|
405
355
|
end
|
406
356
|
|
407
357
|
# Produces a type for Type[T]
|
408
358
|
# @api public
|
409
359
|
#
|
410
360
|
def self.type_type(inst_type = nil)
|
411
|
-
|
412
|
-
type.type = inst_type
|
413
|
-
type
|
361
|
+
inst_type.nil? ? Types::PType::DEFAULT : Types::PType.new(inst_type)
|
414
362
|
end
|
415
363
|
|
416
364
|
# Produce a type corresponding to the class of given unless given is a
|
@@ -423,7 +371,7 @@ module Puppet::Pops::Types::TypeFactory
|
|
423
371
|
elsif o.is_a?(Types::PAnyType)
|
424
372
|
o
|
425
373
|
elsif o.is_a?(String)
|
426
|
-
Types::PRuntimeType.new(:
|
374
|
+
Types::PRuntimeType.new(:ruby, o)
|
427
375
|
else
|
428
376
|
@type_calculator.infer_generic(o)
|
429
377
|
end
|
@@ -447,7 +395,7 @@ module Puppet::Pops::Types::TypeFactory
|
|
447
395
|
if o.is_a?(Class)
|
448
396
|
@type_calculator.type(o)
|
449
397
|
else
|
450
|
-
Types::PRuntimeType.new(:
|
398
|
+
Types::PRuntimeType.new(:ruby, o.class.name)
|
451
399
|
end
|
452
400
|
end
|
453
401
|
|
@@ -456,7 +404,7 @@ module Puppet::Pops::Types::TypeFactory
|
|
456
404
|
# or mapps a Ruby Class to its name.
|
457
405
|
#
|
458
406
|
def self.ruby_type(class_name = nil)
|
459
|
-
Types::PRuntimeType.new(:
|
407
|
+
Types::PRuntimeType.new(:ruby, class_name)
|
460
408
|
end
|
461
409
|
|
462
410
|
# Generic creator of a RuntimeType - allows creating the type with nil or
|
@@ -464,16 +412,7 @@ module Puppet::Pops::Types::TypeFactory
|
|
464
412
|
#
|
465
413
|
def self.runtime(runtime=nil, runtime_type_name = nil)
|
466
414
|
runtime = runtime.to_sym if runtime.is_a?(String)
|
467
|
-
Types::PRuntimeType.new(
|
468
|
-
end
|
469
|
-
|
470
|
-
# Sets the accepted size range of a collection if something other than the
|
471
|
-
# default 0 to Infinity is wanted. The semantics for from/to are the same as
|
472
|
-
# for #range
|
473
|
-
#
|
474
|
-
def self.constrain_size(collection_t, from, to)
|
475
|
-
collection_t.size_type = range(from, to)
|
476
|
-
collection_t
|
415
|
+
Types::PRuntimeType.new(runtime, runtime_type_name)
|
477
416
|
end
|
478
417
|
|
479
418
|
# Returns true if the given type t is of valid range parameter type (integer
|