puppet 4.1.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/COMMITTERS.md +2 -2
- data/CONTRIBUTING.md +51 -10
- data/Gemfile +27 -14
- data/LICENSE +3 -3
- data/MAINTAINERS +66 -0
- data/README.md +9 -11
- data/Rakefile +36 -0
- data/conf/auth.conf +23 -2
- data/conf/fileserver.conf +7 -12
- data/conf/hiera.yaml +11 -0
- data/conf/puppet.conf +1 -1
- data/ext/README.environment +1 -1
- data/ext/build_defaults.yaml +2 -2
- data/ext/debian/README.source +1 -1
- data/ext/debian/control +3 -5
- data/ext/debian/copyright +4 -4
- data/ext/debian/puppet-common.install +0 -1
- data/ext/debian/puppet-common.manpages +0 -2
- data/ext/debian/puppet.init +0 -1
- data/ext/debian/puppet.logrotate +14 -5
- data/ext/debian/puppetmaster.README.debian +11 -9
- data/ext/envpuppet +2 -2
- data/ext/hiera/hiera.yaml +15 -0
- data/ext/ips/puppetagent.xml +1 -1
- data/ext/ips/puppetmaster.xml +1 -1
- data/ext/logcheck/puppet +1 -1
- data/ext/osx/puppet.plist +30 -0
- data/ext/project_data.yaml +29 -16
- data/ext/puppet-test +3 -27
- data/ext/rack/config.ru +2 -2
- data/ext/rack/example-passenger-vhost.conf +1 -1
- data/ext/redhat/client.init +67 -17
- data/ext/redhat/client.sysconfig +1 -10
- data/ext/redhat/logrotate +15 -3
- data/ext/redhat/puppet.spec.erb +6 -14
- data/ext/redhat/server.init +1 -1
- data/ext/regexp_nodes/regexp_nodes.rb +1 -1
- data/ext/solaris/pkginfo +1 -1
- data/ext/solaris/smf/puppet +44 -0
- data/ext/solaris/smf/puppet.xml +44 -0
- data/ext/suse/client.init +30 -33
- data/ext/suse/puppet.spec +2 -2
- data/ext/suse/server.init +2 -2
- data/ext/systemd/puppet.service +13 -1
- data/ext/upload_facts.rb +1 -1
- data/ext/windows/puppet_interactive.bat +6 -0
- data/ext/windows/puppet_shell.bat +9 -0
- data/ext/windows/run_puppet_interactive.bat +9 -0
- data/ext/windows/service/daemon.rb +10 -15
- data/ext/yaml_nodes.rb +1 -1
- data/install.rb +99 -66
- data/lib/hiera/puppet_function.rb +17 -18
- data/lib/hiera/scope.rb +12 -14
- data/lib/hiera_puppet.rb +6 -14
- data/lib/puppet/agent/disabler.rb +3 -3
- data/lib/puppet/agent/locker.rb +12 -3
- data/lib/puppet/agent.rb +35 -39
- data/lib/puppet/application/agent.rb +48 -25
- data/lib/puppet/application/apply.rb +63 -29
- data/lib/puppet/application/ca.rb +1 -0
- data/lib/puppet/application/cert.rb +54 -5
- data/lib/puppet/application/describe.rb +2 -2
- data/lib/puppet/application/device.rb +72 -47
- data/lib/puppet/application/doc.rb +9 -9
- data/lib/puppet/application/face_base.rb +11 -12
- data/lib/puppet/application/filebucket.rb +84 -10
- data/lib/puppet/application/generate.rb +5 -0
- data/lib/puppet/application/lookup.rb +357 -0
- data/lib/puppet/application/master.rb +21 -25
- data/lib/puppet/application/resource.rb +22 -23
- data/lib/puppet/application.rb +31 -15
- data/lib/puppet/application_support.rb +1 -1
- data/lib/puppet/compilable_resource_type.rb +15 -0
- data/lib/puppet/configurer/downloader.rb +2 -2
- data/lib/puppet/configurer/fact_handler.rb +13 -4
- data/lib/puppet/configurer/plugin_handler.rb +7 -5
- data/lib/puppet/configurer.rb +192 -51
- data/lib/puppet/context/trusted_information.rb +22 -2
- data/lib/puppet/context.rb +20 -5
- data/lib/puppet/daemon.rb +17 -13
- data/lib/puppet/data_binding.rb +4 -2
- data/lib/puppet/defaults.rb +298 -130
- data/lib/puppet/environments.rb +104 -9
- data/lib/puppet/error.rb +5 -1
- data/lib/puppet/etc.rb +161 -0
- data/lib/puppet/external/dot.rb +1 -1
- data/lib/puppet/external/pson/common.rb +4 -0
- data/lib/puppet/face/ca.rb +56 -44
- data/lib/puppet/face/catalog/select.rb +4 -4
- data/lib/puppet/face/catalog.rb +3 -3
- data/lib/puppet/face/certificate.rb +28 -22
- data/lib/puppet/face/certificate_request.rb +3 -1
- data/lib/puppet/face/certificate_revocation_list.rb +3 -1
- data/lib/puppet/face/config.rb +12 -12
- data/lib/puppet/face/epp.rb +96 -50
- data/lib/puppet/face/facts.rb +5 -5
- data/lib/puppet/face/generate.rb +64 -0
- data/lib/puppet/face/help/face.erb +3 -0
- data/lib/puppet/face/help/man.erb +1 -1
- data/lib/puppet/face/help.rb +37 -29
- data/lib/puppet/face/key.rb +4 -3
- data/lib/puppet/face/man.rb +12 -10
- data/lib/puppet/face/module/build.rb +7 -7
- data/lib/puppet/face/module/changes.rb +8 -7
- data/lib/puppet/face/module/generate.rb +25 -25
- data/lib/puppet/face/module/install.rb +19 -15
- data/lib/puppet/face/module/list.rb +16 -12
- data/lib/puppet/face/module/search.rb +4 -4
- data/lib/puppet/face/module/uninstall.rb +13 -10
- data/lib/puppet/face/module/upgrade.rb +11 -7
- data/lib/puppet/face/module.rb +3 -3
- data/lib/puppet/face/node/clean.rb +8 -8
- data/lib/puppet/face/node.rb +6 -6
- data/lib/puppet/face/parser.rb +28 -25
- data/lib/puppet/face/plugin.rb +14 -21
- data/lib/puppet/face/report.rb +10 -10
- data/lib/puppet/face/resource.rb +13 -13
- data/lib/puppet/face/status.rb +9 -6
- data/lib/puppet/feature/base.rb +13 -5
- data/lib/puppet/feature/cfpropertylist.rb +3 -0
- data/lib/puppet/feature/eventlog.rb +1 -1
- data/lib/puppet/feature/hiera_eyaml.rb +3 -0
- data/lib/puppet/feature/hocon.rb +3 -0
- data/lib/puppet/feature/telnet.rb +9 -0
- data/lib/puppet/file_bucket/dipper.rb +62 -6
- data/lib/puppet/file_bucket/file.rb +4 -17
- data/lib/puppet/file_serving/base.rb +3 -3
- data/lib/puppet/file_serving/configuration/parser.rb +12 -12
- data/lib/puppet/file_serving/configuration.rb +3 -3
- data/lib/puppet/file_serving/content.rb +1 -1
- data/lib/puppet/file_serving/fileset.rb +7 -5
- data/lib/puppet/file_serving/http_metadata.rb +46 -0
- data/lib/puppet/file_serving/metadata.rb +22 -6
- data/lib/puppet/file_serving/mount/file.rb +6 -6
- data/lib/puppet/file_serving/mount/modules.rb +1 -1
- data/lib/puppet/file_serving/mount.rb +1 -1
- data/lib/puppet/file_serving/terminus_selector.rb +3 -1
- data/lib/puppet/file_system/file_impl.rb +9 -4
- data/lib/puppet/file_system/memory_impl.rb +6 -2
- data/lib/puppet/file_system/path_pattern.rb +7 -6
- data/lib/puppet/file_system/uniquefile.rb +5 -5
- data/lib/puppet/file_system/windows.rb +31 -16
- data/lib/puppet/file_system.rb +33 -5
- data/lib/puppet/forge/cache.rb +1 -0
- data/lib/puppet/forge/errors.rb +12 -12
- data/lib/puppet/forge/repository.rb +5 -36
- data/lib/puppet/forge.rb +17 -15
- data/lib/puppet/functions/alert.rb +14 -0
- data/lib/puppet/functions/annotate.rb +108 -0
- data/lib/puppet/functions/assert_type.rb +53 -19
- data/lib/puppet/functions/binary_file.rb +19 -0
- data/lib/puppet/functions/break.rb +22 -0
- data/lib/puppet/functions/call.rb +42 -0
- data/lib/puppet/functions/contain.rb +33 -0
- data/lib/puppet/functions/crit.rb +14 -0
- data/lib/puppet/functions/debug.rb +14 -0
- data/lib/puppet/functions/defined.rb +92 -62
- data/lib/puppet/functions/dig.rb +23 -0
- data/lib/puppet/functions/each.rb +89 -39
- data/lib/puppet/functions/emerg.rb +14 -0
- data/lib/puppet/functions/epp.rb +29 -37
- data/lib/puppet/functions/err.rb +14 -0
- data/lib/puppet/functions/eyaml_lookup_key.rb +94 -0
- data/lib/puppet/functions/filter.rb +64 -38
- data/lib/puppet/functions/find_file.rb +31 -0
- data/lib/puppet/functions/hiera.rb +83 -3
- data/lib/puppet/functions/hiera_array.rb +73 -4
- data/lib/puppet/functions/hiera_hash.rb +82 -2
- data/lib/puppet/functions/hiera_include.rb +93 -6
- data/lib/puppet/functions/hocon_data.rb +41 -0
- data/lib/puppet/functions/include.rb +21 -0
- data/lib/puppet/functions/info.rb +14 -0
- data/lib/puppet/functions/inline_epp.rb +44 -71
- data/lib/puppet/functions/json_data.rb +33 -0
- data/lib/puppet/functions/lest.rb +17 -0
- data/lib/puppet/functions/lookup.rb +172 -184
- data/lib/puppet/functions/map.rb +60 -33
- data/lib/puppet/functions/match.rb +32 -14
- data/lib/puppet/functions/new.rb +31 -0
- data/lib/puppet/functions/next.rb +23 -0
- data/lib/puppet/functions/notice.rb +14 -0
- data/lib/puppet/functions/reduce.rb +112 -71
- data/lib/puppet/functions/regsubst.rb +22 -25
- data/lib/puppet/functions/require.rb +37 -0
- data/lib/puppet/functions/return.rb +22 -0
- data/lib/puppet/functions/reverse_each.rb +25 -0
- data/lib/puppet/functions/scanf.rb +15 -18
- data/lib/puppet/functions/slice.rb +25 -39
- data/lib/puppet/functions/split.rb +2 -2
- data/lib/puppet/functions/step.rb +26 -0
- data/lib/puppet/functions/strftime.rb +43 -0
- data/lib/puppet/functions/then.rb +14 -0
- data/lib/puppet/functions/type.rb +31 -0
- data/lib/puppet/functions/unique.rb +132 -0
- data/lib/puppet/functions/unwrap.rb +40 -0
- data/lib/puppet/functions/versioncmp.rb +36 -0
- data/lib/puppet/functions/warning.rb +14 -0
- data/lib/puppet/functions/with.rb +15 -7
- data/lib/puppet/functions/yaml_data.rb +42 -0
- data/lib/puppet/functions.rb +194 -74
- data/lib/puppet/generate/models/type/property.rb +70 -0
- data/lib/puppet/generate/models/type/type.rb +62 -0
- data/lib/puppet/generate/templates/type/pcore.erb +42 -0
- data/lib/puppet/generate/type.rb +239 -0
- data/lib/puppet/graph/rb_tree_map.rb +1 -1
- data/lib/puppet/graph/relationship_graph.rb +4 -1
- data/lib/puppet/graph/simple_graph.rb +51 -74
- data/lib/puppet/indirector/catalog/compiler.rb +241 -37
- data/lib/puppet/indirector/catalog/json.rb +18 -0
- data/lib/puppet/indirector/certificate/disabled_ca.rb +1 -1
- data/lib/puppet/indirector/certificate_request/ca.rb +3 -3
- data/lib/puppet/indirector/certificate_request/disabled_ca.rb +1 -1
- data/lib/puppet/indirector/certificate_revocation_list/disabled_ca.rb +1 -1
- data/lib/puppet/indirector/certificate_status/file.rb +6 -6
- data/lib/puppet/indirector/data_binding/none.rb +4 -1
- data/lib/puppet/indirector/exec.rb +2 -2
- data/lib/puppet/indirector/face.rb +24 -19
- data/lib/puppet/indirector/facts/facter.rb +3 -6
- data/lib/puppet/indirector/file_bucket_file/file.rb +142 -29
- data/lib/puppet/indirector/file_content/http.rb +15 -0
- data/lib/puppet/indirector/file_metadata/http.rb +27 -0
- data/lib/puppet/indirector/file_server.rb +10 -2
- data/lib/puppet/indirector/generic_http.rb +16 -0
- data/lib/puppet/indirector/hiera.rb +12 -4
- data/lib/puppet/indirector/indirection.rb +25 -18
- data/lib/puppet/indirector/json.rb +11 -12
- data/lib/puppet/indirector/key/ca.rb +2 -2
- data/lib/puppet/indirector/key/disabled_ca.rb +1 -1
- data/lib/puppet/indirector/key/file.rb +4 -3
- data/lib/puppet/indirector/ldap.rb +6 -5
- data/lib/puppet/indirector/memory.rb +1 -1
- data/lib/puppet/indirector/msgpack.rb +9 -8
- data/lib/puppet/indirector/node/exec.rb +9 -7
- data/lib/puppet/indirector/node/ldap.rb +10 -8
- data/lib/puppet/indirector/node/plain.rb +2 -1
- data/lib/puppet/indirector/node/write_only_yaml.rb +6 -1
- data/lib/puppet/indirector/node/yaml.rb +0 -9
- data/lib/puppet/indirector/report/processor.rb +2 -2
- data/lib/puppet/indirector/report/rest.rb +13 -0
- data/lib/puppet/indirector/request.rb +40 -23
- data/lib/puppet/indirector/resource/ral.rb +1 -1
- data/lib/puppet/indirector/resource/validator.rb +1 -1
- data/lib/puppet/indirector/rest.rb +103 -10
- data/lib/puppet/indirector/ssl_file.rb +33 -12
- data/lib/puppet/indirector/terminus.rb +7 -7
- data/lib/puppet/indirector/yaml.rb +5 -5
- data/lib/puppet/indirector.rb +2 -2
- data/lib/puppet/info_service/class_information_service.rb +110 -0
- data/lib/puppet/info_service.rb +7 -0
- data/lib/puppet/interface/documentation.rb +1 -1
- data/lib/puppet/interface/face_collection.rb +7 -2
- data/lib/puppet/interface.rb +12 -4
- data/lib/puppet/loaders.rb +5 -0
- data/lib/puppet/metatype/manager.rb +25 -8
- data/lib/puppet/module.rb +73 -34
- data/lib/puppet/module_tool/applications/application.rb +8 -9
- data/lib/puppet/module_tool/applications/builder.rb +9 -9
- data/lib/puppet/module_tool/applications/checksummer.rb +2 -2
- data/lib/puppet/module_tool/applications/installer.rb +21 -20
- data/lib/puppet/module_tool/applications/searcher.rb +1 -1
- data/lib/puppet/module_tool/applications/uninstaller.rb +2 -1
- data/lib/puppet/module_tool/applications/unpacker.rb +4 -4
- data/lib/puppet/module_tool/applications/upgrader.rb +19 -18
- data/lib/puppet/module_tool/checksums.rb +1 -1
- data/lib/puppet/module_tool/contents_description.rb +1 -1
- data/lib/puppet/module_tool/dependency.rb +0 -1
- data/lib/puppet/module_tool/errors/installer.rb +23 -23
- data/lib/puppet/module_tool/errors/shared.rb +44 -42
- data/lib/puppet/module_tool/errors/uninstaller.rb +13 -9
- data/lib/puppet/module_tool/errors/upgrader.rb +11 -11
- data/lib/puppet/module_tool/install_directory.rb +1 -1
- data/lib/puppet/module_tool/installed_modules.rb +10 -10
- data/lib/puppet/module_tool/local_tarball.rb +7 -7
- data/lib/puppet/module_tool/metadata.rb +47 -21
- data/lib/puppet/module_tool/shared_behaviors.rb +6 -6
- data/lib/puppet/module_tool/skeleton/templates/generator/Gemfile +14 -3
- data/lib/puppet/module_tool/skeleton/templates/generator/README.md.erb +48 -38
- data/lib/puppet/module_tool/skeleton/templates/generator/Rakefile +19 -4
- data/lib/puppet/module_tool/skeleton/templates/generator/{tests → examples}/init.pp.erb +3 -3
- data/lib/puppet/module_tool/skeleton/templates/generator/manifests/init.pp.erb +25 -18
- data/lib/puppet/module_tool/skeleton/templates/generator/spec/classes/init_spec.rb.erb +1 -2
- data/lib/puppet/module_tool/tar/mini.rb +3 -3
- data/lib/puppet/module_tool/tar.rb +5 -4
- data/lib/puppet/module_tool.rb +11 -7
- data/lib/puppet/network/auth_config_parser.rb +13 -12
- data/lib/puppet/network/authconfig.rb +23 -3
- data/lib/puppet/network/authorization.rb +8 -1
- data/lib/puppet/network/authstore.rb +2 -2
- data/lib/puppet/network/format.rb +7 -7
- data/lib/puppet/network/format_handler.rb +12 -9
- data/lib/puppet/network/format_support.rb +11 -5
- data/lib/puppet/network/formats.rb +38 -27
- data/lib/puppet/network/http/api/indirected_routes.rb +86 -58
- data/lib/puppet/network/http/api/master/v3/environment.rb +82 -0
- data/lib/puppet/network/http/api/master/v3.rb +7 -1
- data/lib/puppet/network/http/compression.rb +12 -8
- data/lib/puppet/network/http/connection.rb +21 -15
- data/lib/puppet/network/http/error.rb +14 -10
- data/lib/puppet/network/http/factory.rb +8 -4
- data/lib/puppet/network/http/handler.rb +11 -6
- data/lib/puppet/network/http/issues.rb +1 -0
- data/lib/puppet/network/http/pool.rb +10 -1
- data/lib/puppet/network/http/rack/rest.rb +27 -3
- data/lib/puppet/network/http/rack.rb +2 -2
- data/lib/puppet/network/http/request.rb +34 -20
- data/lib/puppet/network/http/response.rb +13 -1
- data/lib/puppet/network/http/webrick/rest.rb +2 -2
- data/lib/puppet/network/http/webrick.rb +7 -6
- data/lib/puppet/network/rights.rb +7 -17
- data/lib/puppet/network/server.rb +2 -2
- data/lib/puppet/node/environment.rb +69 -17
- data/lib/puppet/node/facts.rb +1 -6
- data/lib/puppet/node.rb +45 -18
- data/lib/puppet/parameter/boolean.rb +1 -1
- data/lib/puppet/parameter/package_options.rb +1 -1
- data/lib/puppet/parameter/path.rb +3 -3
- data/lib/puppet/parameter/value.rb +1 -1
- data/lib/puppet/parameter/value_collection.rb +4 -4
- data/lib/puppet/parameter.rb +24 -29
- data/lib/puppet/parser/ast/node.rb +1 -1
- data/lib/puppet/parser/ast/pops_bridge.rb +99 -29
- data/lib/puppet/parser/ast/resource.rb +5 -0
- data/lib/puppet/parser/ast/resource_instance.rb +5 -1
- data/lib/puppet/parser/ast/resourceparam.rb +5 -0
- data/lib/puppet/parser/ast.rb +5 -0
- data/lib/puppet/parser/compiler/catalog_validator/env_relationship_validator.rb +64 -0
- data/lib/puppet/parser/compiler/catalog_validator/relationship_validator.rb +57 -0
- data/lib/puppet/parser/compiler/catalog_validator/site_validator.rb +20 -0
- data/lib/puppet/parser/compiler/catalog_validator.rb +33 -0
- data/lib/puppet/parser/compiler.rb +345 -131
- data/lib/puppet/parser/e4_parser_adapter.rb +14 -14
- data/lib/puppet/parser/environment_compiler.rb +199 -0
- data/lib/puppet/parser/functions/assert_type.rb +47 -17
- data/lib/puppet/parser/functions/binary_file.rb +24 -0
- data/lib/puppet/parser/functions/break.rb +39 -0
- data/lib/puppet/parser/functions/contain.rb +7 -15
- data/lib/puppet/parser/functions/create_resources.rb +49 -25
- data/lib/puppet/parser/functions/defined.rb +106 -93
- data/lib/puppet/parser/functions/dig.rb +29 -0
- data/lib/puppet/parser/functions/each.rb +86 -28
- data/lib/puppet/parser/functions/epp.rb +30 -38
- data/lib/puppet/parser/functions/file.rb +1 -1
- data/lib/puppet/parser/functions/filter.rb +60 -24
- data/lib/puppet/parser/functions/find_file.rb +28 -0
- data/lib/puppet/parser/functions/fqdn_rand.rb +3 -3
- data/lib/puppet/parser/functions/generate.rb +5 -4
- data/lib/puppet/parser/functions/hiera.rb +98 -28
- data/lib/puppet/parser/functions/hiera_array.rb +86 -29
- data/lib/puppet/parser/functions/hiera_hash.rb +96 -31
- data/lib/puppet/parser/functions/hiera_include.rb +96 -41
- data/lib/puppet/parser/functions/include.rb +5 -8
- data/lib/puppet/parser/functions/inline_epp.rb +36 -61
- data/lib/puppet/parser/functions/inline_template.rb +3 -3
- data/lib/puppet/parser/functions/lest.rb +49 -0
- data/lib/puppet/parser/functions/lookup.rb +129 -151
- data/lib/puppet/parser/functions/map.rb +56 -21
- data/lib/puppet/parser/functions/match.rb +29 -13
- data/lib/puppet/parser/functions/new.rb +939 -0
- data/lib/puppet/parser/functions/next.rb +38 -0
- data/lib/puppet/parser/functions/reduce.rb +98 -61
- data/lib/puppet/parser/functions/regsubst.rb +4 -2
- data/lib/puppet/parser/functions/require.rb +4 -27
- data/lib/puppet/parser/functions/return.rb +71 -0
- data/lib/puppet/parser/functions/reverse_each.rb +83 -0
- data/lib/puppet/parser/functions/scanf.rb +25 -31
- data/lib/puppet/parser/functions/slice.rb +18 -25
- data/lib/puppet/parser/functions/split.rb +2 -2
- data/lib/puppet/parser/functions/step.rb +84 -0
- data/lib/puppet/parser/functions/strftime.rb +185 -0
- data/lib/puppet/parser/functions/then.rb +73 -0
- data/lib/puppet/parser/functions/type.rb +53 -0
- data/lib/puppet/parser/functions/with.rb +17 -9
- data/lib/puppet/parser/functions.rb +39 -21
- data/lib/puppet/parser/parser_factory.rb +0 -30
- data/lib/puppet/parser/relationship.rb +49 -20
- data/lib/puppet/parser/resource/param.rb +0 -3
- data/lib/puppet/parser/resource.rb +165 -50
- data/lib/puppet/parser/scope.rb +412 -202
- data/lib/puppet/parser/templatewrapper.rb +2 -2
- data/lib/puppet/parser/type_loader.rb +2 -2
- data/lib/puppet/parser.rb +3 -1
- data/lib/puppet/plugins/configuration.rb +15 -58
- data/lib/puppet/plugins/syntax_checkers.rb +6 -11
- data/lib/puppet/pops/adaptable.rb +12 -7
- data/lib/puppet/pops/adapters.rb +102 -73
- data/lib/puppet/pops/evaluator/access_operator.rb +233 -163
- data/lib/puppet/pops/evaluator/callable_signature.rb +7 -0
- data/lib/puppet/pops/evaluator/closure.rb +231 -115
- data/lib/puppet/pops/evaluator/collector_transformer.rb +50 -26
- data/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +1 -1
- data/lib/puppet/pops/evaluator/collectors/catalog_collector.rb +2 -2
- data/lib/puppet/pops/evaluator/collectors/exported_collector.rb +4 -5
- data/lib/puppet/pops/evaluator/compare_operator.rb +72 -15
- data/lib/puppet/pops/evaluator/epp_evaluator.rb +10 -9
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +236 -140
- data/lib/puppet/pops/evaluator/external_syntax_support.rb +2 -9
- data/lib/puppet/pops/evaluator/json_strict_literal_evaluator.rb +82 -0
- data/lib/puppet/pops/evaluator/literal_evaluator.rb +87 -0
- data/lib/puppet/pops/evaluator/puppet_proc.rb +1 -1
- data/lib/puppet/pops/evaluator/relationship_operator.rb +44 -20
- data/lib/puppet/pops/evaluator/runtime3_converter.rb +74 -49
- data/lib/puppet/pops/evaluator/runtime3_resource_support.rb +117 -0
- data/lib/puppet/pops/evaluator/runtime3_support.rb +134 -88
- data/lib/puppet/pops/functions/dispatch.rb +28 -13
- data/lib/puppet/pops/functions/dispatcher.rb +15 -20
- data/lib/puppet/pops/functions/function.rb +30 -4
- data/lib/puppet/pops/issue_reporter.rb +7 -5
- data/lib/puppet/pops/issues.rb +319 -131
- data/lib/puppet/pops/label_provider.rb +18 -4
- data/lib/puppet/pops/loader/base_loader.rb +74 -20
- data/lib/puppet/pops/loader/dependency_loader.rb +27 -2
- data/lib/puppet/pops/loader/gem_support.rb +2 -2
- data/lib/puppet/pops/loader/loader.rb +47 -49
- data/lib/puppet/pops/loader/loader_paths.rb +48 -2
- data/lib/puppet/pops/loader/module_loaders.rb +109 -27
- data/lib/puppet/pops/loader/null_loader.rb +17 -1
- data/lib/puppet/pops/loader/predefined_loader.rb +24 -0
- data/lib/puppet/pops/loader/puppet_function_instantiator.rb +34 -28
- data/lib/puppet/pops/loader/puppet_resource_type_impl_instantiator.rb +79 -0
- data/lib/puppet/pops/loader/ruby_function_instantiator.rb +19 -7
- data/lib/puppet/pops/loader/runtime3_type_loader.rb +96 -0
- data/lib/puppet/pops/loader/static_loader.rb +111 -41
- data/lib/puppet/pops/loader/type_definition_instantiator.rb +93 -0
- data/lib/puppet/pops/loader/typed_name.rb +54 -0
- data/lib/puppet/pops/loaders.rb +208 -28
- data/lib/puppet/pops/lookup/configured_data_provider.rb +93 -0
- data/lib/puppet/pops/lookup/context.rb +200 -0
- data/lib/puppet/pops/lookup/data_adapter.rb +27 -0
- data/lib/puppet/pops/lookup/data_dig_function_provider.rb +145 -0
- data/lib/puppet/pops/lookup/data_hash_function_provider.rb +126 -0
- data/lib/puppet/pops/lookup/data_provider.rb +92 -0
- data/lib/puppet/pops/lookup/environment_data_provider.rb +35 -0
- data/lib/puppet/pops/lookup/explainer.rb +594 -0
- data/lib/puppet/pops/lookup/function_provider.rb +110 -0
- data/lib/puppet/pops/lookup/global_data_provider.rb +75 -0
- data/lib/puppet/pops/lookup/hiera_config.rb +761 -0
- data/lib/puppet/pops/lookup/interpolation.rb +154 -0
- data/lib/puppet/pops/lookup/invocation.rb +261 -0
- data/lib/puppet/pops/lookup/location_resolver.rb +99 -0
- data/lib/puppet/pops/lookup/lookup_adapter.rb +471 -0
- data/lib/puppet/pops/lookup/lookup_key.rb +99 -0
- data/lib/puppet/pops/lookup/lookup_key_function_provider.rb +92 -0
- data/lib/puppet/pops/lookup/module_data_provider.rb +89 -0
- data/lib/puppet/pops/lookup/sub_lookup.rb +92 -0
- data/lib/puppet/pops/lookup.rb +49 -49
- data/lib/puppet/pops/merge_strategy.rb +197 -46
- data/lib/puppet/pops/migration/migration_checker.rb +4 -0
- data/lib/puppet/pops/model/ast.pp +692 -0
- data/lib/puppet/pops/model/ast.rb +4833 -0
- data/lib/puppet/pops/model/ast_transformer.rb +15 -9
- data/lib/puppet/pops/model/factory.rb +547 -528
- data/lib/puppet/pops/model/model_label_provider.rb +31 -8
- data/lib/puppet/pops/model/model_tree_dumper.rb +52 -7
- data/lib/puppet/pops/parser/code_merger.rb +13 -1
- data/lib/puppet/pops/parser/egrammar.ra +185 -61
- data/lib/puppet/pops/parser/eparser.rb +1819 -1348
- data/lib/puppet/pops/parser/epp_support.rb +15 -9
- data/lib/puppet/pops/parser/evaluating_parser.rb +25 -17
- data/lib/puppet/pops/parser/heredoc_support.rb +16 -13
- data/lib/puppet/pops/parser/interpolation_support.rb +11 -4
- data/lib/puppet/pops/parser/lexer2.rb +459 -399
- data/lib/puppet/pops/parser/lexer_support.rb +85 -7
- data/lib/puppet/pops/parser/locator.rb +86 -9
- data/lib/puppet/pops/parser/parser_support.rb +50 -42
- data/lib/puppet/pops/parser/slurp_support.rb +23 -14
- data/lib/puppet/pops/patterns.rb +16 -1
- data/lib/puppet/pops/pcore.rb +103 -0
- data/lib/puppet/pops/puppet_stack.rb +43 -0
- data/lib/puppet/pops/resource/param.rb +55 -0
- data/lib/puppet/pops/resource/resource_type_impl.rb +314 -0
- data/lib/puppet/pops/resource/resource_type_set.pcore +22 -0
- data/lib/puppet/pops/semantic_error.rb +12 -0
- data/lib/puppet/pops/serialization/abstract_reader.rb +176 -0
- data/lib/puppet/pops/serialization/abstract_writer.rb +215 -0
- data/lib/puppet/pops/serialization/deserializer.rb +80 -0
- data/lib/puppet/pops/serialization/extension.rb +157 -0
- data/lib/puppet/pops/serialization/from_data_converter.rb +181 -0
- data/lib/puppet/pops/serialization/instance_reader.rb +19 -0
- data/lib/puppet/pops/serialization/instance_writer.rb +14 -0
- data/lib/puppet/pops/serialization/json.rb +297 -0
- data/lib/puppet/pops/serialization/json_path.rb +126 -0
- data/lib/puppet/pops/serialization/object.rb +71 -0
- data/lib/puppet/pops/serialization/serializer.rb +139 -0
- data/lib/puppet/pops/serialization/time_factory.rb +67 -0
- data/lib/puppet/pops/serialization/to_data_converter.rb +292 -0
- data/lib/puppet/pops/serialization.rb +41 -0
- data/lib/puppet/pops/time/timespan.rb +718 -0
- data/lib/puppet/pops/time/timestamp.rb +148 -0
- data/lib/puppet/pops/types/annotatable.rb +36 -0
- data/lib/puppet/pops/types/annotation.rb +71 -0
- data/lib/puppet/pops/types/class_loader.rb +29 -29
- data/lib/puppet/pops/types/enumeration.rb +9 -27
- data/lib/puppet/pops/types/implementation_registry.rb +141 -0
- data/lib/puppet/pops/types/iterable.rb +308 -0
- data/lib/puppet/pops/types/p_binary_type.rb +226 -0
- data/lib/puppet/pops/types/p_meta_type.rb +87 -0
- data/lib/puppet/pops/types/p_object_type.rb +925 -0
- data/lib/puppet/pops/types/p_runtime_type.rb +115 -0
- data/lib/puppet/pops/types/p_sem_ver_range_type.rb +191 -0
- data/lib/puppet/pops/types/p_sem_ver_type.rb +141 -0
- data/lib/puppet/pops/types/p_sensitive_type.rb +73 -0
- data/lib/puppet/pops/types/p_timespan_type.rb +192 -0
- data/lib/puppet/pops/types/p_timestamp_type.rb +69 -0
- data/lib/puppet/pops/types/p_type_set_type.rb +360 -0
- data/lib/puppet/pops/types/puppet_object.rb +26 -0
- data/lib/puppet/pops/types/recursion_guard.rb +136 -0
- data/lib/puppet/pops/types/ruby_generator.rb +439 -0
- data/lib/puppet/pops/types/ruby_method.rb +31 -0
- data/lib/puppet/pops/types/string_converter.rb +1099 -0
- data/lib/puppet/pops/types/type_acceptor.rb +25 -0
- data/lib/puppet/pops/types/type_asserter.rb +21 -19
- data/lib/puppet/pops/types/type_assertion_error.rb +1 -0
- data/lib/puppet/pops/types/type_calculator.rb +251 -1332
- data/lib/puppet/pops/types/type_conversion_error.rb +15 -0
- data/lib/puppet/pops/types/type_factory.rb +252 -171
- data/lib/puppet/pops/types/type_formatter.rb +734 -0
- data/lib/puppet/pops/types/type_mismatch_describer.rb +1106 -0
- data/lib/puppet/pops/types/type_parser.rb +374 -276
- data/lib/puppet/pops/types/type_set_reference.rb +59 -0
- data/lib/puppet/pops/types/types.rb +3286 -307
- data/lib/puppet/pops/utils.rb +7 -30
- data/lib/puppet/pops/validation/checker4_0.rb +305 -109
- data/lib/puppet/pops/validation/validator_factory_4_0.rb +13 -5
- data/lib/puppet/pops/validation.rb +25 -16
- data/lib/puppet/pops/visitor.rb +30 -6
- data/lib/puppet/pops.rb +42 -57
- data/lib/puppet/property/ensure.rb +4 -4
- data/lib/puppet/property/list.rb +1 -10
- data/lib/puppet/property.rb +84 -21
- data/lib/puppet/provider/aixobject.rb +11 -11
- data/lib/puppet/provider/augeas/augeas.rb +89 -34
- data/lib/puppet/provider/command.rb +1 -1
- data/lib/puppet/provider/cron/crontab.rb +3 -3
- data/lib/puppet/provider/exec/posix.rb +4 -4
- data/lib/puppet/provider/exec/windows.rb +4 -4
- data/lib/puppet/provider/exec.rb +14 -7
- data/lib/puppet/provider/file/posix.rb +5 -5
- data/lib/puppet/provider/file/windows.rb +4 -4
- data/lib/puppet/provider/group/aix.rb +6 -6
- data/lib/puppet/provider/group/directoryservice.rb +10 -0
- data/lib/puppet/provider/group/groupadd.rb +2 -2
- data/lib/puppet/provider/group/pw.rb +2 -1
- data/lib/puppet/provider/group/windows_adsi.rb +15 -3
- data/lib/puppet/provider/host/parsed.rb +1 -1
- data/lib/puppet/provider/macauthorization/macauthorization.rb +20 -19
- data/lib/puppet/provider/mailalias/aliases.rb +1 -1
- data/lib/puppet/provider/maillist/mailman.rb +2 -2
- data/lib/puppet/provider/mcx/mcxcontent.rb +6 -5
- data/lib/puppet/provider/mount/parsed.rb +24 -8
- data/lib/puppet/provider/mount.rb +2 -1
- data/lib/puppet/provider/naginator.rb +1 -1
- data/lib/puppet/provider/nameservice/directoryservice.rb +65 -72
- data/lib/puppet/provider/nameservice.rb +40 -17
- data/lib/puppet/provider/network_device.rb +2 -1
- data/lib/puppet/provider/package/aix.rb +5 -5
- data/lib/puppet/provider/package/appdmg.rb +7 -6
- data/lib/puppet/provider/package/apple.rb +2 -2
- data/lib/puppet/provider/package/apt.rb +4 -4
- data/lib/puppet/provider/package/aptitude.rb +1 -1
- data/lib/puppet/provider/package/aptrpm.rb +2 -2
- data/lib/puppet/provider/package/blastwave.rb +4 -4
- data/lib/puppet/provider/package/dnf.rb +46 -0
- data/lib/puppet/provider/package/dpkg.rb +3 -3
- data/lib/puppet/provider/package/fink.rb +3 -3
- data/lib/puppet/provider/package/freebsd.rb +1 -1
- data/lib/puppet/provider/package/gem.rb +35 -9
- data/lib/puppet/provider/package/hpux.rb +1 -1
- data/lib/puppet/provider/package/nim.rb +17 -14
- data/lib/puppet/provider/package/openbsd.rb +11 -11
- data/lib/puppet/provider/package/opkg.rb +1 -1
- data/lib/puppet/provider/package/pacman.rb +20 -19
- data/lib/puppet/provider/package/pip.rb +72 -20
- data/lib/puppet/provider/package/pip3.rb +20 -0
- data/lib/puppet/provider/package/pkg.rb +21 -17
- data/lib/puppet/provider/package/pkgdmg.rb +12 -9
- data/lib/puppet/provider/package/pkgin.rb +6 -6
- data/lib/puppet/provider/package/pkgng.rb +16 -7
- data/lib/puppet/provider/package/pkgutil.rb +7 -7
- data/lib/puppet/provider/package/portage.rb +183 -35
- data/lib/puppet/provider/package/ports.rb +3 -3
- data/lib/puppet/provider/package/portupgrade.rb +4 -4
- data/lib/puppet/provider/package/puppet_gem.rb +0 -0
- data/lib/puppet/provider/package/rpm.rb +130 -21
- data/lib/puppet/provider/package/rug.rb +1 -1
- data/lib/puppet/provider/package/sun.rb +4 -3
- data/lib/puppet/provider/package/tdnf.rb +28 -0
- data/lib/puppet/provider/package/up2date.rb +1 -1
- data/lib/puppet/provider/package/urpmi.rb +1 -1
- 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 +12 -4
- data/lib/puppet/provider/package/windows.rb +5 -5
- data/lib/puppet/provider/package/yum.rb +73 -94
- data/lib/puppet/provider/package/zypper.rb +20 -1
- data/lib/puppet/provider/package.rb +6 -2
- data/lib/puppet/provider/parsedfile.rb +3 -3
- data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +7 -0
- data/lib/puppet/provider/selmodule/semodule.rb +20 -16
- data/lib/puppet/provider/service/base.rb +4 -3
- data/lib/puppet/provider/service/bsd.rb +9 -9
- data/lib/puppet/provider/service/daemontools.rb +5 -5
- data/lib/puppet/provider/service/debian.rb +14 -5
- data/lib/puppet/provider/service/freebsd.rb +1 -1
- data/lib/puppet/provider/service/init.rb +20 -3
- data/lib/puppet/provider/service/launchd.rb +57 -19
- data/lib/puppet/provider/service/rcng.rb +51 -0
- data/lib/puppet/provider/service/redhat.rb +2 -1
- data/lib/puppet/provider/service/runit.rb +4 -4
- data/lib/puppet/provider/service/smf.rb +59 -8
- data/lib/puppet/provider/service/src.rb +66 -39
- data/lib/puppet/provider/service/systemd.rb +141 -22
- data/lib/puppet/provider/service/upstart.rb +1 -3
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +1 -1
- data/lib/puppet/provider/sshkey/parsed.rb +20 -10
- data/lib/puppet/provider/user/aix.rb +12 -6
- data/lib/puppet/provider/user/directoryservice.rb +43 -66
- data/lib/puppet/provider/user/hpux.rb +1 -1
- data/lib/puppet/provider/user/ldap.rb +1 -1
- data/lib/puppet/provider/user/pw.rb +1 -0
- data/lib/puppet/provider/user/user_role_add.rb +19 -2
- data/lib/puppet/provider/user/useradd.rb +1 -1
- data/lib/puppet/provider/user/windows_adsi.rb +11 -5
- data/lib/puppet/provider/yumrepo/inifile.rb +12 -9
- data/lib/puppet/provider/zfs/zfs.rb +2 -2
- data/lib/puppet/provider/zone/solaris.rb +6 -3
- data/lib/puppet/provider/zpool/zpool.rb +2 -2
- data/lib/puppet/provider.rb +11 -7
- data/lib/puppet/reference/configuration.rb +13 -5
- data/lib/puppet/reference/indirection.rb +2 -2
- data/lib/puppet/reference/metaparameter.rb +1 -1
- data/lib/puppet/reference/providers.rb +8 -9
- data/lib/puppet/reference/report.rb +9 -12
- data/lib/puppet/reference/type.rb +3 -3
- data/lib/puppet/relationship.rb +7 -9
- data/lib/puppet/reports/http.rb +6 -2
- data/lib/puppet/reports.rb +5 -1
- data/lib/puppet/resource/capability_finder.rb +128 -0
- data/lib/puppet/resource/catalog.rb +163 -47
- data/lib/puppet/resource/status.rb +34 -20
- data/lib/puppet/resource/type.rb +246 -97
- data/lib/puppet/resource/type_collection.rb +97 -17
- data/lib/puppet/resource.rb +241 -198
- data/lib/puppet/settings/array_setting.rb +1 -1
- data/lib/puppet/settings/autosign_setting.rb +1 -1
- data/lib/puppet/settings/base_setting.rb +9 -3
- data/lib/puppet/settings/boolean_setting.rb +1 -1
- data/lib/puppet/settings/config_file.rb +4 -3
- data/lib/puppet/settings/directory_setting.rb +6 -0
- data/lib/puppet/settings/duration_setting.rb +1 -1
- data/lib/puppet/settings/enum_setting.rb +1 -1
- data/lib/puppet/settings/environment_conf.rb +28 -8
- data/lib/puppet/settings/file_or_directory_setting.rb +6 -0
- data/lib/puppet/settings/file_setting.rb +22 -11
- data/lib/puppet/settings/ini_file.rb +2 -2
- data/lib/puppet/settings/priority_setting.rb +1 -1
- data/lib/puppet/settings/server_list_setting.rb +20 -0
- data/lib/puppet/settings/symbolic_enum_setting.rb +17 -0
- data/lib/puppet/settings/terminus_setting.rb +1 -1
- data/lib/puppet/settings/ttl_setting.rb +2 -2
- data/lib/puppet/settings.rb +99 -46
- data/lib/puppet/ssl/base.rb +16 -3
- data/lib/puppet/ssl/certificate.rb +1 -1
- data/lib/puppet/ssl/certificate_authority/interface.rb +172 -32
- data/lib/puppet/ssl/certificate_authority.rb +67 -31
- data/lib/puppet/ssl/certificate_factory.rb +5 -5
- data/lib/puppet/ssl/certificate_request.rb +19 -19
- data/lib/puppet/ssl/certificate_request_attributes.rb +3 -3
- data/lib/puppet/ssl/certificate_revocation_list.rb +3 -3
- data/lib/puppet/ssl/certificate_signer.rb +1 -1
- data/lib/puppet/ssl/configuration.rb +4 -1
- data/lib/puppet/ssl/host.rb +47 -25
- data/lib/puppet/ssl/inventory.rb +11 -4
- data/lib/puppet/ssl/key.rb +8 -4
- data/lib/puppet/ssl/oids.rb +48 -8
- data/lib/puppet/ssl/validator/default_validator.rb +6 -7
- data/lib/puppet/syntax_checkers/base64.rb +41 -0
- data/lib/puppet/syntax_checkers/json.rb +5 -7
- data/lib/puppet/test/test_helper.rb +21 -11
- data/lib/puppet/transaction/additional_resource_generator.rb +105 -11
- data/lib/puppet/transaction/event.rb +45 -7
- data/lib/puppet/transaction/event_manager.rb +7 -7
- data/lib/puppet/transaction/persistence.rb +84 -0
- data/lib/puppet/transaction/report.rb +113 -37
- data/lib/puppet/transaction/resource_harness.rb +99 -37
- data/lib/puppet/transaction.rb +100 -54
- data/lib/puppet/type/augeas.rb +15 -6
- data/lib/puppet/type/component.rb +11 -0
- data/lib/puppet/type/cron.rb +27 -44
- data/lib/puppet/type/exec.rb +82 -52
- data/lib/puppet/type/file/checksum.rb +1 -0
- data/lib/puppet/type/file/checksum_value.rb +53 -0
- data/lib/puppet/type/file/content.rb +37 -122
- data/lib/puppet/type/file/data_sync.rb +92 -0
- data/lib/puppet/type/file/ensure.rb +21 -18
- data/lib/puppet/type/file/group.rb +3 -3
- data/lib/puppet/type/file/mode.rb +10 -6
- data/lib/puppet/type/file/owner.rb +3 -3
- data/lib/puppet/type/file/selcontext.rb +19 -2
- data/lib/puppet/type/file/source.rb +134 -37
- data/lib/puppet/type/file/target.rb +2 -2
- data/lib/puppet/type/file.rb +159 -61
- data/lib/puppet/type/filebucket.rb +3 -8
- data/lib/puppet/type/group.rb +28 -10
- data/lib/puppet/type/host.rb +7 -7
- data/lib/puppet/type/interface.rb +9 -4
- data/lib/puppet/type/k5login.rb +1 -1
- data/lib/puppet/type/macauthorization.rb +2 -2
- data/lib/puppet/type/mailalias.rb +2 -18
- data/lib/puppet/type/maillist.rb +1 -1
- data/lib/puppet/type/mount.rb +22 -7
- data/lib/puppet/type/notify.rb +3 -1
- data/lib/puppet/type/package.rb +37 -17
- data/lib/puppet/type/resources.rb +7 -7
- data/lib/puppet/type/schedule.rb +14 -14
- data/lib/puppet/type/scheduled_task.rb +5 -5
- data/lib/puppet/type/service.rb +25 -1
- data/lib/puppet/type/ssh_authorized_key.rb +20 -30
- data/lib/puppet/type/sshkey.rb +9 -7
- data/lib/puppet/type/stage.rb +1 -1
- data/lib/puppet/type/tidy.rb +22 -15
- data/lib/puppet/type/user.rb +80 -53
- data/lib/puppet/type/yumrepo.rb +31 -11
- data/lib/puppet/type/zone.rb +13 -13
- data/lib/puppet/type/zpool.rb +3 -3
- data/lib/puppet/type.rb +175 -47
- data/lib/puppet/util/at_fork/noop.rb +18 -0
- data/lib/puppet/util/at_fork/solaris.rb +158 -0
- data/lib/puppet/util/at_fork.rb +35 -0
- data/lib/puppet/util/autoload.rb +18 -13
- data/lib/puppet/util/backups.rb +6 -6
- data/lib/puppet/util/character_encoding.rb +98 -0
- data/lib/puppet/util/checksums.rb +74 -31
- data/lib/puppet/util/classgen.rb +5 -5
- data/lib/puppet/util/command_line/puppet_option_parser.rb +3 -3
- data/lib/puppet/util/command_line/trollop.rb +32 -32
- data/lib/puppet/util/command_line.rb +14 -6
- data/lib/puppet/util/diff.rb +1 -1
- data/lib/puppet/util/errors.rb +4 -4
- data/lib/puppet/util/execution.rb +42 -23
- data/lib/puppet/util/feature.rb +5 -5
- data/lib/puppet/util/fileparsing.rb +8 -8
- data/lib/puppet/util/filetype.rb +26 -20
- data/lib/puppet/util/http_proxy.rb +132 -0
- data/lib/puppet/util/inifile.rb +5 -5
- data/lib/puppet/util/instance_loader.rb +2 -2
- data/lib/puppet/util/json_lockfile.rb +4 -4
- data/lib/puppet/util/ldap/connection.rb +2 -2
- data/lib/puppet/util/ldap/manager.rb +2 -2
- data/lib/puppet/util/limits.rb +1 -1
- data/lib/puppet/util/log/destinations.rb +10 -16
- data/lib/puppet/util/log.rb +51 -17
- data/lib/puppet/util/logging.rb +53 -7
- data/lib/puppet/util/metric.rb +9 -6
- data/lib/puppet/util/monkey_patches.rb +41 -65
- data/lib/puppet/util/multi_match.rb +51 -0
- data/lib/puppet/util/network_device/cisco/device.rb +29 -11
- data/lib/puppet/util/network_device/cisco/interface.rb +21 -9
- data/lib/puppet/util/network_device/config.rb +7 -7
- data/lib/puppet/util/network_device/transport/ssh.rb +13 -9
- data/lib/puppet/util/network_device/transport/telnet.rb +39 -36
- data/lib/puppet/util/network_device.rb +1 -1
- data/lib/puppet/util/plist.rb +153 -0
- data/lib/puppet/util/posix.rb +5 -5
- data/lib/puppet/util/profiler/aggregate.rb +1 -1
- data/lib/puppet/util/profiler/around_profiler.rb +1 -1
- data/lib/puppet/util/profiler/wall_clock.rb +1 -1
- data/lib/puppet/util/profiler.rb +1 -1
- data/lib/puppet/util/provider_features.rb +1 -1
- data/lib/puppet/util/psych_support.rb +4 -12
- data/lib/puppet/util/rdoc/generators/puppet_generator.rb +3 -3
- data/lib/puppet/util/rdoc/parser/puppet_parser_core.rb +2 -1
- data/lib/puppet/util/rdoc.rb +6 -6
- data/lib/puppet/util/reference.rb +9 -7
- data/lib/puppet/util/resource_template.rb +2 -2
- data/lib/puppet/util/retry_action.rb +2 -2
- data/lib/puppet/util/rubygems.rb +1 -1
- data/lib/puppet/util/run_mode.rb +2 -2
- data/lib/puppet/util/selinux.rb +54 -12
- data/lib/puppet/util/skip_tags.rb +9 -0
- data/lib/puppet/util/splayer.rb +18 -0
- data/lib/puppet/util/storage.rb +5 -5
- data/lib/puppet/util/suidmanager.rb +4 -4
- data/lib/puppet/util/symbolic_file_mode.rb +9 -9
- data/lib/puppet/util/tag_set.rb +1 -4
- data/lib/puppet/util/tagging.rb +9 -3
- data/lib/puppet/util/watcher/periodic_watcher.rb +2 -2
- data/lib/puppet/util/windows/access_control_entry.rb +2 -2
- data/lib/puppet/util/windows/access_control_list.rb +3 -3
- data/lib/puppet/util/windows/adsi.rb +110 -45
- data/lib/puppet/util/windows/api_types.rb +28 -19
- data/lib/puppet/util/windows/com.rb +7 -7
- data/lib/puppet/util/windows/error.rb +3 -3
- data/lib/puppet/util/windows/eventlog.rb +192 -0
- data/lib/puppet/util/windows/file.rb +115 -22
- data/lib/puppet/util/windows/principal.rb +191 -0
- data/lib/puppet/util/windows/process.rb +90 -13
- data/lib/puppet/util/windows/registry.rb +31 -25
- data/lib/puppet/util/windows/root_certs.rb +6 -6
- data/lib/puppet/util/windows/security.rb +52 -51
- data/lib/puppet/util/windows/security_descriptor.rb +1 -1
- data/lib/puppet/util/windows/sid.rb +89 -20
- data/lib/puppet/util/windows/taskscheduler.rb +154 -98
- data/lib/puppet/util/windows/user.rb +38 -20
- data/lib/puppet/util/windows.rb +7 -0
- data/lib/puppet/util/yaml.rb +15 -3
- data/lib/puppet/util.rb +259 -33
- data/lib/puppet/vendor/deep_merge/deep_merge.gemspec +1 -1
- data/lib/puppet/vendor/deep_merge/test/test_deep_merge.rb +1 -1
- data/lib/puppet/vendor/load_semantic_puppet.rb +1 -0
- data/lib/puppet/vendor/pathspec/LICENSE +2 -2
- data/lib/puppet/vendor/pathspec/README.md +1 -1
- data/lib/puppet/vendor/pathspec/lib/pathspec.rb +2 -1
- data/lib/puppet/vendor/require_vendored.rb +0 -1
- data/lib/puppet/vendor/semantic/lib/semantic.rb +4 -6
- data/lib/puppet/vendor/{semantic/lib/semantic → semantic_puppet/lib/semantic_puppet}/dependency/graph.rb +2 -2
- data/lib/puppet/vendor/{semantic/lib/semantic → semantic_puppet/lib/semantic_puppet}/dependency/graph_node.rb +2 -2
- data/lib/puppet/vendor/{semantic/lib/semantic → semantic_puppet/lib/semantic_puppet}/dependency/module_release.rb +17 -5
- data/lib/puppet/vendor/{semantic/lib/semantic → semantic_puppet/lib/semantic_puppet}/dependency/source.rb +2 -2
- data/lib/puppet/vendor/{semantic/lib/semantic → semantic_puppet/lib/semantic_puppet}/dependency/unsatisfiable_graph.rb +2 -2
- data/lib/puppet/vendor/{semantic/lib/semantic → semantic_puppet/lib/semantic_puppet}/dependency.rb +7 -7
- data/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/gem_version.rb +3 -0
- data/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version.rb +203 -0
- data/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version_range.rb +758 -0
- data/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet.rb +9 -0
- data/lib/puppet/vendor/semantic_puppet/locales/config.yaml +21 -0
- data/lib/puppet/version.rb +7 -3
- data/lib/puppet.rb +104 -6
- data/lib/puppet_x.rb +7 -1
- data/locales/config.yaml +29 -0
- data/locales/puppet.pot +7995 -0
- data/man/man5/puppet.conf.5 +13 -35
- data/man/man8/puppet-agent.8 +2 -2
- data/man/man8/puppet-apply.8 +2 -2
- data/man/man8/puppet-ca.8 +2 -2
- data/man/man8/puppet-catalog.8 +2 -2
- data/man/man8/puppet-cert.8 +2 -2
- data/man/man8/puppet-certificate.8 +2 -2
- data/man/man8/puppet-certificate_request.8 +2 -2
- data/man/man8/puppet-certificate_revocation_list.8 +2 -2
- data/man/man8/puppet-config.8 +3 -3
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +1 -1
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +2 -2
- data/man/man8/puppet-facts.8 +2 -2
- data/man/man8/puppet-filebucket.8 +2 -2
- data/man/man8/puppet-help.8 +2 -2
- data/man/man8/puppet-inspect.8 +2 -2
- data/man/man8/puppet-key.8 +2 -2
- data/man/man8/puppet-man.8 +2 -2
- data/man/man8/puppet-master.8 +2 -2
- data/man/man8/puppet-module.8 +9 -9
- data/man/man8/puppet-node.8 +2 -2
- data/man/man8/puppet-parser.8 +2 -2
- data/man/man8/puppet-plugin.8 +2 -2
- data/man/man8/puppet-report.8 +2 -2
- data/man/man8/puppet-resource.8 +2 -2
- data/man/man8/puppet-status.8 +3 -3
- data/man/man8/puppet.8 +1 -1
- data/spec/fixtures/module.tar.gz +0 -0
- data/spec/fixtures/unit/application/environments/production/data/common.yaml +22 -0
- data/spec/fixtures/unit/application/environments/production/environment.conf +1 -0
- data/spec/fixtures/unit/application/environments/production/manifests/site.pp +1 -0
- data/spec/fixtures/unit/application/environments/puppet_func_provider/environment.conf +1 -0
- data/spec/fixtures/unit/application/environments/puppet_func_provider/functions/environment/data.pp +10 -0
- data/spec/fixtures/unit/application/environments/puppet_func_provider/manifests/site.pp +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/{sample → hiera_bad_syntax_json}/environment.conf +1 -1
- 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/data1/third_utf8.json +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data1/utf8.yaml +3 -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 +22 -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 +48 -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/data/common.yaml +4 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/data/specific.yaml +4 -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/hiera.yaml +7 -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 +2 -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/server1.yaml +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data1/server2.yaml +1 -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 +20 -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/hiera_modules/data/common.yaml +4 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_modules/data/specific.yaml +4 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_modules/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_modules/hiera.yaml +7 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_modules/manifests/site.pp +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_modules/modules/one/data/common.yaml +6 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_modules/modules/one/hiera.yaml +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_modules/modules/one/manifests/init.pp +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_modules/modules/one/metadata.json +9 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_modules/modules/two/data/common.yaml +4 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_modules/modules/two/hiera.yaml +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_modules/modules/two/manifests/init.pp +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_modules/modules/two/metadata.json +9 -0
- data/spec/fixtures/unit/data_providers/environments/production/modules/abc/lib/puppet/functions/abc/data.rb +2 -1
- data/spec/fixtures/unit/data_providers/environments/production/modules/abc/manifests/init.pp +2 -1
- data/spec/fixtures/unit/data_providers/environments/production/modules/abc/metadata.json +9 -0
- data/spec/fixtures/unit/data_providers/environments/production/modules/xyz/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup/data/common.yaml +19 -0
- data/spec/fixtures/unit/functions/lookup_fixture/data/common.yaml +19 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/abc/metadata.json +9 -0
- data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/bad_data/lib/puppet/functions/bad_data/data.rb +1 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/bad_data/manifests/init.pp +2 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/bad_data/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/bca/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_json/data/empty.json +0 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_json/hiera.yaml +5 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_json/manifests/init.pp +2 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_json/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_key_json/data/empty_key.json +1 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_key_json/hiera.yaml +5 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_key_json/manifests/init.pp +2 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_key_json/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_key_yaml/data/empty_key.yaml +1 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_key_yaml/hiera.yaml +5 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_key_yaml/manifests/init.pp +2 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_key_yaml/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_yaml/data/empty.yaml +2 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_yaml/hiera.yaml +5 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_yaml/manifests/init.pp +2 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/empty_yaml/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/hieraprovider/data/first.json +4 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/hieraprovider/hiera.yaml +8 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/hieraprovider/manifests/init.pp +5 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/hieraprovider/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/meta/lib/puppet/functions/meta/data.rb +9 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/meta/manifests/init.pp +3 -0
- data/spec/fixtures/unit/functions/lookup_fixture/environments/production/modules/meta/metadata.json +9 -0
- data/spec/fixtures/unit/module/trailing-comma.json +1 -1
- data/spec/fixtures/unit/parser/lexer/subclass_name_duplication.pp +0 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/usee/functions/usee_puppet.pp +3 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/usee/lib/puppet/functions/usee/usee_ruby.rb +6 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/usee/lib/puppet/type/usee_type.rb +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/usee/manifests/init.pp +8 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/usee/types/zero.pp +1 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/usee2/lib/puppet/functions/usee2/callee.rb +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/functions/puppet_calling_puppet.pp +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/functions/puppet_calling_puppet_init.pp +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/functions/puppet_calling_ruby.pp +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/lib/puppet/functions/user/caller2.rb +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/lib/puppet/functions/user/ruby_calling_puppet.rb +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/lib/puppet/functions/user/ruby_calling_puppet_init.rb +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/lib/puppet/functions/user/ruby_calling_ruby.rb +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/manifests/init.pp +87 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/{user → modules/user}/metadata.json +2 -1
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/types/withuseeone.pp +1 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/types/withuseezero.pp +1 -0
- data/spec/fixtures/unit/pops/loaders/loaders/no_modules/manifests/site.pp +10 -0
- data/spec/fixtures/unit/pops/parser/lexer/subclass_name_duplication.pp +0 -0
- data/spec/fixtures/unit/provider/package/yum/yum-check-update-broken-notices.txt +187 -0
- data/spec/fixtures/unit/provider/package/yum/yum-check-update-obsoletes.txt +195 -0
- data/spec/fixtures/unit/provider/package/yum/yum-check-update-security.txt +184 -0
- data/spec/fixtures/unit/provider/service/smf/svcs.out +4 -3
- data/spec/fixtures/unit/provider/sshkey/parsed/sample_with_blank_lines +8 -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/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_fetch_if_not_on_the_local_disk.yml +205 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_not_update_if_content_on_disk_is_up-to-date.yml +213 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_update_if_content_differs_on_disk.yml +213 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_mtime_is_older_on_disk.yml +205 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_no_header_specified.yml +197 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_not_on_the_local_disk.yml +205 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_not_update_if_mtime_is_newer_on_disk.yml +205 -0
- data/spec/integration/agent/logging_spec.rb +15 -14
- data/spec/integration/application/apply_spec.rb +395 -34
- data/spec/integration/application/doc_spec.rb +0 -0
- data/spec/integration/application/lookup_spec.rb +155 -0
- data/spec/integration/configurer_spec.rb +1 -1
- data/spec/integration/data_binding_spec.rb +195 -0
- data/spec/integration/defaults_spec.rb +29 -4
- data/spec/integration/directory_environments_spec.rb +16 -0
- data/spec/integration/environments/default_manifest_spec.rb +16 -16
- data/spec/integration/environments/setting_hooks_spec.rb +1 -1
- data/spec/integration/environments/settings_spec.rb +32 -4
- data/spec/integration/faces/ca_spec.rb +0 -0
- data/spec/integration/faces/config_spec.rb +80 -0
- data/spec/integration/faces/documentation_spec.rb +2 -2
- data/spec/integration/file_bucket/file_spec.rb +2 -2
- data/spec/integration/file_serving/fileset_spec.rb +0 -0
- data/spec/integration/file_serving/terminus_helper_spec.rb +0 -0
- data/spec/integration/file_system/uniquefile_spec.rb +29 -0
- data/spec/integration/indirector/catalog/compiler_spec.rb +0 -0
- data/spec/integration/indirector/direct_file_server_spec.rb +0 -0
- data/spec/integration/indirector/facts/facter_spec.rb +38 -0
- data/spec/integration/indirector/file_content/file_server_spec.rb +1 -0
- data/spec/integration/indirector/file_metadata/file_server_spec.rb +1 -0
- data/spec/integration/indirector/node/ldap_spec.rb +0 -0
- data/spec/integration/module_tool/tar/mini_spec.rb +28 -0
- data/spec/integration/network/formats_spec.rb +0 -0
- data/spec/integration/network/http/api/indirected_routes_spec.rb +33 -0
- data/spec/integration/node/environment_spec.rb +34 -0
- data/spec/integration/node/facts_spec.rb +0 -0
- data/spec/integration/node_spec.rb +0 -0
- data/spec/integration/parser/catalog_spec.rb +15 -3
- data/spec/integration/parser/class_spec.rb +6 -6
- data/spec/integration/parser/collection_spec.rb +18 -0
- data/spec/integration/parser/compiler_spec.rb +323 -920
- data/spec/integration/parser/dynamic_scoping_spec.rb +66 -0
- data/spec/integration/parser/parameter_defaults_spec.rb +358 -0
- data/spec/integration/parser/pcore_resource_spec.rb +260 -0
- data/spec/integration/parser/resource_expressions_spec.rb +9 -7
- data/spec/integration/parser/scope_spec.rb +73 -6
- data/spec/integration/parser/undef_param_spec.rb +9 -1
- data/spec/integration/provider/mailalias/aliases_spec.rb +0 -0
- data/spec/integration/provider/mount_spec.rb +23 -36
- data/spec/integration/provider/service/init_spec.rb +0 -0
- data/spec/integration/provider/service/windows_spec.rb +3 -2
- data/spec/integration/provider/ssh_authorized_key_spec.rb +0 -0
- data/spec/integration/provider/yumrepo_spec.rb +4 -1
- data/spec/integration/reference/providers_spec.rb +0 -0
- data/spec/integration/reports_spec.rb +0 -0
- data/spec/integration/resource/catalog_spec.rb +1 -5
- data/spec/integration/resource/type_collection_spec.rb +14 -0
- data/spec/integration/ssl/autosign_spec.rb +18 -3
- data/spec/integration/ssl/certificate_authority_spec.rb +0 -1
- data/spec/integration/ssl/certificate_request_spec.rb +0 -1
- data/spec/integration/ssl/certificate_revocation_list_spec.rb +0 -1
- data/spec/integration/ssl/host_spec.rb +0 -1
- data/spec/integration/ssl/key_spec.rb +104 -0
- data/spec/integration/test/test_helper_spec.rb +32 -0
- data/spec/integration/transaction/report_spec.rb +683 -1
- data/spec/integration/transaction_spec.rb +127 -3
- data/spec/integration/type/exec_spec.rb +0 -0
- data/spec/integration/type/file_spec.rb +266 -12
- data/spec/integration/type/package_spec.rb +79 -2
- data/spec/integration/type/tidy_spec.rb +21 -9
- data/spec/integration/type/user_spec.rb +13 -6
- data/spec/integration/type_spec.rb +0 -0
- data/spec/integration/util/autoload_spec.rb +0 -0
- data/spec/integration/util/execution_spec.rb +30 -0
- data/spec/integration/util/rdoc/parser_spec.rb +1 -1
- data/spec/integration/util/settings_spec.rb +26 -0
- data/spec/integration/util/windows/adsi_spec.rb +99 -0
- data/spec/integration/util/windows/principal_spec.rb +250 -0
- data/spec/integration/util/windows/process_spec.rb +35 -2
- data/spec/{unit → integration}/util/windows/registry_spec.rb +92 -2
- data/spec/integration/util/windows/security_spec.rb +61 -16
- data/spec/integration/util/windows/user_spec.rb +27 -5
- data/spec/integration/util_spec.rb +49 -27
- data/spec/lib/matchers/include_in_order.rb +2 -3
- data/spec/lib/matchers/json.rb +3 -3
- data/spec/lib/puppet/face/1.0.0/huzzah.rb +1 -1
- data/spec/lib/puppet/face/basetest.rb +1 -1
- data/spec/lib/puppet/face/huzzah.rb +1 -1
- data/spec/lib/puppet/face/version_matching.rb +1 -1
- data/spec/lib/puppet/indirector_testing.rb +4 -0
- data/spec/lib/puppet_spec/character_encoding.rb +12 -0
- data/spec/lib/puppet_spec/compiler.rb +40 -4
- data/spec/lib/puppet_spec/files.rb +16 -2
- data/spec/lib/puppet_spec/fixtures.rb +0 -0
- data/spec/lib/puppet_spec/language.rb +3 -1
- data/spec/lib/puppet_spec/module_tool/shared_functions.rb +2 -2
- data/spec/lib/puppet_spec/module_tool/stub_source.rb +1 -1
- data/spec/lib/puppet_spec/modules.rb +2 -2
- data/spec/lib/puppet_spec/network.rb +22 -14
- data/spec/lib/puppet_spec/pops.rb +13 -0
- data/spec/lib/puppet_spec/unindent.rb +5 -0
- data/spec/lib/puppet_spec/verbose.rb +0 -0
- data/spec/shared_behaviours/all_parsedfile_providers.rb +0 -0
- data/spec/shared_behaviours/file_server_terminus.rb +0 -0
- data/spec/shared_behaviours/file_serving.rb +0 -0
- data/spec/shared_behaviours/iterative_functions.rb +9 -9
- data/spec/shared_behaviours/memory_terminus.rb +0 -0
- data/spec/shared_behaviours/path_parameters.rb +0 -0
- data/spec/shared_behaviours/things_that_declare_options.rb +0 -0
- data/spec/shared_contexts/types_setup.rb +143 -0
- data/spec/shared_examples/rhel_package_provider.rb +356 -0
- data/spec/spec_helper.rb +23 -13
- data/spec/unit/agent/locker_spec.rb +4 -4
- data/spec/unit/agent_spec.rb +23 -46
- data/spec/unit/application/agent_spec.rb +22 -0
- data/spec/unit/application/apply_spec.rb +59 -14
- data/spec/unit/application/cert_spec.rb +20 -0
- data/spec/unit/application/certificate_spec.rb +0 -0
- data/spec/unit/application/config_spec.rb +0 -0
- data/spec/unit/application/describe_spec.rb +19 -0
- data/spec/unit/application/device_spec.rb +41 -2
- data/spec/unit/application/doc_spec.rb +0 -0
- data/spec/unit/application/face_base_spec.rb +22 -6
- data/spec/unit/application/facts_spec.rb +0 -0
- data/spec/unit/application/filebucket_spec.rb +88 -2
- data/spec/unit/application/indirection_base_spec.rb +0 -0
- data/spec/unit/application/lookup_spec.rb +532 -0
- data/spec/unit/application/master_spec.rb +24 -8
- data/spec/unit/application/resource_spec.rb +39 -1
- data/spec/unit/application_spec.rb +3 -9
- data/spec/unit/capability_spec.rb +412 -0
- data/spec/unit/configurer/downloader_factory_spec.rb +0 -0
- data/spec/unit/configurer/downloader_spec.rb +5 -5
- data/spec/unit/configurer/fact_handler_spec.rb +76 -20
- data/spec/unit/configurer/plugin_handler_spec.rb +5 -8
- data/spec/unit/configurer_spec.rb +372 -58
- data/spec/unit/confine/exists_spec.rb +0 -0
- data/spec/unit/confine/false_spec.rb +0 -0
- data/spec/unit/confine/feature_spec.rb +0 -0
- data/spec/unit/confine/true_spec.rb +0 -0
- data/spec/unit/confine/variable_spec.rb +0 -0
- data/spec/unit/confine_collection_spec.rb +0 -0
- data/spec/unit/confine_spec.rb +0 -0
- data/spec/unit/confiner_spec.rb +0 -0
- data/spec/unit/context/trusted_information_spec.rb +24 -1
- data/spec/unit/daemon_spec.rb +18 -8
- data/spec/unit/data_providers/function_data_provider_spec.rb +21 -3
- data/spec/unit/data_providers/hiera_data_provider_spec.rb +361 -0
- data/spec/unit/defaults_spec.rb +34 -17
- data/spec/unit/environments_spec.rb +26 -4
- data/spec/unit/etc_spec.rb +442 -0
- data/spec/unit/external/pson_spec.rb +0 -0
- data/spec/unit/face/ca_spec.rb +10 -0
- data/spec/unit/face/catalog_spec.rb +0 -0
- data/spec/unit/face/certificate_request_spec.rb +10 -0
- data/spec/unit/face/certificate_revocation_list_spec.rb +10 -0
- data/spec/unit/face/certificate_spec.rb +10 -2
- data/spec/unit/face/config_spec.rb +47 -0
- data/spec/unit/face/epp_face_spec.rb +24 -5
- data/spec/unit/face/facts_spec.rb +0 -0
- data/spec/unit/face/generate_spec.rb +230 -0
- data/spec/unit/face/help_spec.rb +70 -0
- data/spec/unit/face/key_spec.rb +10 -0
- data/spec/unit/face/module/list_spec.rb +60 -0
- data/spec/unit/face/module/search_spec.rb +1 -1
- data/spec/unit/face/node_spec.rb +1 -1
- data/spec/unit/face/parser_spec.rb +49 -2
- data/spec/unit/face/plugin_spec.rb +29 -4
- data/spec/unit/face/status_spec.rb +10 -0
- data/spec/unit/face_spec.rb +0 -0
- data/spec/unit/file_bucket/dipper_spec.rb +210 -1
- data/spec/unit/file_bucket/file_spec.rb +3 -3
- data/spec/unit/file_serving/base_spec.rb +0 -0
- data/spec/unit/file_serving/configuration/parser_spec.rb +25 -30
- data/spec/unit/file_serving/configuration_spec.rb +1 -1
- data/spec/unit/file_serving/content_spec.rb +0 -0
- data/spec/unit/file_serving/fileset_spec.rb +0 -0
- data/spec/unit/file_serving/http_metadata_spec.rb +85 -0
- data/spec/unit/file_serving/metadata_spec.rb +84 -8
- data/spec/unit/file_serving/mount/file_spec.rb +0 -0
- data/spec/unit/file_serving/mount/modules_spec.rb +0 -0
- data/spec/unit/file_serving/mount/pluginfacts_spec.rb +0 -0
- data/spec/unit/file_serving/mount/plugins_spec.rb +0 -0
- data/spec/unit/file_serving/mount_spec.rb +0 -0
- data/spec/unit/file_serving/terminus_helper_spec.rb +0 -0
- data/spec/unit/file_serving/terminus_selector_spec.rb +12 -2
- data/spec/unit/file_system/uniquefile_spec.rb +20 -0
- data/spec/unit/file_system_spec.rb +335 -6
- data/spec/unit/forge/forge_spec.rb +112 -0
- data/spec/unit/forge/repository_spec.rb +31 -4
- data/spec/unit/functions/annotate_spec.rb +175 -0
- data/spec/unit/functions/assert_type_spec.rb +48 -8
- data/spec/unit/functions/binary_file_spec.rb +46 -0
- data/spec/unit/functions/break_spec.rb +117 -0
- data/spec/unit/functions/call_spec.rb +77 -0
- data/spec/unit/{parser/functions → functions}/contain_spec.rb +69 -4
- data/spec/unit/functions/defined_spec.rb +2 -2
- data/spec/unit/functions/dig_spec.rb +58 -0
- data/spec/unit/functions/epp_spec.rb +17 -9
- data/spec/unit/functions/filter_spec.rb +18 -0
- data/spec/unit/functions/find_file_spec.rb +69 -0
- data/spec/unit/functions/hiera_spec.rb +447 -47
- data/spec/unit/functions/include_spec.rb +175 -0
- data/spec/unit/functions/inline_epp_spec.rb +4 -4
- data/spec/unit/functions/lest_spec.rb +34 -0
- data/spec/unit/functions/logging_spec.rb +54 -0
- data/spec/unit/functions/lookup_fixture_spec.rb +688 -0
- data/spec/unit/functions/lookup_spec.rb +3108 -264
- data/spec/unit/functions/match_spec.rb +2 -2
- data/spec/unit/functions/new_spec.rb +694 -0
- data/spec/unit/functions/next_spec.rb +93 -0
- data/spec/unit/functions/regsubst_spec.rb +26 -9
- data/spec/unit/functions/require_spec.rb +83 -0
- data/spec/unit/functions/return_spec.rb +105 -0
- data/spec/unit/functions/reverse_each_spec.rb +108 -0
- data/spec/unit/functions/scanf_spec.rb +1 -1
- data/spec/unit/{parser/functions → functions}/shared.rb +15 -12
- data/spec/unit/functions/split_spec.rb +3 -3
- data/spec/unit/functions/step_spec.rb +113 -0
- data/spec/unit/functions/strftime_spec.rb +152 -0
- data/spec/unit/functions/then_spec.rb +40 -0
- data/spec/unit/functions/type_spec.rb +35 -0
- data/spec/unit/functions/unique_spec.rb +111 -0
- data/spec/unit/functions/unwrap_spec.rb +29 -0
- data/spec/unit/functions/versioncmp_spec.rb +36 -0
- data/spec/unit/functions4_spec.rb +265 -115
- data/spec/unit/graph/rb_tree_map_spec.rb +1 -1
- data/spec/unit/graph/relationship_graph_spec.rb +0 -0
- data/spec/unit/graph/sequential_prioritizer_spec.rb +1 -1
- data/spec/unit/graph/simple_graph_spec.rb +59 -56
- data/spec/unit/hiera/scope_spec.rb +6 -3
- data/spec/unit/hiera_puppet_spec.rb +49 -8
- data/spec/unit/indirector/catalog/compiler_spec.rb +887 -83
- data/spec/unit/indirector/catalog/json_spec.rb +50 -1
- data/spec/unit/indirector/catalog/msgpack_spec.rb +0 -0
- data/spec/unit/indirector/catalog/rest_spec.rb +0 -0
- data/spec/unit/indirector/catalog/store_configs_spec.rb +0 -0
- data/spec/unit/indirector/catalog/yaml_spec.rb +0 -0
- data/spec/unit/indirector/certificate/ca_spec.rb +0 -0
- data/spec/unit/indirector/certificate/disabled_ca_spec.rb +0 -0
- data/spec/unit/indirector/certificate/file_spec.rb +0 -0
- data/spec/unit/indirector/certificate/rest_spec.rb +0 -0
- data/spec/unit/indirector/certificate_request/ca_spec.rb +0 -0
- data/spec/unit/indirector/certificate_request/disabled_ca_spec.rb +0 -0
- data/spec/unit/indirector/certificate_request/file_spec.rb +0 -0
- data/spec/unit/indirector/certificate_request/rest_spec.rb +0 -0
- data/spec/unit/indirector/certificate_revocation_list/ca_spec.rb +0 -0
- data/spec/unit/indirector/certificate_revocation_list/disabled_ca_spec.rb +0 -0
- data/spec/unit/indirector/certificate_revocation_list/file_spec.rb +0 -0
- data/spec/unit/indirector/certificate_revocation_list/rest_spec.rb +0 -0
- data/spec/unit/indirector/certificate_status/file_spec.rb +0 -0
- data/spec/unit/indirector/certificate_status/rest_spec.rb +0 -0
- data/spec/unit/indirector/code_spec.rb +0 -0
- data/spec/unit/indirector/data_binding/none_spec.rb +2 -2
- data/spec/unit/indirector/direct_file_server_spec.rb +0 -0
- data/spec/unit/indirector/envelope_spec.rb +0 -0
- data/spec/unit/indirector/exec_spec.rb +0 -0
- data/spec/unit/indirector/face_spec.rb +10 -2
- data/spec/unit/indirector/facts/facter_spec.rb +4 -12
- data/spec/unit/indirector/facts/network_device_spec.rb +0 -0
- data/spec/unit/indirector/facts/store_configs_spec.rb +0 -0
- data/spec/unit/indirector/facts/yaml_spec.rb +0 -0
- data/spec/unit/indirector/file_bucket_file/file_spec.rb +86 -4
- data/spec/unit/indirector/file_bucket_file/rest_spec.rb +0 -0
- data/spec/unit/indirector/file_content/file_server_spec.rb +0 -0
- data/spec/unit/indirector/file_content/file_spec.rb +0 -0
- data/spec/unit/indirector/file_content/rest_spec.rb +0 -0
- data/spec/unit/indirector/file_metadata/file_server_spec.rb +0 -0
- data/spec/unit/indirector/file_metadata/file_spec.rb +0 -0
- data/spec/unit/indirector/file_metadata/rest_spec.rb +0 -0
- data/spec/unit/indirector/file_server_spec.rb +17 -2
- data/spec/unit/indirector/indirection_spec.rb +14 -38
- data/spec/unit/indirector/json_spec.rb +27 -6
- data/spec/unit/indirector/key/ca_spec.rb +0 -0
- data/spec/unit/indirector/key/disabled_ca_spec.rb +0 -0
- data/spec/unit/indirector/key/file_spec.rb +1 -1
- data/spec/unit/indirector/ldap_spec.rb +0 -0
- data/spec/unit/indirector/memory_spec.rb +0 -0
- data/spec/unit/indirector/msgpack_spec.rb +11 -1
- data/spec/unit/indirector/node/exec_spec.rb +12 -12
- data/spec/unit/indirector/node/ldap_spec.rb +29 -8
- data/spec/unit/indirector/node/memory_spec.rb +0 -0
- data/spec/unit/indirector/node/msgpack_spec.rb +0 -0
- data/spec/unit/indirector/node/plain_spec.rb +16 -6
- data/spec/unit/indirector/node/rest_spec.rb +0 -0
- data/spec/unit/indirector/node/store_configs_spec.rb +0 -0
- data/spec/unit/indirector/node/write_only_yaml_spec.rb +12 -0
- data/spec/unit/indirector/node/yaml_spec.rb +0 -0
- data/spec/unit/indirector/plain_spec.rb +0 -0
- data/spec/unit/indirector/report/msgpack_spec.rb +0 -0
- data/spec/unit/indirector/report/processor_spec.rb +2 -2
- data/spec/unit/indirector/report/rest_spec.rb +29 -3
- data/spec/unit/indirector/report/yaml_spec.rb +0 -0
- data/spec/unit/indirector/request_spec.rb +32 -12
- data/spec/unit/indirector/resource/ral_spec.rb +0 -0
- data/spec/unit/indirector/resource/store_configs_spec.rb +0 -0
- data/spec/unit/indirector/rest_spec.rb +158 -18
- data/spec/unit/indirector/ssl_file_spec.rb +4 -4
- data/spec/unit/indirector/status/rest_spec.rb +0 -0
- data/spec/unit/indirector/store_configs_spec.rb +0 -0
- data/spec/unit/indirector/terminus_spec.rb +0 -0
- data/spec/unit/indirector/yaml_spec.rb +1 -1
- data/spec/unit/indirector_spec.rb +0 -0
- data/spec/unit/info_service_spec.rb +298 -0
- data/spec/unit/interface/action_builder_spec.rb +0 -0
- data/spec/unit/interface/action_manager_spec.rb +0 -0
- data/spec/unit/interface/action_spec.rb +0 -0
- data/spec/unit/interface/documentation_spec.rb +0 -0
- data/spec/unit/interface/face_collection_spec.rb +7 -7
- data/spec/unit/interface/option_builder_spec.rb +0 -0
- data/spec/unit/interface/option_spec.rb +0 -0
- data/spec/unit/interface_spec.rb +27 -0
- data/spec/unit/man_spec.rb +1 -1
- data/spec/unit/module_spec.rb +126 -74
- data/spec/unit/module_tool/application_spec.rb +1 -1
- data/spec/unit/module_tool/applications/builder_spec.rb +44 -9
- data/spec/unit/module_tool/applications/installer_spec.rb +11 -3
- data/spec/unit/module_tool/applications/unpacker_spec.rb +2 -1
- data/spec/unit/module_tool/applications/upgrader_spec.rb +9 -2
- data/spec/unit/module_tool/installed_modules_spec.rb +6 -6
- data/spec/unit/module_tool/metadata_spec.rb +31 -2
- data/spec/unit/module_tool/tar/mini_spec.rb +3 -3
- data/spec/unit/module_tool/tar_spec.rb +16 -10
- data/spec/unit/module_tool_spec.rb +3 -3
- data/spec/unit/network/auth_config_parser_spec.rb +16 -0
- data/spec/unit/network/authconfig_spec.rb +62 -32
- data/spec/unit/network/authorization_spec.rb +30 -2
- data/spec/unit/network/authstore_spec.rb +2 -2
- data/spec/unit/network/format_handler_spec.rb +11 -11
- data/spec/unit/network/format_spec.rb +9 -0
- data/spec/unit/network/formats_spec.rb +322 -138
- data/spec/unit/network/http/api/indirected_routes_spec.rb +125 -116
- data/spec/unit/network/http/api/master/v3/environment_spec.rb +186 -0
- data/spec/unit/network/http/api/master/v3_spec.rb +23 -5
- data/spec/unit/network/http/api_spec.rb +1 -1
- data/spec/unit/network/http/compression_spec.rb +132 -84
- data/spec/unit/network/http/connection_spec.rb +25 -19
- data/spec/unit/network/http/error_spec.rb +1 -1
- data/spec/unit/network/http/factory_spec.rb +18 -0
- data/spec/unit/network/http/handler_spec.rb +17 -18
- data/spec/unit/network/http/nocache_pool_spec.rb +0 -0
- data/spec/unit/network/http/pool_spec.rb +30 -0
- data/spec/unit/network/http/rack/rest_spec.rb +9 -2
- data/spec/unit/network/http/rack_spec.rb +0 -0
- data/spec/unit/network/http/request_spec.rb +110 -0
- data/spec/unit/network/http/response_spec.rb +108 -0
- data/spec/unit/network/http/session_spec.rb +0 -0
- data/spec/unit/network/http/site_spec.rb +0 -0
- data/spec/unit/network/http/webrick/rest_spec.rb +0 -0
- data/spec/unit/network/http/webrick_spec.rb +1 -1
- data/spec/unit/network/http_pool_spec.rb +0 -0
- data/spec/unit/network/http_spec.rb +0 -0
- data/spec/unit/network/resolver_spec.rb +0 -0
- data/spec/unit/network/rights_spec.rb +4 -4
- data/spec/unit/network/server_spec.rb +0 -0
- data/spec/unit/node/environment_spec.rb +10 -0
- data/spec/unit/node/facts_spec.rb +13 -13
- data/spec/unit/node_spec.rb +68 -10
- data/spec/unit/other/selinux_spec.rb +0 -0
- data/spec/unit/parameter/path_spec.rb +0 -0
- data/spec/unit/parameter/value_collection_spec.rb +0 -0
- data/spec/unit/parameter/value_spec.rb +0 -0
- data/spec/unit/parameter_spec.rb +84 -5
- data/spec/unit/parser/ast/leaf_spec.rb +1 -1
- data/spec/unit/parser/compiler_spec.rb +135 -34
- data/spec/unit/parser/environment_compiler_spec.rb +686 -0
- data/spec/unit/parser/files_spec.rb +0 -0
- data/spec/unit/parser/functions/create_resources_spec.rb +132 -10
- data/spec/unit/parser/functions/digest_spec.rb +0 -0
- data/spec/unit/parser/functions/fail_spec.rb +0 -0
- data/spec/unit/parser/functions/file_spec.rb +0 -0
- data/spec/unit/parser/functions/fqdn_rand_spec.rb +6 -2
- data/spec/unit/parser/functions/generate_spec.rb +3 -12
- data/spec/unit/parser/functions/hiera_array_spec.rb +1 -1
- data/spec/unit/parser/functions/hiera_hash_spec.rb +1 -1
- data/spec/unit/parser/functions/hiera_include_spec.rb +1 -1
- data/spec/unit/parser/functions/hiera_spec.rb +1 -1
- data/spec/unit/parser/functions/inline_template_spec.rb +0 -0
- data/spec/unit/parser/functions/lookup_spec.rb +1 -1
- data/spec/unit/parser/functions/realize_spec.rb +0 -0
- data/spec/unit/parser/functions/regsubst_spec.rb +1 -1
- data/spec/unit/parser/functions/scanf_spec.rb +0 -0
- data/spec/unit/parser/functions/shellquote_spec.rb +0 -0
- data/spec/unit/parser/functions/split_spec.rb +1 -1
- data/spec/unit/parser/functions/sprintf_spec.rb +0 -0
- data/spec/unit/parser/functions/tag_spec.rb +0 -0
- data/spec/unit/parser/functions/template_spec.rb +0 -0
- data/spec/unit/parser/functions/versioncmp_spec.rb +0 -0
- data/spec/unit/parser/functions_spec.rb +0 -0
- data/spec/unit/parser/relationship_spec.rb +0 -0
- data/spec/unit/parser/resource/param_spec.rb +0 -0
- data/spec/unit/parser/resource_spec.rb +115 -54
- data/spec/unit/parser/scope_spec.rb +83 -85
- data/spec/unit/parser/templatewrapper_spec.rb +0 -0
- data/spec/unit/parser/type_loader_spec.rb +0 -0
- data/spec/unit/pops/benchmark_spec.rb +8 -26
- data/spec/unit/pops/containment_spec.rb +0 -26
- data/spec/unit/pops/evaluator/access_ops_spec.rb +198 -102
- data/spec/unit/pops/evaluator/arithmetic_ops_spec.rb +223 -0
- data/spec/unit/pops/evaluator/basic_expressions_spec.rb +5 -6
- data/spec/unit/pops/evaluator/comparison_ops_spec.rb +29 -26
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +135 -30
- data/spec/unit/pops/evaluator/evaluator_rspec_helper.rb +29 -25
- data/spec/unit/pops/evaluator/json_strict_literal_evaluator_spec.rb +63 -0
- data/spec/unit/pops/evaluator/literal_evaluator_spec.rb +43 -0
- data/spec/unit/pops/evaluator/runtime3_converter_spec.rb +168 -0
- data/spec/unit/pops/evaluator/string_interpolation_spec.rb +10 -10
- data/spec/unit/pops/evaluator/variables_spec.rb +2 -2
- data/spec/unit/pops/factory_rspec_helper.rb +0 -4
- data/spec/unit/pops/factory_spec.rb +83 -83
- data/spec/unit/pops/label_provider_spec.rb +5 -1
- data/spec/unit/pops/loaders/dependency_loader_spec.rb +66 -1
- data/spec/unit/pops/loaders/environment_loader_spec.rb +172 -0
- data/spec/unit/pops/loaders/loader_paths_spec.rb +1 -1
- data/spec/unit/pops/loaders/loaders_spec.rb +454 -28
- data/spec/unit/pops/loaders/module_loaders_spec.rb +63 -2
- data/spec/unit/pops/loaders/static_loader_spec.rb +80 -19
- data/spec/unit/pops/lookup/context_spec.rb +334 -0
- data/spec/unit/pops/lookup/interpolation_spec.rb +373 -0
- data/spec/unit/pops/lookup/lookup_spec.rb +294 -0
- data/spec/unit/pops/merge_strategy_spec.rb +18 -0
- data/spec/unit/pops/model/model_spec.rb +10 -10
- data/spec/unit/pops/parser/epp_parser_spec.rb +1 -1
- data/spec/unit/pops/parser/lexer2_spec.rb +239 -10
- data/spec/unit/pops/parser/locator_spec.rb +24 -0
- data/spec/unit/pops/parser/parse_application_spec.rb +32 -0
- data/spec/unit/pops/parser/parse_basic_expressions_spec.rb +35 -4
- data/spec/unit/pops/parser/parse_calls_spec.rb +25 -0
- data/spec/unit/pops/parser/parse_capabilities_spec.rb +37 -0
- data/spec/unit/pops/parser/parse_containers_spec.rb +17 -19
- data/spec/unit/pops/parser/parse_functions_spec.rb +19 -0
- data/spec/unit/pops/parser/parse_lambda_spec.rb +19 -0
- data/spec/unit/pops/parser/parse_site_spec.rb +48 -0
- data/spec/unit/pops/parser/parser_rspec_helper.rb +6 -0
- data/spec/unit/pops/parser/parser_spec.rb +32 -6
- data/spec/unit/pops/puppet_stack_spec.rb +79 -0
- data/spec/unit/pops/resource/resource_type_impl_spec.rb +109 -0
- data/spec/unit/pops/serialization/packer_spec.rb +154 -0
- data/spec/unit/pops/serialization/serialization_spec.rb +426 -0
- data/spec/unit/pops/serialization/to_from_hr_spec.rb +494 -0
- data/spec/unit/pops/time/timespan_spec.rb +121 -0
- data/spec/unit/pops/time/timestamp_spec.rb +13 -0
- data/spec/unit/pops/types/enumeration_spec.rb +13 -12
- data/spec/unit/pops/types/iterable_spec.rb +262 -0
- data/spec/unit/pops/types/p_binary_type_spec.rb +243 -0
- data/spec/unit/pops/types/p_object_type_spec.rb +1253 -0
- data/spec/unit/pops/types/p_sem_ver_type_spec.rb +322 -0
- data/spec/unit/pops/types/p_sensitive_type_spec.rb +169 -0
- data/spec/unit/pops/types/p_timespan_type_spec.rb +273 -0
- data/spec/unit/pops/types/p_timestamp_type_spec.rb +311 -0
- data/spec/unit/pops/types/p_type_set_type_spec.rb +445 -0
- data/spec/unit/pops/types/recursion_guard_spec.rb +93 -0
- data/spec/unit/pops/types/ruby_generator_spec.rb +662 -0
- data/spec/unit/pops/types/string_converter_spec.rb +1132 -0
- data/spec/unit/pops/types/type_acceptor_spec.rb +106 -0
- data/spec/unit/pops/types/type_asserter_spec.rb +43 -0
- data/spec/unit/pops/types/type_calculator_spec.rb +1122 -967
- data/spec/unit/pops/types/type_factory_spec.rb +137 -96
- data/spec/unit/pops/types/type_formatter_spec.rb +409 -0
- data/spec/unit/pops/types/type_mismatch_describer_spec.rb +228 -0
- data/spec/unit/pops/types/type_parser_spec.rb +207 -40
- data/spec/unit/pops/types/types_spec.rb +650 -0
- data/spec/unit/pops/validator/validator_spec.rb +395 -21
- data/spec/unit/pops/visitor_spec.rb +1 -1
- data/spec/unit/property/ensure_spec.rb +0 -0
- data/spec/unit/property/keyvalue_spec.rb +0 -0
- data/spec/unit/property/list_spec.rb +2 -2
- data/spec/unit/property/ordered_list_spec.rb +0 -0
- data/spec/unit/property_spec.rb +49 -12
- data/spec/unit/provider/augeas/augeas_spec.rb +60 -1
- data/spec/unit/provider/cisco_spec.rb +0 -0
- data/spec/unit/provider/command_spec.rb +0 -0
- data/spec/unit/provider/cron/crontab_spec.rb +0 -0
- data/spec/unit/provider/cron/parsed_spec.rb +1 -0
- data/spec/unit/provider/exec/posix_spec.rb +0 -0
- data/spec/unit/provider/exec/shell_spec.rb +0 -0
- data/spec/unit/provider/exec/windows_spec.rb +0 -0
- data/spec/unit/provider/exec_spec.rb +0 -0
- data/spec/unit/provider/file/posix_spec.rb +0 -0
- data/spec/unit/provider/file/windows_spec.rb +0 -0
- data/spec/unit/provider/group/directoryservice_spec.rb +33 -0
- data/spec/unit/provider/group/groupadd_spec.rb +0 -0
- data/spec/unit/provider/group/ldap_spec.rb +0 -0
- data/spec/unit/provider/group/pw_spec.rb +0 -0
- data/spec/unit/provider/group/windows_adsi_spec.rb +31 -9
- data/spec/unit/provider/host/parsed_spec.rb +0 -0
- data/spec/unit/provider/interface/cisco_spec.rb +0 -0
- data/spec/unit/provider/ldap_spec.rb +0 -0
- data/spec/unit/provider/macauthorization_spec.rb +5 -2
- data/spec/unit/provider/mcx/mcxcontent_spec.rb +0 -0
- data/spec/unit/provider/mount/parsed_spec.rb +0 -0
- data/spec/unit/provider/mount_spec.rb +0 -0
- data/spec/unit/provider/naginator_spec.rb +0 -0
- data/spec/unit/provider/nameservice/directoryservice_spec.rb +16 -19
- data/spec/unit/provider/nameservice_spec.rb +167 -15
- data/spec/unit/provider/network_device_spec.rb +0 -0
- data/spec/unit/provider/package/aix_spec.rb +0 -0
- data/spec/unit/provider/package/appdmg_spec.rb +3 -3
- data/spec/unit/provider/package/apt_spec.rb +0 -0
- data/spec/unit/provider/package/aptitude_spec.rb +0 -0
- data/spec/unit/provider/package/aptrpm_spec.rb +3 -3
- data/spec/unit/provider/package/base_spec.rb +18 -0
- data/spec/unit/provider/package/dnf_spec.rb +30 -0
- data/spec/unit/provider/package/dpkg_spec.rb +0 -0
- data/spec/unit/provider/package/freebsd_spec.rb +0 -0
- data/spec/unit/provider/package/gem_spec.rb +77 -0
- data/spec/unit/provider/package/hpux_spec.rb +0 -0
- data/spec/unit/provider/package/macports_spec.rb +0 -0
- data/spec/unit/provider/package/nim_spec.rb +6 -6
- data/spec/unit/provider/package/openbsd_spec.rb +0 -0
- data/spec/unit/provider/package/opkg_spec.rb +0 -0
- data/spec/unit/provider/package/pacman_spec.rb +55 -0
- data/spec/unit/provider/package/pip3_spec.rb +22 -0
- data/spec/unit/provider/package/pip_spec.rb +164 -46
- data/spec/unit/provider/package/pkg_spec.rb +139 -99
- data/spec/unit/provider/package/pkgdmg_spec.rb +32 -8
- data/spec/unit/provider/package/pkgin_spec.rb +23 -13
- data/spec/unit/provider/package/pkgng_spec.rb +16 -2
- data/spec/unit/provider/package/pkgutil_spec.rb +0 -0
- data/spec/unit/provider/package/portage_spec.rb +150 -8
- data/spec/unit/provider/package/puppet_gem_spec.rb +0 -0
- data/spec/unit/provider/package/rpm_spec.rb +183 -12
- data/spec/unit/provider/package/sun_spec.rb +0 -0
- data/spec/unit/provider/package/tdnf_spec.rb +18 -0
- data/spec/unit/provider/package/windows/package_spec.rb +45 -1
- data/spec/unit/provider/package/windows_spec.rb +8 -2
- data/spec/unit/provider/package/yum_spec.rb +29 -466
- data/spec/unit/provider/package/zypper_spec.rb +14 -0
- data/spec/unit/provider/parsedfile_spec.rb +0 -0
- data/spec/unit/provider/scheduled_task/win32_taskscheduler_spec.rb +211 -0
- data/spec/unit/provider/selboolean_spec.rb +0 -0
- data/spec/unit/provider/selmodule_spec.rb +0 -0
- data/spec/unit/provider/service/base_spec.rb +6 -0
- data/spec/unit/provider/service/bsd_spec.rb +130 -0
- data/spec/unit/provider/service/daemontools_spec.rb +0 -0
- data/spec/unit/provider/service/debian_spec.rb +34 -4
- data/spec/unit/provider/service/freebsd_spec.rb +16 -0
- data/spec/unit/provider/service/gentoo_spec.rb +7 -0
- data/spec/unit/provider/service/init_spec.rb +24 -1
- data/spec/unit/provider/service/launchd_spec.rb +124 -25
- data/spec/unit/provider/service/openbsd_spec.rb +0 -0
- data/spec/unit/provider/service/openrc_spec.rb +7 -0
- data/spec/unit/provider/service/openwrt_spec.rb +0 -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/runit_spec.rb +0 -0
- data/spec/unit/provider/service/smf_spec.rb +77 -13
- data/spec/unit/provider/service/src_spec.rb +31 -4
- data/spec/unit/provider/service/systemd_spec.rb +228 -39
- data/spec/unit/provider/service/upstart_spec.rb +64 -0
- data/spec/unit/provider/service/windows_spec.rb +0 -0
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +2 -1
- data/spec/unit/provider/sshkey/parsed_spec.rb +42 -18
- data/spec/unit/provider/user/aix_spec.rb +7 -0
- data/spec/unit/provider/user/directoryservice_spec.rb +171 -90
- data/spec/unit/provider/user/hpux_spec.rb +0 -0
- data/spec/unit/provider/user/ldap_spec.rb +0 -0
- data/spec/unit/provider/user/openbsd_spec.rb +0 -0
- data/spec/unit/provider/user/pw_spec.rb +0 -0
- data/spec/unit/provider/user/user_role_add_spec.rb +0 -0
- data/spec/unit/provider/user/useradd_spec.rb +14 -0
- data/spec/unit/provider/user/windows_adsi_spec.rb +30 -6
- data/spec/unit/provider/vlan/cisco_spec.rb +0 -0
- data/spec/unit/provider/yumrepo/inifile_spec.rb +16 -0
- data/spec/unit/provider/zfs/zfs_spec.rb +0 -0
- data/spec/unit/provider/zone/solaris_spec.rb +64 -12
- data/spec/unit/provider/zpool/zpool_spec.rb +0 -0
- data/spec/unit/provider_spec.rb +0 -0
- data/spec/unit/puppet_spec.rb +16 -3
- data/spec/unit/relationship_spec.rb +15 -36
- data/spec/unit/reports/http_spec.rb +11 -8
- data/spec/unit/reports/store_spec.rb +0 -0
- data/spec/unit/reports_spec.rb +10 -0
- data/spec/unit/resource/capability_finder_spec.rb +147 -0
- data/spec/unit/resource/catalog_spec.rb +294 -41
- data/spec/unit/resource/status_spec.rb +114 -103
- data/spec/unit/resource/type_collection_spec.rb +28 -7
- data/spec/unit/resource/type_spec.rb +172 -82
- data/spec/unit/resource_spec.rb +161 -76
- data/spec/unit/settings/directory_setting_spec.rb +0 -0
- data/spec/unit/settings/duration_setting_spec.rb +0 -0
- data/spec/unit/settings/environment_conf_spec.rb +18 -1
- data/spec/unit/settings/file_setting_spec.rb +37 -0
- data/spec/unit/settings/ini_file_spec.rb +58 -1
- data/spec/unit/settings/path_setting_spec.rb +0 -0
- data/spec/unit/settings/priority_setting_spec.rb +0 -0
- data/spec/unit/settings_spec.rb +109 -5
- data/spec/unit/ssl/base_spec.rb +9 -0
- data/spec/unit/ssl/certificate_authority/interface_spec.rb +180 -13
- data/spec/unit/ssl/certificate_authority_spec.rb +82 -28
- data/spec/unit/ssl/certificate_factory_spec.rb +2 -2
- data/spec/unit/ssl/certificate_request_attributes_spec.rb +6 -0
- data/spec/unit/ssl/certificate_request_spec.rb +4 -5
- data/spec/unit/ssl/certificate_revocation_list_spec.rb +3 -3
- data/spec/unit/ssl/certificate_spec.rb +1 -1
- data/spec/unit/ssl/configuration_spec.rb +11 -2
- data/spec/unit/ssl/host_spec.rb +37 -37
- data/spec/unit/ssl/inventory_spec.rb +27 -3
- data/spec/unit/ssl/key_spec.rb +7 -7
- data/spec/unit/ssl/oids_spec.rb +24 -13
- data/spec/unit/status_spec.rb +7 -7
- data/spec/unit/transaction/additional_resource_generator_spec.rb +160 -31
- data/spec/unit/transaction/event_manager_spec.rb +0 -0
- data/spec/unit/transaction/event_spec.rb +18 -13
- data/spec/unit/transaction/persistence_spec.rb +178 -0
- data/spec/unit/transaction/report_spec.rb +214 -40
- data/spec/unit/transaction/resource_harness_spec.rb +84 -40
- data/spec/unit/transaction_spec.rb +102 -7
- data/spec/unit/type/augeas_spec.rb +0 -0
- data/spec/unit/type/component_spec.rb +0 -0
- data/spec/unit/type/computer_spec.rb +0 -0
- data/spec/unit/type/cron_spec.rb +0 -0
- data/spec/unit/type/exec_spec.rb +57 -12
- data/spec/unit/type/file/checksum_spec.rb +6 -0
- data/spec/unit/type/file/checksum_value_spec.rb +286 -0
- data/spec/unit/type/file/content_spec.rb +59 -208
- data/spec/unit/type/file/ctime_spec.rb +0 -0
- data/spec/unit/type/file/ensure_spec.rb +0 -0
- data/spec/unit/type/file/group_spec.rb +2 -2
- data/spec/unit/type/file/mode_spec.rb +9 -9
- data/spec/unit/type/file/mtime_spec.rb +0 -0
- data/spec/unit/type/file/owner_spec.rb +2 -2
- data/spec/unit/type/file/selinux_spec.rb +2 -0
- data/spec/unit/type/file/source_spec.rb +224 -119
- data/spec/unit/type/file/type_spec.rb +0 -0
- data/spec/unit/type/file_spec.rb +211 -35
- data/spec/unit/type/filebucket_spec.rb +0 -0
- data/spec/unit/type/group_spec.rb +0 -0
- data/spec/unit/type/host_spec.rb +4 -4
- data/spec/unit/type/interface_spec.rb +32 -0
- data/spec/unit/type/k5login_spec.rb +0 -0
- data/spec/unit/type/macauthorization_spec.rb +4 -1
- data/spec/unit/type/mailalias_spec.rb +0 -0
- data/spec/unit/type/maillist_spec.rb +0 -0
- data/spec/unit/type/mcx_spec.rb +0 -0
- data/spec/unit/type/mount_spec.rb +50 -8
- data/spec/unit/type/nagios_spec.rb +0 -0
- data/spec/unit/type/noop_metaparam_spec.rb +0 -0
- data/spec/unit/type/package/package_settings_spec.rb +0 -0
- data/spec/unit/type/package_spec.rb +1 -0
- data/spec/unit/type/resources_spec.rb +0 -0
- data/spec/unit/type/schedule_spec.rb +0 -0
- data/spec/unit/type/selboolean_spec.rb +0 -0
- data/spec/unit/type/selmodule_spec.rb +0 -0
- data/spec/unit/type/service_spec.rb +21 -0
- data/spec/unit/type/ssh_authorized_key_spec.rb +2 -2
- data/spec/unit/type/sshkey_spec.rb +0 -0
- data/spec/unit/type/stage_spec.rb +0 -0
- data/spec/unit/type/tidy_spec.rb +4 -4
- data/spec/unit/type/user_spec.rb +38 -7
- data/spec/unit/type/vlan_spec.rb +1 -1
- data/spec/unit/type/whit_spec.rb +0 -0
- data/spec/unit/type/yumrepo_spec.rb +3 -7
- data/spec/unit/type/zfs_spec.rb +0 -0
- data/spec/unit/type/zone_spec.rb +0 -0
- data/spec/unit/type/zpool_spec.rb +0 -0
- data/spec/unit/type_spec.rb +119 -1
- data/spec/unit/util/at_fork_spec.rb +150 -0
- data/spec/unit/util/autoload_spec.rb +0 -0
- data/spec/unit/util/backups_spec.rb +0 -0
- data/spec/unit/util/character_encoding_spec.rb +229 -0
- data/spec/unit/util/checksums_spec.rb +0 -0
- data/spec/unit/util/colors_spec.rb +0 -0
- data/spec/unit/util/command_line_spec.rb +11 -0
- data/spec/unit/util/constant_inflector_spec.rb +0 -0
- data/spec/unit/util/diff_spec.rb +0 -0
- data/spec/unit/util/errors_spec.rb +0 -0
- data/spec/unit/util/execution_spec.rb +44 -3
- data/spec/unit/util/execution_stub_spec.rb +0 -0
- data/spec/unit/util/feature_spec.rb +1 -1
- data/spec/unit/util/filetype_spec.rb +4 -4
- data/spec/unit/util/http_proxy_spec.rb +91 -0
- data/spec/unit/util/ldap/connection_spec.rb +0 -0
- data/spec/unit/util/ldap/generator_spec.rb +1 -1
- data/spec/unit/util/ldap/manager_spec.rb +0 -0
- data/spec/unit/util/log/destinations_spec.rb +5 -8
- data/spec/unit/util/log_spec.rb +74 -18
- data/spec/unit/util/logging_spec.rb +69 -0
- data/spec/unit/util/metric_spec.rb +9 -2
- data/spec/unit/util/monkey_patches_spec.rb +37 -127
- data/spec/unit/util/multi_match_spec.rb +39 -0
- data/spec/unit/util/nagios_maker_spec.rb +0 -0
- data/spec/unit/util/network_device/cisco/device_spec.rb +253 -216
- data/spec/unit/util/network_device/cisco/facts_spec.rb +0 -0
- data/spec/unit/util/network_device/cisco/interface_spec.rb +0 -0
- data/spec/unit/util/network_device/config_spec.rb +0 -0
- data/spec/unit/util/network_device/ipcalc_spec.rb +0 -0
- data/spec/unit/util/network_device/transport/base_spec.rb +0 -0
- data/spec/unit/util/network_device/transport/ssh_spec.rb +1 -1
- data/spec/unit/util/network_device/transport/telnet_spec.rb +60 -58
- data/spec/unit/util/network_device_spec.rb +1 -1
- data/spec/unit/util/package_spec.rb +0 -0
- data/spec/unit/util/plist_spec.rb +135 -0
- data/spec/unit/util/posix_spec.rb +0 -0
- data/spec/unit/util/rdoc_spec.rb +0 -0
- data/spec/unit/util/resource_template_spec.rb +2 -2
- data/spec/unit/util/retry_action_spec.rb +0 -0
- data/spec/unit/util/run_mode_spec.rb +44 -13
- data/spec/unit/util/selinux_spec.rb +0 -0
- data/spec/unit/util/splayer_spec.rb +45 -0
- data/spec/unit/util/storage_spec.rb +8 -1
- data/spec/unit/util/suidmanager_spec.rb +0 -0
- data/spec/unit/util/symbolic_file_mode_spec.rb +0 -0
- data/spec/unit/util/tag_set_spec.rb +2 -2
- data/spec/unit/util/tagging_spec.rb +59 -0
- data/spec/unit/util/user_attr_spec.rb +0 -0
- data/spec/unit/util/warnings_spec.rb +0 -0
- data/spec/unit/util/windows/adsi_spec.rb +82 -40
- data/spec/unit/util/windows/api_types_spec.rb +42 -0
- data/spec/unit/util/windows/eventlog_spec.rb +123 -0
- data/spec/unit/util/windows/file_spec.rb +89 -0
- data/spec/unit/util/windows/root_certs_spec.rb +0 -0
- data/spec/unit/util/windows/security_descriptor_spec.rb +3 -3
- data/spec/unit/util/windows/sid_spec.rb +76 -14
- data/spec/unit/util/yaml_spec.rb +13 -1
- data/spec/unit/util_spec.rb +456 -17
- data/spec/unit/version_spec.rb +19 -0
- data/spec/watchr.rb +0 -0
- data/tasks/benchmark.rake +3 -3
- data/tasks/cfpropertylist.rake +15 -0
- data/tasks/generate_ast_model.rake +78 -0
- metadata +3441 -3081
- checksums.yaml +0 -7
- data/bin/extlookup2hiera +0 -56
- data/ext/emacs/puppet-mode-init.el +0 -6
- data/ext/emacs/puppet-mode.el +0 -433
- data/ext/puppet-nm-dispatcher +0 -13
- data/ext/puppetlisten/puppetlisten.rb +0 -77
- data/ext/puppetlisten/puppetrun.rb +0 -38
- data/ext/systemd/puppetmaster.service +0 -11
- data/ext/vim/README +0 -3
- data/ext/vim/ftdetect/puppet.vim +0 -2
- data/ext/vim/ftplugin/puppet.vim +0 -94
- data/ext/vim/indent/puppet.vim +0 -76
- data/ext/vim/syntax/puppet.vim +0 -115
- data/lib/puppet/application/file.rb +0 -4
- data/lib/puppet/application/inspect.rb +0 -179
- data/lib/puppet/application/resource_type.rb +0 -7
- data/lib/puppet/data_providers/data_adapter.rb +0 -91
- data/lib/puppet/data_providers/data_function_support.rb +0 -45
- data/lib/puppet/data_providers/function_env_data_provider.rb +0 -28
- data/lib/puppet/data_providers/function_module_data_provider.rb +0 -39
- data/lib/puppet/data_providers.rb +0 -31
- data/lib/puppet/face/file/download.rb +0 -56
- data/lib/puppet/face/file/store.rb +0 -21
- data/lib/puppet/face/file.rb +0 -47
- data/lib/puppet/face/resource_type.rb +0 -84
- data/lib/puppet/feature/cfacter.rb +0 -14
- data/lib/puppet/feature/external_facts.rb +0 -5
- data/lib/puppet/indirector/catalog/static_compiler.rb +0 -213
- data/lib/puppet/indirector/resource_type/parser.rb +0 -101
- data/lib/puppet/indirector/resource_type/rest.rb +0 -7
- data/lib/puppet/indirector/resource_type.rb +0 -5
- data/lib/puppet/parser/yaml_trimmer.rb +0 -7
- data/lib/puppet/plugins/binding_schemes.rb +0 -140
- data/lib/puppet/plugins/data_providers.rb +0 -90
- data/lib/puppet/pops/binder/binder.rb +0 -394
- data/lib/puppet/pops/binder/binder_issues.rb +0 -122
- data/lib/puppet/pops/binder/bindings_checker.rb +0 -197
- data/lib/puppet/pops/binder/bindings_composer.rb +0 -177
- data/lib/puppet/pops/binder/bindings_factory.rb +0 -809
- data/lib/puppet/pops/binder/bindings_label_provider.rb +0 -43
- data/lib/puppet/pops/binder/bindings_loader.rb +0 -83
- data/lib/puppet/pops/binder/bindings_model.rb +0 -68
- data/lib/puppet/pops/binder/bindings_model_dumper.rb +0 -215
- data/lib/puppet/pops/binder/bindings_model_meta.rb +0 -215
- data/lib/puppet/pops/binder/bindings_validator_factory.rb +0 -28
- data/lib/puppet/pops/binder/config/binder_config.rb +0 -107
- data/lib/puppet/pops/binder/config/binder_config_checker.rb +0 -142
- data/lib/puppet/pops/binder/config/diagnostic_producer.rb +0 -32
- data/lib/puppet/pops/binder/config/issues.rb +0 -90
- data/lib/puppet/pops/binder/injector.rb +0 -766
- data/lib/puppet/pops/binder/injector_entry.rb +0 -57
- data/lib/puppet/pops/binder/key_factory.rb +0 -67
- data/lib/puppet/pops/binder/producers.rb +0 -826
- data/lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb +0 -34
- data/lib/puppet/pops/binder/scheme_handler/module_scheme.rb +0 -84
- data/lib/puppet/pops/binder/scheme_handler/symbolic_scheme.rb +0 -53
- data/lib/puppet/pops/binder/system_bindings.rb +0 -60
- data/lib/puppet/pops/containment.rb +0 -104
- data/lib/puppet/pops/evaluator/callable_mismatch_describer.rb +0 -175
- data/lib/puppet/pops/model/model.rb +0 -114
- data/lib/puppet/pops/model/model_meta.rb +0 -586
- data/lib/puppet/pops/types/types_meta.rb +0 -234
- data/lib/puppet/resource/type_collection_helper.rb +0 -7
- data/lib/puppet/vendor/load_plist.rb +0 -1
- data/lib/puppet/vendor/load_rgen.rb +0 -2
- data/lib/puppet/vendor/plist/CHANGELOG +0 -82
- data/lib/puppet/vendor/plist/MIT-LICENSE +0 -21
- data/lib/puppet/vendor/plist/PUPPET_README.md +0 -6
- data/lib/puppet/vendor/plist/README +0 -36
- data/lib/puppet/vendor/plist/Rakefile +0 -144
- data/lib/puppet/vendor/plist/docs/USAGE +0 -104
- data/lib/puppet/vendor/plist/docs/jamis-template.rb +0 -591
- data/lib/puppet/vendor/plist/lib/plist/generator.rb +0 -224
- data/lib/puppet/vendor/plist/lib/plist/parser.rb +0 -225
- data/lib/puppet/vendor/plist/lib/plist.rb +0 -22
- data/lib/puppet/vendor/plist/test/assets/AlbumData.xml +0 -203
- data/lib/puppet/vendor/plist/test/assets/Cookies.plist +0 -104
- data/lib/puppet/vendor/plist/test/assets/commented.plist +0 -9
- data/lib/puppet/vendor/plist/test/assets/example_data.bin +0 -0
- data/lib/puppet/vendor/plist/test/assets/example_data.jpg +0 -0
- data/lib/puppet/vendor/plist/test/assets/example_data.plist +0 -259
- data/lib/puppet/vendor/plist/test/assets/test_data_elements.plist +0 -24
- data/lib/puppet/vendor/plist/test/assets/test_empty_key.plist +0 -13
- data/lib/puppet/vendor/plist/test/test_data_elements.rb +0 -115
- data/lib/puppet/vendor/plist/test/test_generator.rb +0 -59
- data/lib/puppet/vendor/plist/test/test_generator_basic_types.rb +0 -58
- data/lib/puppet/vendor/plist/test/test_generator_collections.rb +0 -82
- data/lib/puppet/vendor/plist/test/test_parser.rb +0 -90
- data/lib/puppet/vendor/rgen/CHANGELOG +0 -197
- data/lib/puppet/vendor/rgen/MIT-LICENSE +0 -20
- data/lib/puppet/vendor/rgen/PUPPET_README.md +0 -6
- data/lib/puppet/vendor/rgen/README.rdoc +0 -78
- data/lib/puppet/vendor/rgen/Rakefile +0 -41
- data/lib/puppet/vendor/rgen/TODO +0 -41
- data/lib/puppet/vendor/rgen/anounce.txt +0 -61
- data/lib/puppet/vendor/rgen/design_rationale.txt +0 -71
- data/lib/puppet/vendor/rgen/lib/ea_support/ea_support.rb +0 -54
- data/lib/puppet/vendor/rgen/lib/ea_support/id_store.rb +0 -32
- data/lib/puppet/vendor/rgen/lib/ea_support/uml13_ea_metamodel.rb +0 -562
- data/lib/puppet/vendor/rgen/lib/ea_support/uml13_ea_metamodel_ext.rb +0 -45
- data/lib/puppet/vendor/rgen/lib/ea_support/uml13_ea_metamodel_generator.rb +0 -43
- data/lib/puppet/vendor/rgen/lib/ea_support/uml13_ea_to_uml13.rb +0 -103
- data/lib/puppet/vendor/rgen/lib/ea_support/uml13_to_uml13_ea.rb +0 -89
- data/lib/puppet/vendor/rgen/lib/metamodels/uml13_metamodel.rb +0 -559
- data/lib/puppet/vendor/rgen/lib/metamodels/uml13_metamodel_ext.rb +0 -26
- data/lib/puppet/vendor/rgen/lib/mmgen/metamodel_generator.rb +0 -20
- data/lib/puppet/vendor/rgen/lib/mmgen/mm_ext/ecore_mmgen_ext.rb +0 -91
- data/lib/puppet/vendor/rgen/lib/mmgen/mmgen.rb +0 -28
- data/lib/puppet/vendor/rgen/lib/mmgen/templates/annotations.tpl +0 -37
- data/lib/puppet/vendor/rgen/lib/mmgen/templates/metamodel_generator.tpl +0 -172
- data/lib/puppet/vendor/rgen/lib/rgen/array_extensions.rb +0 -45
- data/lib/puppet/vendor/rgen/lib/rgen/ecore/ecore.rb +0 -218
- data/lib/puppet/vendor/rgen/lib/rgen/ecore/ecore_builder_methods.rb +0 -81
- data/lib/puppet/vendor/rgen/lib/rgen/ecore/ecore_ext.rb +0 -69
- data/lib/puppet/vendor/rgen/lib/rgen/ecore/ecore_interface.rb +0 -47
- data/lib/puppet/vendor/rgen/lib/rgen/ecore/ecore_to_ruby.rb +0 -167
- data/lib/puppet/vendor/rgen/lib/rgen/ecore/ruby_to_ecore.rb +0 -91
- data/lib/puppet/vendor/rgen/lib/rgen/environment.rb +0 -129
- data/lib/puppet/vendor/rgen/lib/rgen/fragment/dump_file_cache.rb +0 -63
- data/lib/puppet/vendor/rgen/lib/rgen/fragment/fragmented_model.rb +0 -140
- data/lib/puppet/vendor/rgen/lib/rgen/fragment/model_fragment.rb +0 -289
- data/lib/puppet/vendor/rgen/lib/rgen/instantiator/abstract_instantiator.rb +0 -66
- data/lib/puppet/vendor/rgen/lib/rgen/instantiator/abstract_xml_instantiator.rb +0 -66
- data/lib/puppet/vendor/rgen/lib/rgen/instantiator/default_xml_instantiator.rb +0 -117
- data/lib/puppet/vendor/rgen/lib/rgen/instantiator/ecore_xml_instantiator.rb +0 -169
- data/lib/puppet/vendor/rgen/lib/rgen/instantiator/json_instantiator.rb +0 -126
- data/lib/puppet/vendor/rgen/lib/rgen/instantiator/json_parser.rb +0 -331
- data/lib/puppet/vendor/rgen/lib/rgen/instantiator/json_parser.y +0 -94
- data/lib/puppet/vendor/rgen/lib/rgen/instantiator/nodebased_xml_instantiator.rb +0 -137
- data/lib/puppet/vendor/rgen/lib/rgen/instantiator/qualified_name_resolver.rb +0 -97
- data/lib/puppet/vendor/rgen/lib/rgen/instantiator/reference_resolver.rb +0 -128
- data/lib/puppet/vendor/rgen/lib/rgen/instantiator/resolution_helper.rb +0 -47
- data/lib/puppet/vendor/rgen/lib/rgen/instantiator/xmi11_instantiator.rb +0 -168
- data/lib/puppet/vendor/rgen/lib/rgen/metamodel_builder/builder_extensions.rb +0 -556
- data/lib/puppet/vendor/rgen/lib/rgen/metamodel_builder/builder_runtime.rb +0 -174
- data/lib/puppet/vendor/rgen/lib/rgen/metamodel_builder/constant_order_helper.rb +0 -89
- data/lib/puppet/vendor/rgen/lib/rgen/metamodel_builder/data_types.rb +0 -77
- data/lib/puppet/vendor/rgen/lib/rgen/metamodel_builder/intermediate/annotation.rb +0 -30
- data/lib/puppet/vendor/rgen/lib/rgen/metamodel_builder/intermediate/feature.rb +0 -168
- data/lib/puppet/vendor/rgen/lib/rgen/metamodel_builder/mm_multiple.rb +0 -23
- data/lib/puppet/vendor/rgen/lib/rgen/metamodel_builder/module_extension.rb +0 -42
- data/lib/puppet/vendor/rgen/lib/rgen/metamodel_builder.rb +0 -224
- data/lib/puppet/vendor/rgen/lib/rgen/model_builder/builder_context.rb +0 -334
- data/lib/puppet/vendor/rgen/lib/rgen/model_builder/model_serializer.rb +0 -225
- data/lib/puppet/vendor/rgen/lib/rgen/model_builder/reference_resolver.rb +0 -156
- data/lib/puppet/vendor/rgen/lib/rgen/model_builder.rb +0 -32
- data/lib/puppet/vendor/rgen/lib/rgen/serializer/json_serializer.rb +0 -121
- data/lib/puppet/vendor/rgen/lib/rgen/serializer/opposite_reference_filter.rb +0 -18
- data/lib/puppet/vendor/rgen/lib/rgen/serializer/qualified_name_provider.rb +0 -47
- data/lib/puppet/vendor/rgen/lib/rgen/serializer/xmi11_serializer.rb +0 -116
- data/lib/puppet/vendor/rgen/lib/rgen/serializer/xmi20_serializer.rb +0 -71
- data/lib/puppet/vendor/rgen/lib/rgen/serializer/xml_serializer.rb +0 -98
- data/lib/puppet/vendor/rgen/lib/rgen/template_language/directory_template_container.rb +0 -83
- data/lib/puppet/vendor/rgen/lib/rgen/template_language/output_handler.rb +0 -87
- data/lib/puppet/vendor/rgen/lib/rgen/template_language/template_container.rb +0 -234
- data/lib/puppet/vendor/rgen/lib/rgen/template_language/template_helper.rb +0 -26
- data/lib/puppet/vendor/rgen/lib/rgen/template_language.rb +0 -297
- data/lib/puppet/vendor/rgen/lib/rgen/transformer.rb +0 -475
- data/lib/puppet/vendor/rgen/lib/rgen/util/auto_class_creator.rb +0 -61
- data/lib/puppet/vendor/rgen/lib/rgen/util/cached_glob.rb +0 -67
- data/lib/puppet/vendor/rgen/lib/rgen/util/file_cache_map.rb +0 -124
- data/lib/puppet/vendor/rgen/lib/rgen/util/file_change_detector.rb +0 -84
- data/lib/puppet/vendor/rgen/lib/rgen/util/method_delegation.rb +0 -114
- data/lib/puppet/vendor/rgen/lib/rgen/util/model_comparator.rb +0 -68
- data/lib/puppet/vendor/rgen/lib/rgen/util/model_comparator_base.rb +0 -142
- data/lib/puppet/vendor/rgen/lib/rgen/util/model_dumper.rb +0 -29
- data/lib/puppet/vendor/rgen/lib/rgen/util/name_helper.rb +0 -42
- data/lib/puppet/vendor/rgen/lib/rgen/util/pattern_matcher.rb +0 -329
- data/lib/puppet/vendor/rgen/lib/transformers/ecore_to_uml13.rb +0 -79
- data/lib/puppet/vendor/rgen/lib/transformers/uml13_to_ecore.rb +0 -127
- data/lib/puppet/vendor/rgen/test/array_extensions_test.rb +0 -64
- data/lib/puppet/vendor/rgen/test/ea_instantiator_test.rb +0 -35
- data/lib/puppet/vendor/rgen/test/ea_serializer_test.rb +0 -23
- data/lib/puppet/vendor/rgen/test/ecore_self_test.rb +0 -54
- data/lib/puppet/vendor/rgen/test/environment_test.rb +0 -90
- data/lib/puppet/vendor/rgen/test/json_test.rb +0 -171
- data/lib/puppet/vendor/rgen/test/metamodel_builder_test.rb +0 -1482
- data/lib/puppet/vendor/rgen/test/metamodel_from_ecore_test.rb +0 -57
- data/lib/puppet/vendor/rgen/test/metamodel_order_test.rb +0 -131
- data/lib/puppet/vendor/rgen/test/metamodel_roundtrip_test/TestModel.rb +0 -70
- data/lib/puppet/vendor/rgen/test/metamodel_roundtrip_test/houseMetamodel.ecore +0 -42
- data/lib/puppet/vendor/rgen/test/metamodel_roundtrip_test/houseMetamodel_from_ecore.rb +0 -44
- data/lib/puppet/vendor/rgen/test/metamodel_roundtrip_test/using_builtin_types.ecore +0 -9
- data/lib/puppet/vendor/rgen/test/metamodel_roundtrip_test.rb +0 -98
- data/lib/puppet/vendor/rgen/test/method_delegation_test.rb +0 -178
- data/lib/puppet/vendor/rgen/test/model_builder/builder_context_test.rb +0 -59
- data/lib/puppet/vendor/rgen/test/model_builder/builder_test.rb +0 -242
- data/lib/puppet/vendor/rgen/test/model_builder/ecore_original.rb +0 -163
- data/lib/puppet/vendor/rgen/test/model_builder/ecore_original_regenerated.rb +0 -163
- data/lib/puppet/vendor/rgen/test/model_builder/reference_resolver_test.rb +0 -156
- data/lib/puppet/vendor/rgen/test/model_builder/serializer_test.rb +0 -94
- data/lib/puppet/vendor/rgen/test/model_builder/statemachine_metamodel.rb +0 -42
- data/lib/puppet/vendor/rgen/test/model_builder/test_model/statemachine1.rb +0 -23
- data/lib/puppet/vendor/rgen/test/model_builder_test.rb +0 -6
- data/lib/puppet/vendor/rgen/test/model_fragment_test.rb +0 -30
- data/lib/puppet/vendor/rgen/test/output_handler_test.rb +0 -58
- data/lib/puppet/vendor/rgen/test/qualified_name_provider_test.rb +0 -48
- data/lib/puppet/vendor/rgen/test/qualified_name_resolver_test.rb +0 -102
- data/lib/puppet/vendor/rgen/test/reference_resolver_test.rb +0 -117
- data/lib/puppet/vendor/rgen/test/rgen_test.rb +0 -26
- data/lib/puppet/vendor/rgen/test/template_language_test/expected_result1.txt +0 -29
- data/lib/puppet/vendor/rgen/test/template_language_test/expected_result2.txt +0 -9
- data/lib/puppet/vendor/rgen/test/template_language_test/expected_result3.txt +0 -4
- data/lib/puppet/vendor/rgen/test/template_language_test/indentStringTestDefaultIndent.out +0 -1
- data/lib/puppet/vendor/rgen/test/template_language_test/indentStringTestTabIndent.out +0 -1
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/callback_indent_test/a.tpl +0 -12
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/callback_indent_test/b.tpl +0 -5
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/code/array.tpl +0 -11
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/content/author.tpl +0 -7
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/content/chapter.tpl +0 -5
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/define_local_test/local.tpl +0 -8
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/define_local_test/test.tpl +0 -8
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/evaluate_test/test.tpl +0 -7
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/indent_string_test.tpl +0 -12
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/index/c/cmod.tpl +0 -1
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/index/chapter.tpl +0 -3
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/no_backslash_r_test.tpl +0 -5
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/no_indent_test/no_indent.tpl +0 -3
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/no_indent_test/sub1/no_indent.tpl +0 -3
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/no_indent_test/test.tpl +0 -24
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/no_indent_test/test2.tpl +0 -13
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/no_indent_test/test3.tpl +0 -10
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/null_context_test.tpl +0 -17
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/root.tpl +0 -31
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/template_resolution_test/sub1/sub1.tpl +0 -3
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/template_resolution_test/sub1.tpl +0 -9
- data/lib/puppet/vendor/rgen/test/template_language_test/templates/template_resolution_test/test.tpl +0 -4
- data/lib/puppet/vendor/rgen/test/template_language_test/testout.txt +0 -29
- data/lib/puppet/vendor/rgen/test/template_language_test.rb +0 -163
- data/lib/puppet/vendor/rgen/test/testmodel/class_model_checker.rb +0 -119
- data/lib/puppet/vendor/rgen/test/testmodel/ea_testmodel.eap +0 -0
- data/lib/puppet/vendor/rgen/test/testmodel/ea_testmodel.xml +0 -1029
- data/lib/puppet/vendor/rgen/test/testmodel/ea_testmodel_partial.xml +0 -317
- data/lib/puppet/vendor/rgen/test/testmodel/ecore_model_checker.rb +0 -101
- data/lib/puppet/vendor/rgen/test/testmodel/manual_testmodel.xml +0 -22
- data/lib/puppet/vendor/rgen/test/testmodel/object_model_checker.rb +0 -67
- data/lib/puppet/vendor/rgen/test/transformer_test.rb +0 -254
- data/lib/puppet/vendor/rgen/test/util/file_cache_map_test.rb +0 -99
- data/lib/puppet/vendor/rgen/test/util/pattern_matcher_test.rb +0 -97
- data/lib/puppet/vendor/rgen/test/util_test.rb +0 -5
- data/lib/puppet/vendor/rgen/test/xml_instantiator_test/simple_ecore_model_checker.rb +0 -94
- data/lib/puppet/vendor/rgen/test/xml_instantiator_test/simple_xmi_ecore_instantiator.rb +0 -53
- data/lib/puppet/vendor/rgen/test/xml_instantiator_test/simple_xmi_metamodel.rb +0 -49
- data/lib/puppet/vendor/rgen/test/xml_instantiator_test/simple_xmi_to_ecore.rb +0 -75
- data/lib/puppet/vendor/rgen/test/xml_instantiator_test.rb +0 -160
- data/lib/puppet/vendor/rgen_patch.rb +0 -132
- data/lib/puppet/vendor/semantic/Gemfile +0 -20
- data/lib/puppet/vendor/semantic/PUPPET_README.md +0 -6
- data/lib/puppet/vendor/semantic/Rakefile +0 -69
- data/lib/puppet/vendor/semantic/lib/semantic/version.rb +0 -168
- data/lib/puppet/vendor/semantic/lib/semantic/version_range.rb +0 -424
- data/lib/puppet/vendor/semantic/spec/spec_helper.rb +0 -24
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/graph_node_spec.rb +0 -141
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/graph_spec.rb +0 -162
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/module_release_spec.rb +0 -143
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/source_spec.rb +0 -5
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/unsatisfiable_graph_spec.rb +0 -44
- data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency_spec.rb +0 -383
- data/lib/puppet/vendor/semantic/spec/unit/semantic/version_range_spec.rb +0 -307
- data/lib/puppet/vendor/semantic/spec/unit/semantic/version_spec.rb +0 -608
- data/lib/semver.rb +0 -123
- data/man/man8/extlookup2hiera.8 +0 -10
- data/man/man8/puppet-file.8 +0 -189
- data/man/man8/puppet-resource_type.8 +0 -188
- data/spec/fixtures/unit/data_providers/environments/production/modules/abc/lib/puppet/bindings/abc/default.rb +0 -9
- data/spec/fixtures/unit/data_providers/environments/production/modules/xyz/lib/puppet/bindings/xyz/default.rb +0 -9
- data/spec/fixtures/unit/data_providers/environments/sample/manifests/site.pp +0 -6
- data/spec/fixtures/unit/data_providers/environments/sample/modules/dataprovider/lib/puppet/bindings/dataprovider/default.rb +0 -54
- data/spec/fixtures/unit/data_providers/environments/sample/modules/dataprovider/lib/puppet_x/helindbe/sample_env_data.rb +0 -31
- data/spec/fixtures/unit/data_providers/environments/sample/modules/dataprovider/lib/puppet_x/helindbe/sample_module_data.rb +0 -32
- data/spec/fixtures/unit/data_providers/environments/sample/modules/dataprovider/manifests/init.pp +0 -5
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/abc/lib/puppet/bindings/abc/default.rb +0 -9
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/bad_data/lib/puppet/bindings/bad_data/default.rb +0 -9
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/bad_data/manifests/init.pp +0 -3
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/bca/lib/puppet/bindings/bca/default.rb +0 -9
- data/spec/integration/data_binding.rb +0 -104
- data/spec/integration/parser/functions/require_spec.rb +0 -43
- data/spec/integration/provider/package_spec.rb +0 -33
- data/spec/unit/application/inspect_spec.rb +0 -287
- data/spec/unit/data_providers/sample_data_provider_spec.rb +0 -52
- data/spec/unit/face/file_spec.rb +0 -10
- data/spec/unit/indirector/catalog/static_compiler_spec.rb +0 -237
- data/spec/unit/indirector/resource_type/parser_spec.rb +0 -254
- data/spec/unit/indirector/resource_type/rest_spec.rb +0 -14
- data/spec/unit/parser/functions/defined_spec.rb +0 -120
- data/spec/unit/parser/functions/include_spec.rb +0 -55
- data/spec/unit/parser/functions/require_spec.rb +0 -68
- data/spec/unit/pops/binder/binder_spec.rb +0 -43
- data/spec/unit/pops/binder/bindings_checker_spec.rb +0 -155
- data/spec/unit/pops/binder/bindings_composer_spec.rb +0 -64
- data/spec/unit/pops/binder/bindings_validator_factory_spec.rb +0 -18
- data/spec/unit/pops/binder/config/binder_config_spec.rb +0 -42
- data/spec/unit/pops/binder/injector_spec.rb +0 -768
- data/spec/unit/pops/parser/rgen_sanitycheck_spec.rb +0 -23
- data/spec/unit/resource/type_collection_helper_spec.rb +0 -24
- data/spec/unit/semver_spec.rb +0 -305
- /data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/environment.conf +0 -0
- /data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/lib/puppet/functions/environment/data.rb +0 -0
- /data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/abc/lib/puppet/functions/abc/data.rb +0 -0
- /data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/abc/manifests/init.pp +0 -0
- /data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/bca/lib/puppet/functions/bca/data.rb +0 -0
- /data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/bca/manifests/init.pp +0 -0
- /data/spec/fixtures/unit/functions/{lookup → lookup_fixture}/environments/production/modules/no_provider/manifests/init.pp +0 -0
- /data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/{usee → modules/usee}/lib/puppet/functions/usee/callee.rb +0 -0
- /data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/{user → modules/user}/lib/puppet/functions/user/caller.rb +0 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
module Puppet::Pops
|
|
2
|
+
module Types
|
|
1
3
|
# The TypeCalculator can answer questions about puppet types.
|
|
2
4
|
#
|
|
3
5
|
# The Puppet type system is primarily based on sub-classing. When asking the type calculator to infer types from Ruby in general, it
|
|
@@ -41,8 +43,8 @@
|
|
|
41
43
|
#
|
|
42
44
|
# Creation of Type instances
|
|
43
45
|
# --------------------------
|
|
44
|
-
# Instance of the classes in the {
|
|
45
|
-
# to use the {
|
|
46
|
+
# Instance of the classes in the {Types type model} are used to denote a specific type. It is most convenient
|
|
47
|
+
# to use the {TypeFactory} when creating instances.
|
|
46
48
|
#
|
|
47
49
|
# @note
|
|
48
50
|
# In general, new instances of the wanted type should be created as they are assigned to models using containment, and a
|
|
@@ -82,9 +84,9 @@
|
|
|
82
84
|
# no instances present in the first place. If however the classes are not present, the type
|
|
83
85
|
# calculator will fall back and state that the two types at least have Any in common.
|
|
84
86
|
#
|
|
85
|
-
# @see
|
|
86
|
-
# @see
|
|
87
|
-
# @see
|
|
87
|
+
# @see TypeFactory for how to create instances of types
|
|
88
|
+
# @see TypeParser how to construct a type instance from a String
|
|
89
|
+
# @see Types for details about the type model
|
|
88
90
|
#
|
|
89
91
|
# Using the Type Calculator
|
|
90
92
|
# -----
|
|
@@ -96,9 +98,7 @@
|
|
|
96
98
|
#
|
|
97
99
|
# @api public
|
|
98
100
|
#
|
|
99
|
-
class
|
|
100
|
-
|
|
101
|
-
Types = Puppet::Pops::Types
|
|
101
|
+
class TypeCalculator
|
|
102
102
|
|
|
103
103
|
# @api public
|
|
104
104
|
def self.assignable?(t1, t2)
|
|
@@ -106,8 +106,8 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
106
106
|
end
|
|
107
107
|
|
|
108
108
|
# Answers, does the given callable accept the arguments given in args (an array or a tuple)
|
|
109
|
-
# @param callable [
|
|
110
|
-
# @param args [
|
|
109
|
+
# @param callable [PCallableType] - the callable
|
|
110
|
+
# @param args [PArrayType, PTupleType] args optionally including a lambda callable at the end
|
|
111
111
|
# @return [Boolan] true if the callable accepts the arguments
|
|
112
112
|
#
|
|
113
113
|
# @api public
|
|
@@ -115,24 +115,14 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
115
115
|
singleton.callable?(callable, args)
|
|
116
116
|
end
|
|
117
117
|
|
|
118
|
-
# Produces a String representation of the given type.
|
|
119
|
-
# @param t [Puppet::Pops::Types::PAnyType] the type to produce a string form
|
|
120
|
-
# @return [String] the type in string form
|
|
121
|
-
#
|
|
122
|
-
# @api public
|
|
123
|
-
#
|
|
124
|
-
def self.string(t)
|
|
125
|
-
singleton.string(t)
|
|
126
|
-
end
|
|
127
|
-
|
|
128
118
|
# @api public
|
|
129
119
|
def self.infer(o)
|
|
130
120
|
singleton.infer(o)
|
|
131
121
|
end
|
|
132
122
|
|
|
133
123
|
# @api public
|
|
134
|
-
def self.generalize
|
|
135
|
-
singleton.generalize
|
|
124
|
+
def self.generalize(o)
|
|
125
|
+
singleton.generalize(o)
|
|
136
126
|
end
|
|
137
127
|
|
|
138
128
|
# @api public
|
|
@@ -141,118 +131,22 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
141
131
|
end
|
|
142
132
|
|
|
143
133
|
# @api public
|
|
144
|
-
def self.
|
|
145
|
-
singleton.
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
# @api public
|
|
149
|
-
def self.enumerable(t)
|
|
150
|
-
singleton.enumerable(t)
|
|
134
|
+
def self.iterable(t)
|
|
135
|
+
singleton.iterable(t)
|
|
151
136
|
end
|
|
152
137
|
|
|
138
|
+
# @return [TypeCalculator] the singleton instance
|
|
139
|
+
#
|
|
153
140
|
# @api private
|
|
154
|
-
def self.singleton
|
|
141
|
+
def self.singleton
|
|
155
142
|
@tc_instance ||= new
|
|
156
143
|
end
|
|
157
144
|
|
|
158
145
|
# @api public
|
|
159
146
|
#
|
|
160
147
|
def initialize
|
|
161
|
-
@@
|
|
162
|
-
@@
|
|
163
|
-
@@infer_set_visitor ||= Puppet::Pops::Visitor.new(nil,"infer_set",0,0)
|
|
164
|
-
@@instance_of_visitor ||= Puppet::Pops::Visitor.new(nil,"instance_of",1,1)
|
|
165
|
-
@@string_visitor ||= Puppet::Pops::Visitor.new(nil,"string",0,0)
|
|
166
|
-
@@inspect_visitor ||= Puppet::Pops::Visitor.new(nil,"debug_string",0,0)
|
|
167
|
-
@@enumerable_visitor ||= Puppet::Pops::Visitor.new(nil,"enumerable",0,0)
|
|
168
|
-
@@extract_visitor ||= Puppet::Pops::Visitor.new(nil,"extract",0,0)
|
|
169
|
-
@@generalize_visitor ||= Puppet::Pops::Visitor.new(nil,"generalize",0,0)
|
|
170
|
-
@@callable_visitor ||= Puppet::Pops::Visitor.new(nil,"callable",1,1)
|
|
171
|
-
|
|
172
|
-
da = Types::PArrayType.new()
|
|
173
|
-
da.element_type = Types::PDataType.new()
|
|
174
|
-
@data_array = da
|
|
175
|
-
|
|
176
|
-
h = Types::PHashType.new()
|
|
177
|
-
h.element_type = Types::PDataType.new()
|
|
178
|
-
h.key_type = Types::PScalarType.new()
|
|
179
|
-
@data_hash = h
|
|
180
|
-
|
|
181
|
-
@data_t = Types::PDataType.new()
|
|
182
|
-
@scalar_t = Types::PScalarType.new()
|
|
183
|
-
@numeric_t = Types::PNumericType.new()
|
|
184
|
-
@t = Types::PAnyType.new()
|
|
185
|
-
|
|
186
|
-
# Data accepts a Tuple that has 0-infinity Data compatible entries (e.g. a Tuple equivalent to Array).
|
|
187
|
-
data_tuple = Types::PTupleType.new()
|
|
188
|
-
data_tuple.addTypes(Types::PDataType.new())
|
|
189
|
-
data_tuple.size_type = Types::PIntegerType.new()
|
|
190
|
-
data_tuple.size_type.from = 0
|
|
191
|
-
data_tuple.size_type.to = nil # infinity
|
|
192
|
-
@data_tuple_t = data_tuple
|
|
193
|
-
|
|
194
|
-
# Variant type compatible with Data
|
|
195
|
-
data_variant = Types::PVariantType.new()
|
|
196
|
-
data_variant.addTypes(@data_hash.copy)
|
|
197
|
-
data_variant.addTypes(@data_array.copy)
|
|
198
|
-
data_variant.addTypes(Types::PScalarType.new)
|
|
199
|
-
data_variant.addTypes(Types::PUndefType.new)
|
|
200
|
-
data_variant.addTypes(@data_tuple_t.copy)
|
|
201
|
-
@data_variant_t = data_variant
|
|
202
|
-
|
|
203
|
-
collection_default_size = Types::PIntegerType.new()
|
|
204
|
-
collection_default_size.from = 0
|
|
205
|
-
collection_default_size.to = nil # infinity
|
|
206
|
-
@collection_default_size_t = collection_default_size
|
|
207
|
-
|
|
208
|
-
non_empty_string = Types::PStringType.new
|
|
209
|
-
non_empty_string.size_type = Types::PIntegerType.new()
|
|
210
|
-
non_empty_string.size_type.from = 1
|
|
211
|
-
non_empty_string.size_type.to = nil # infinity
|
|
212
|
-
@non_empty_string_t = non_empty_string
|
|
213
|
-
|
|
214
|
-
@nil_t = Types::PUndefType.new
|
|
215
|
-
end
|
|
216
|
-
|
|
217
|
-
# Convenience method to get a data type for comparisons
|
|
218
|
-
# @api private the returned value may not be contained in another element
|
|
219
|
-
#
|
|
220
|
-
def data
|
|
221
|
-
@data_t
|
|
222
|
-
end
|
|
223
|
-
|
|
224
|
-
# Convenience method to get a variant compatible with the Data type.
|
|
225
|
-
# @api private the returned value may not be contained in another element
|
|
226
|
-
#
|
|
227
|
-
def data_variant
|
|
228
|
-
@data_variant_t
|
|
229
|
-
end
|
|
230
|
-
|
|
231
|
-
def self.data_variant
|
|
232
|
-
singleton.data_variant
|
|
233
|
-
end
|
|
234
|
-
|
|
235
|
-
# Answers the question 'is it possible to inject an instance of the given class'
|
|
236
|
-
# A class is injectable if it has a special *assisted inject* class method called `inject` taking
|
|
237
|
-
# an injector and a scope as argument, or if it has a zero args `initialize` method.
|
|
238
|
-
#
|
|
239
|
-
# @param klazz [Class, PRuntimeType] the class/type to check if it is injectable
|
|
240
|
-
# @return [Class, nil] the injectable Class, or nil if not injectable
|
|
241
|
-
# @api public
|
|
242
|
-
#
|
|
243
|
-
def injectable_class(klazz)
|
|
244
|
-
# Handle case when we get a PType instead of a class
|
|
245
|
-
if klazz.is_a?(Types::PRuntimeType)
|
|
246
|
-
klazz = Puppet::Pops::Types::ClassLoader.provide(klazz)
|
|
247
|
-
end
|
|
248
|
-
|
|
249
|
-
# data types can not be injected (check again, it is not safe to assume that given RubyRuntime klazz arg was ok)
|
|
250
|
-
return false unless type(klazz).is_a?(Types::PRuntimeType)
|
|
251
|
-
if (klazz.respond_to?(:inject) && klazz.method(:inject).arity() == -4) || klazz.instance_method(:initialize).arity() == 0
|
|
252
|
-
klazz
|
|
253
|
-
else
|
|
254
|
-
nil
|
|
255
|
-
end
|
|
148
|
+
@@infer_visitor ||= Visitor.new(nil, 'infer',0,0)
|
|
149
|
+
@@extract_visitor ||= Visitor.new(nil, 'extract',0,0)
|
|
256
150
|
end
|
|
257
151
|
|
|
258
152
|
# Answers 'can an instance of type t2 be assigned to a variable of type t'.
|
|
@@ -261,47 +155,33 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
261
155
|
# @api public
|
|
262
156
|
#
|
|
263
157
|
def assignable?(t, t2)
|
|
264
|
-
if t.is_a?(
|
|
158
|
+
if t.is_a?(Module)
|
|
265
159
|
t = type(t)
|
|
266
160
|
end
|
|
267
|
-
|
|
268
|
-
if t2.is_a?(Class)
|
|
269
|
-
t2 = type(t2)
|
|
270
|
-
end
|
|
271
|
-
t2_class = t2.class
|
|
272
|
-
|
|
273
|
-
# Unit can be assigned to anything
|
|
274
|
-
return true if t2_class == Types::PUnitType
|
|
275
|
-
|
|
276
|
-
if t2_class == Types::PVariantType
|
|
277
|
-
# Assignable if all contained types are assignable
|
|
278
|
-
t2.types.all? { |vt| @@assignable_visitor.visit_this_1(self, t, vt) }
|
|
279
|
-
else
|
|
280
|
-
# Turn NotUndef[T] into T when T is not assignable from Undef
|
|
281
|
-
if t2_class == Types::PNotUndefType && !(t2.type.nil? || assignable?(t2.type, @nil_t))
|
|
282
|
-
assignable?(t, t2.type)
|
|
283
|
-
else
|
|
284
|
-
@@assignable_visitor.visit_this_1(self, t, t2)
|
|
285
|
-
end
|
|
286
|
-
end
|
|
161
|
+
t.is_a?(PAnyType) ? t.assignable?(t2) : false
|
|
287
162
|
end
|
|
288
163
|
|
|
289
|
-
# Returns an
|
|
164
|
+
# Returns an iterable if the t represents something that can be iterated
|
|
290
165
|
def enumerable(t)
|
|
291
|
-
|
|
166
|
+
Puppet.deprecation_warning('TypeCalculator.enumerable is deprecated. Use iterable')
|
|
167
|
+
iterable(t)
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# Returns an iterable if the t represents something that can be iterated
|
|
171
|
+
def iterable(t)
|
|
172
|
+
# Create an iterable on the type if possible
|
|
173
|
+
Iterable.on(t)
|
|
292
174
|
end
|
|
293
175
|
|
|
294
176
|
# Answers, does the given callable accept the arguments given in args (an array or a tuple)
|
|
295
177
|
#
|
|
296
178
|
def callable?(callable, args)
|
|
297
|
-
|
|
298
|
-
# Note that polymorphism is for the args type, the callable is always a callable
|
|
299
|
-
@@callable_visitor.visit_this_1(self, args, callable)
|
|
179
|
+
callable.is_a?(PAnyType) && callable.callable?(args)
|
|
300
180
|
end
|
|
301
181
|
|
|
302
182
|
# Answers if the two given types describe the same type
|
|
303
183
|
def equals(left, right)
|
|
304
|
-
return false unless left.is_a?(
|
|
184
|
+
return false unless left.is_a?(PAnyType) && right.is_a?(PAnyType)
|
|
305
185
|
# Types compare per class only - an extra test must be made if the are mutually assignable
|
|
306
186
|
# to find all types that represent the same type of instance
|
|
307
187
|
#
|
|
@@ -309,90 +189,46 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
309
189
|
end
|
|
310
190
|
|
|
311
191
|
# Answers 'what is the Puppet Type corresponding to the given Ruby class'
|
|
312
|
-
# @param c [
|
|
192
|
+
# @param c [Module] the class for which a puppet type is wanted
|
|
313
193
|
# @api public
|
|
314
194
|
#
|
|
315
195
|
def type(c)
|
|
316
|
-
raise ArgumentError,
|
|
196
|
+
raise ArgumentError, 'Argument must be a Module' unless c.is_a? Module
|
|
317
197
|
|
|
318
198
|
# Can't use a visitor here since we don't have an instance of the class
|
|
319
199
|
case
|
|
320
200
|
when c <= Integer
|
|
321
|
-
type =
|
|
201
|
+
type = PIntegerType::DEFAULT
|
|
322
202
|
when c == Float
|
|
323
|
-
type =
|
|
203
|
+
type = PFloatType::DEFAULT
|
|
324
204
|
when c == Numeric
|
|
325
|
-
type =
|
|
205
|
+
type = PNumericType::DEFAULT
|
|
326
206
|
when c == String
|
|
327
|
-
type =
|
|
207
|
+
type = PStringType::DEFAULT
|
|
328
208
|
when c == Regexp
|
|
329
|
-
type =
|
|
209
|
+
type = PRegexpType::DEFAULT
|
|
330
210
|
when c == NilClass
|
|
331
|
-
type =
|
|
211
|
+
type = PUndefType::DEFAULT
|
|
332
212
|
when c == FalseClass, c == TrueClass
|
|
333
|
-
type =
|
|
213
|
+
type = PBooleanType::DEFAULT
|
|
334
214
|
when c == Class
|
|
335
|
-
type =
|
|
215
|
+
type = PType::DEFAULT
|
|
336
216
|
when c == Array
|
|
337
|
-
# Assume array of
|
|
338
|
-
type =
|
|
339
|
-
type.element_type = Types::PDataType.new()
|
|
217
|
+
# Assume array of any
|
|
218
|
+
type = PArrayType::DEFAULT
|
|
340
219
|
when c == Hash
|
|
341
|
-
# Assume hash
|
|
342
|
-
type =
|
|
343
|
-
|
|
344
|
-
type
|
|
345
|
-
else
|
|
346
|
-
type = Types::PRuntimeType.new(:runtime => :ruby, :runtime_type_name => c.name)
|
|
220
|
+
# Assume hash of any
|
|
221
|
+
type = PHashType::DEFAULT
|
|
222
|
+
else
|
|
223
|
+
type = PRuntimeType.new(:ruby, c.name)
|
|
347
224
|
end
|
|
348
225
|
type
|
|
349
226
|
end
|
|
350
227
|
|
|
351
|
-
# Generalizes value specific types. The
|
|
228
|
+
# Generalizes value specific types. The generalized type is returned.
|
|
352
229
|
# @api public
|
|
353
|
-
def generalize
|
|
354
|
-
|
|
355
|
-
o.eAllContents.each { |x| @@generalize_visitor.visit_this_0(self, x) }
|
|
356
|
-
o
|
|
357
|
-
end
|
|
358
|
-
|
|
359
|
-
def generalize_Object(o)
|
|
360
|
-
# do nothing, there is nothing to change for most types
|
|
361
|
-
end
|
|
362
|
-
|
|
363
|
-
# @return [Boolean] true if the given argument is contained in a struct element key
|
|
364
|
-
def is_struct_element_key?(o)
|
|
365
|
-
c = o.eContainer
|
|
366
|
-
if c.is_a?(Types::POptionalType)
|
|
367
|
-
o = c
|
|
368
|
-
c = c.eContainer
|
|
369
|
-
end
|
|
370
|
-
c.is_a?(Types::PStructElement) && c.key_type.equal?(o)
|
|
371
|
-
end
|
|
372
|
-
private :is_struct_element_key?
|
|
373
|
-
|
|
374
|
-
def generalize_PStringType(o)
|
|
375
|
-
# Skip generalization if the string is contained in a PStructElement key.
|
|
376
|
-
unless is_struct_element_key?(o)
|
|
377
|
-
o.values = []
|
|
378
|
-
o.size_type = nil
|
|
379
|
-
end
|
|
380
|
-
end
|
|
381
|
-
|
|
382
|
-
def generalize_PCollectionType(o)
|
|
383
|
-
# erase the size constraint from Array and Hash (if one exists, it is transformed to -Infinity - + Infinity, which is
|
|
384
|
-
# not desirable.
|
|
385
|
-
o.size_type = nil
|
|
386
|
-
end
|
|
387
|
-
|
|
388
|
-
def generalize_PFloatType(o)
|
|
389
|
-
o.to = nil
|
|
390
|
-
o.from = nil
|
|
391
|
-
end
|
|
392
|
-
|
|
393
|
-
def generalize_PIntegerType(o)
|
|
394
|
-
o.to = nil
|
|
395
|
-
o.from = nil
|
|
230
|
+
def generalize(o)
|
|
231
|
+
o.is_a?(PAnyType) ? o.generalize : o
|
|
396
232
|
end
|
|
397
233
|
|
|
398
234
|
# Answers 'what is the single common Puppet Type describing o', or if o is an Array or Hash, what is the
|
|
@@ -400,153 +236,71 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
400
236
|
# @api public
|
|
401
237
|
#
|
|
402
238
|
def infer(o)
|
|
403
|
-
|
|
239
|
+
# Optimize the most common cases into direct calls.
|
|
240
|
+
# Explicit if/elsif/else is faster than case
|
|
241
|
+
if o.is_a?(String)
|
|
242
|
+
infer_String(o)
|
|
243
|
+
elsif o.is_a?(Integer) # need subclasses for Ruby < 2.4
|
|
244
|
+
infer_Integer(o)
|
|
245
|
+
elsif o.is_a?(Array)
|
|
246
|
+
infer_Array(o)
|
|
247
|
+
elsif o.is_a?(Hash)
|
|
248
|
+
infer_Hash(o)
|
|
249
|
+
elsif o.is_a?(Evaluator::PuppetProc)
|
|
250
|
+
infer_PuppetProc(o)
|
|
251
|
+
else
|
|
252
|
+
@@infer_visitor.visit_this_0(self, o)
|
|
253
|
+
end
|
|
404
254
|
end
|
|
405
255
|
|
|
406
256
|
def infer_generic(o)
|
|
407
|
-
|
|
408
|
-
result
|
|
257
|
+
generalize(infer(o))
|
|
409
258
|
end
|
|
410
259
|
|
|
411
260
|
# Answers 'what is the set of Puppet Types of o'
|
|
412
261
|
# @api public
|
|
413
262
|
#
|
|
414
263
|
def infer_set(o)
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
def instance_of_Object(t, o)
|
|
423
|
-
# Undef is Undef and Any, but nothing else when checking instance?
|
|
424
|
-
return false if (o.nil?) && t.class != Types::PAnyType
|
|
425
|
-
assignable?(t, infer(o))
|
|
426
|
-
end
|
|
427
|
-
|
|
428
|
-
# Anything is an instance of Unit
|
|
429
|
-
# @api private
|
|
430
|
-
def instance_of_PUnitType(t, o)
|
|
431
|
-
true
|
|
432
|
-
end
|
|
433
|
-
|
|
434
|
-
def instance_of_PArrayType(t, o)
|
|
435
|
-
return false unless o.is_a?(Array)
|
|
436
|
-
return false unless o.all? {|element| instance_of(t.element_type, element) }
|
|
437
|
-
size_t = t.size_type || @collection_default_size_t
|
|
438
|
-
# optimize by calling directly
|
|
439
|
-
return instance_of_PIntegerType(size_t, o.size)
|
|
440
|
-
end
|
|
441
|
-
|
|
442
|
-
# @api private
|
|
443
|
-
def instance_of_PIntegerType(t, o)
|
|
444
|
-
return false unless o.is_a?(Integer)
|
|
445
|
-
x = t.from
|
|
446
|
-
x = -Float::INFINITY if x.nil? || x == :default
|
|
447
|
-
y = t.to
|
|
448
|
-
y = Float::INFINITY if y.nil? || y == :default
|
|
449
|
-
return x < y ? x <= o && y >= o : y <= o && x >= o
|
|
450
|
-
end
|
|
451
|
-
|
|
452
|
-
# @api private
|
|
453
|
-
def instance_of_PStringType(t, o)
|
|
454
|
-
return false unless o.is_a?(String)
|
|
455
|
-
# true if size compliant
|
|
456
|
-
size_t = t.size_type
|
|
457
|
-
if size_t.nil? || instance_of_PIntegerType(size_t, o.size)
|
|
458
|
-
values = t.values
|
|
459
|
-
values.empty? || values.include?(o)
|
|
264
|
+
if o.instance_of?(Array)
|
|
265
|
+
infer_set_Array(o)
|
|
266
|
+
elsif o.instance_of?(Hash)
|
|
267
|
+
infer_set_Hash(o)
|
|
268
|
+
elsif o.instance_of?(SemanticPuppet::Version)
|
|
269
|
+
infer_set_Version(o)
|
|
460
270
|
else
|
|
461
|
-
|
|
462
|
-
end
|
|
463
|
-
end
|
|
464
|
-
|
|
465
|
-
def instance_of_PTupleType(t, o)
|
|
466
|
-
return false unless o.is_a?(Array)
|
|
467
|
-
# compute the tuple's min/max size, and check if that size matches
|
|
468
|
-
size_t = t.size_type || Puppet::Pops::Types::TypeFactory.range(*t.size_range)
|
|
469
|
-
|
|
470
|
-
return false unless instance_of_PIntegerType(size_t, o.size)
|
|
471
|
-
o.each_with_index do |element, index|
|
|
472
|
-
return false unless instance_of(t.types[index] || t.types[-1], element)
|
|
271
|
+
infer(o)
|
|
473
272
|
end
|
|
474
|
-
true
|
|
475
|
-
end
|
|
476
|
-
|
|
477
|
-
def instance_of_PStructType(t, o)
|
|
478
|
-
return false unless o.is_a?(Hash)
|
|
479
|
-
matched = 0
|
|
480
|
-
t.elements.all? do |e|
|
|
481
|
-
key = e.name
|
|
482
|
-
v = o[key]
|
|
483
|
-
if v.nil? && !o.include?(key)
|
|
484
|
-
# Entry is missing. Only OK when key is optional
|
|
485
|
-
assignable?(e.key_type, @nil_t)
|
|
486
|
-
else
|
|
487
|
-
matched += 1
|
|
488
|
-
instance_of(e.value_type, v)
|
|
489
|
-
end
|
|
490
|
-
end && matched == o.size
|
|
491
|
-
end
|
|
492
|
-
|
|
493
|
-
def instance_of_PHashType(t, o)
|
|
494
|
-
return false unless o.is_a?(Hash)
|
|
495
|
-
key_t = t.key_type
|
|
496
|
-
element_t = t.element_type
|
|
497
|
-
return false unless o.keys.all? {|key| instance_of(key_t, key) } && o.values.all? {|value| instance_of(element_t, value) }
|
|
498
|
-
size_t = t.size_type || @collection_default_size_t
|
|
499
|
-
# optimize by calling directly
|
|
500
|
-
return instance_of_PIntegerType(size_t, o.size)
|
|
501
|
-
end
|
|
502
|
-
|
|
503
|
-
def instance_of_PDataType(t, o)
|
|
504
|
-
instance_of(@data_variant_t, o)
|
|
505
|
-
end
|
|
506
|
-
|
|
507
|
-
def instance_of_PNotUndefType(t, o)
|
|
508
|
-
!(o.nil? || o == :undef) && (t.type.nil? || instance_of(t.type, o))
|
|
509
|
-
end
|
|
510
|
-
|
|
511
|
-
def instance_of_PUndefType(t, o)
|
|
512
|
-
o.nil? || o == :undef
|
|
513
|
-
end
|
|
514
|
-
|
|
515
|
-
def instance_of_POptionalType(t, o)
|
|
516
|
-
instance_of_PUndefType(t, o) || instance_of(t.optional_type, o)
|
|
517
|
-
end
|
|
518
|
-
|
|
519
|
-
def instance_of_PVariantType(t, o)
|
|
520
|
-
# instance of variant if o is instance? of any of variant's types
|
|
521
|
-
t.types.any? { |option_t| instance_of(option_t, o) }
|
|
522
273
|
end
|
|
523
274
|
|
|
524
275
|
# Answers 'is o an instance of type t'
|
|
525
276
|
# @api public
|
|
526
277
|
#
|
|
527
278
|
def self.instance?(t, o)
|
|
528
|
-
singleton.
|
|
279
|
+
singleton.instance?(t,o)
|
|
529
280
|
end
|
|
530
281
|
|
|
531
282
|
# Answers 'is o an instance of type t'
|
|
532
283
|
# @api public
|
|
533
284
|
#
|
|
534
285
|
def instance?(t, o)
|
|
535
|
-
|
|
286
|
+
if t.is_a?(Module)
|
|
287
|
+
t = type(t)
|
|
288
|
+
end
|
|
289
|
+
t.is_a?(PAnyType) ? t.instance?(o) : false
|
|
536
290
|
end
|
|
537
291
|
|
|
538
292
|
# Answers if t is a puppet type
|
|
539
293
|
# @api public
|
|
540
294
|
#
|
|
541
295
|
def is_ptype?(t)
|
|
542
|
-
|
|
296
|
+
t.is_a?(PAnyType)
|
|
543
297
|
end
|
|
544
298
|
|
|
545
299
|
# Answers if t represents the puppet type PUndefType
|
|
546
300
|
# @api public
|
|
547
301
|
#
|
|
548
302
|
def is_pnil?(t)
|
|
549
|
-
|
|
303
|
+
t.nil? || t.is_a?(PUndefType)
|
|
550
304
|
end
|
|
551
305
|
|
|
552
306
|
# Answers, 'What is the common type of t1 and t2?'
|
|
@@ -567,9 +321,9 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
567
321
|
end
|
|
568
322
|
|
|
569
323
|
# If either side is Unit, it is the other type
|
|
570
|
-
if t1.is_a?(
|
|
324
|
+
if t1.is_a?(PUnitType)
|
|
571
325
|
return t2
|
|
572
|
-
elsif t2.is_a?(
|
|
326
|
+
elsif t2.is_a?(PUnitType)
|
|
573
327
|
return t1
|
|
574
328
|
end
|
|
575
329
|
|
|
@@ -581,133 +335,121 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
581
335
|
end
|
|
582
336
|
|
|
583
337
|
# when both are arrays, return an array with common element type
|
|
584
|
-
if t1.is_a?(
|
|
585
|
-
|
|
586
|
-
type.element_type = common_type(t1.element_type, t2.element_type)
|
|
587
|
-
return type
|
|
338
|
+
if t1.is_a?(PArrayType) && t2.is_a?(PArrayType)
|
|
339
|
+
return PArrayType.new(common_type(t1.element_type, t2.element_type))
|
|
588
340
|
end
|
|
589
341
|
|
|
590
342
|
# when both are hashes, return a hash with common key- and element type
|
|
591
|
-
if t1.is_a?(
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
return type
|
|
343
|
+
if t1.is_a?(PHashType) && t2.is_a?(PHashType)
|
|
344
|
+
key_type = common_type(t1.key_type, t2.key_type)
|
|
345
|
+
value_type = common_type(t1.value_type, t2.value_type)
|
|
346
|
+
return PHashType.new(key_type, value_type)
|
|
596
347
|
end
|
|
597
348
|
|
|
598
349
|
# when both are host-classes, reduce to PHostClass[] (since one was not assignable to the other)
|
|
599
|
-
if t1.is_a?(
|
|
600
|
-
return
|
|
350
|
+
if t1.is_a?(PHostClassType) && t2.is_a?(PHostClassType)
|
|
351
|
+
return PHostClassType::DEFAULT
|
|
601
352
|
end
|
|
602
353
|
|
|
603
354
|
# when both are resources, reduce to Resource[T] or Resource[] (since one was not assignable to the other)
|
|
604
|
-
if t1.is_a?(
|
|
605
|
-
result = Types::PResourceType.new()
|
|
355
|
+
if t1.is_a?(PResourceType) && t2.is_a?(PResourceType)
|
|
606
356
|
# only Resource[] unless the type name is the same
|
|
607
|
-
|
|
608
|
-
# the cross assignability test above has already determined that they do not have the same type and title
|
|
609
|
-
return result
|
|
357
|
+
return t1.type_name == t2.type_name ? PResourceType.new(t1.type_name, nil) : PResourceType::DEFAULT
|
|
610
358
|
end
|
|
611
359
|
|
|
612
360
|
# Integers have range, expand the range to the common range
|
|
613
|
-
if t1.is_a?(
|
|
614
|
-
|
|
615
|
-
t2range = from_to_ordered(t2.from, t2.to)
|
|
616
|
-
t = Types::PIntegerType.new()
|
|
617
|
-
from = [t1range[0], t2range[0]].min
|
|
618
|
-
to = [t1range[1], t2range[1]].max
|
|
619
|
-
t.from = from unless from == Float::INFINITY
|
|
620
|
-
t.to = to unless to == Float::INFINITY
|
|
621
|
-
return t
|
|
361
|
+
if t1.is_a?(PIntegerType) && t2.is_a?(PIntegerType)
|
|
362
|
+
return PIntegerType.new([t1.numeric_from, t2.numeric_from].min, [t1.numeric_to, t2.numeric_to].max)
|
|
622
363
|
end
|
|
623
364
|
|
|
624
365
|
# Floats have range, expand the range to the common range
|
|
625
|
-
if t1.is_a?(
|
|
626
|
-
|
|
627
|
-
t2range = from_to_ordered(t2.from, t2.to)
|
|
628
|
-
t = Types::PFloatType.new()
|
|
629
|
-
from = [t1range[0], t2range[0]].min
|
|
630
|
-
to = [t1range[1], t2range[1]].max
|
|
631
|
-
t.from = from unless from == Float::INFINITY
|
|
632
|
-
t.to = to unless to == Float::INFINITY
|
|
633
|
-
return t
|
|
366
|
+
if t1.is_a?(PFloatType) && t2.is_a?(PFloatType)
|
|
367
|
+
return PFloatType.new([t1.numeric_from, t2.numeric_from].min, [t1.numeric_to, t2.numeric_to].max)
|
|
634
368
|
end
|
|
635
369
|
|
|
636
|
-
if t1.is_a?(
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
370
|
+
if t1.is_a?(PStringType) && (t2.is_a?(PStringType) || t2.is_a?(PEnumType))
|
|
371
|
+
if(t2.is_a?(PEnumType))
|
|
372
|
+
return t1.value.nil? ? PEnumType::DEFAULT : PEnumType.new(t2.values | [t1.value])
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
if t1.size_type.nil? || t2.size_type.nil?
|
|
376
|
+
return t1.value.nil? || t2.value.nil? ? PStringType::DEFAULT : PEnumType.new([t1.value, t2.value])
|
|
377
|
+
end
|
|
378
|
+
|
|
379
|
+
return PStringType.new(common_type(t1.size_type, t2.size_type))
|
|
641
380
|
end
|
|
642
381
|
|
|
643
|
-
if t1.is_a?(
|
|
644
|
-
|
|
645
|
-
# must make copies since patterns are contained types, not data-types
|
|
646
|
-
t.patterns = (t1.patterns | t2.patterns).map(&:copy)
|
|
647
|
-
return t
|
|
382
|
+
if t1.is_a?(PPatternType) && t2.is_a?(PPatternType)
|
|
383
|
+
return PPatternType.new(t1.patterns | t2.patterns)
|
|
648
384
|
end
|
|
649
385
|
|
|
650
|
-
if t1.is_a?(
|
|
386
|
+
if t1.is_a?(PEnumType) && (t2.is_a?(PStringType) || t2.is_a?(PEnumType))
|
|
651
387
|
# The common type is one that complies with either set
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
388
|
+
if t2.is_a?(PEnumType)
|
|
389
|
+
return PEnumType.new(t1.values | t2.values)
|
|
390
|
+
end
|
|
391
|
+
|
|
392
|
+
return t2.value.nil? ? PEnumType::DEFAULT : PEnumType.new(t1.values | [t2.value])
|
|
655
393
|
end
|
|
656
394
|
|
|
657
|
-
if t1.is_a?(
|
|
395
|
+
if t1.is_a?(PVariantType) && t2.is_a?(PVariantType)
|
|
658
396
|
# The common type is one that complies with either set
|
|
659
|
-
|
|
660
|
-
t.types = (t1.types | t2.types).map(&:copy)
|
|
661
|
-
return t
|
|
397
|
+
return PVariantType.maybe_create(t1.types | t2.types)
|
|
662
398
|
end
|
|
663
399
|
|
|
664
|
-
if t1.is_a?(
|
|
400
|
+
if t1.is_a?(PRegexpType) && t2.is_a?(PRegexpType)
|
|
665
401
|
# if they were identical, the general rule would return a parameterized regexp
|
|
666
402
|
# since they were not, the result is a generic regexp type
|
|
667
|
-
return
|
|
403
|
+
return PRegexpType::DEFAULT
|
|
668
404
|
end
|
|
669
405
|
|
|
670
|
-
if t1.is_a?(
|
|
406
|
+
if t1.is_a?(PCallableType) && t2.is_a?(PCallableType)
|
|
671
407
|
# They do not have the same signature, and one is not assignable to the other,
|
|
672
408
|
# what remains is the most general form of Callable
|
|
673
|
-
return
|
|
409
|
+
return PCallableType::DEFAULT
|
|
674
410
|
end
|
|
675
411
|
|
|
676
412
|
# Common abstract types, from most specific to most general
|
|
677
413
|
if common_numeric?(t1, t2)
|
|
678
|
-
return
|
|
414
|
+
return PNumericType::DEFAULT
|
|
415
|
+
end
|
|
416
|
+
|
|
417
|
+
if common_scalar_data?(t1, t2)
|
|
418
|
+
return PScalarDataType::DEFAULT
|
|
679
419
|
end
|
|
680
420
|
|
|
681
421
|
if common_scalar?(t1, t2)
|
|
682
|
-
return
|
|
422
|
+
return PScalarType::DEFAULT
|
|
683
423
|
end
|
|
684
424
|
|
|
685
425
|
if common_data?(t1,t2)
|
|
686
|
-
return
|
|
426
|
+
return TypeFactory.data
|
|
687
427
|
end
|
|
688
428
|
|
|
689
429
|
# Meta types Type[Integer] + Type[String] => Type[Data]
|
|
690
|
-
if t1.is_a?(
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
430
|
+
if t1.is_a?(PType) && t2.is_a?(PType)
|
|
431
|
+
return PType.new(common_type(t1.type, t2.type))
|
|
432
|
+
end
|
|
433
|
+
|
|
434
|
+
if common_rich_data?(t1,t2)
|
|
435
|
+
return TypeFactory.rich_data
|
|
694
436
|
end
|
|
695
437
|
|
|
696
438
|
# If both are Runtime types
|
|
697
|
-
if t1.is_a?(
|
|
439
|
+
if t1.is_a?(PRuntimeType) && t2.is_a?(PRuntimeType)
|
|
698
440
|
if t1.runtime == t2.runtime && t1.runtime_type_name == t2.runtime_type_name
|
|
699
441
|
return t1
|
|
700
442
|
end
|
|
701
443
|
# finding the common super class requires that names are resolved to class
|
|
702
444
|
# NOTE: This only supports runtime type of :ruby
|
|
703
|
-
c1 =
|
|
704
|
-
c2 =
|
|
445
|
+
c1 = ClassLoader.provide_from_type(t1)
|
|
446
|
+
c2 = ClassLoader.provide_from_type(t2)
|
|
705
447
|
if c1 && c2
|
|
706
448
|
c2_superclasses = superclasses(c2)
|
|
707
449
|
superclasses(c1).each do|c1_super|
|
|
708
450
|
c2_superclasses.each do |c2_super|
|
|
709
451
|
if c1_super == c2_super
|
|
710
|
-
return
|
|
452
|
+
return PRuntimeType.new(:ruby, c1_super.name)
|
|
711
453
|
end
|
|
712
454
|
end
|
|
713
455
|
end
|
|
@@ -715,9 +457,7 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
715
457
|
end
|
|
716
458
|
|
|
717
459
|
# They better both be Any type, or the wrong thing was asked and nil is returned
|
|
718
|
-
|
|
719
|
-
return Types::PAnyType.new()
|
|
720
|
-
end
|
|
460
|
+
t1.is_a?(PAnyType) && t2.is_a?(PAnyType) ? PAnyType::DEFAULT : nil
|
|
721
461
|
end
|
|
722
462
|
|
|
723
463
|
# Produces the superclasses of the given class, including the class
|
|
@@ -730,21 +470,6 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
730
470
|
result
|
|
731
471
|
end
|
|
732
472
|
|
|
733
|
-
# Produces a string representing the type
|
|
734
|
-
# @api public
|
|
735
|
-
#
|
|
736
|
-
def string(t)
|
|
737
|
-
@@string_visitor.visit_this_0(self, t)
|
|
738
|
-
end
|
|
739
|
-
|
|
740
|
-
# Produces a debug string representing the type (possibly with more information that the regular string format)
|
|
741
|
-
# @api public
|
|
742
|
-
#
|
|
743
|
-
def debug_string(t)
|
|
744
|
-
@@inspect_visitor.visit_this_0(self, t)
|
|
745
|
-
end
|
|
746
|
-
|
|
747
|
-
|
|
748
473
|
# Reduces an enumerable of types to a single common type.
|
|
749
474
|
# @api public
|
|
750
475
|
#
|
|
@@ -756,19 +481,24 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
756
481
|
# @api public
|
|
757
482
|
#
|
|
758
483
|
def infer_and_reduce_type(enumerable)
|
|
759
|
-
reduce_type(enumerable.
|
|
484
|
+
reduce_type(enumerable.map {|o| infer(o) })
|
|
760
485
|
end
|
|
761
486
|
|
|
762
|
-
# The type of all
|
|
487
|
+
# The type of all modules is PType
|
|
763
488
|
# @api private
|
|
764
489
|
#
|
|
765
|
-
def
|
|
766
|
-
|
|
490
|
+
def infer_Module(o)
|
|
491
|
+
PType::new(PRuntimeType.new(:ruby, o.name))
|
|
767
492
|
end
|
|
768
493
|
|
|
769
494
|
# @api private
|
|
770
495
|
def infer_Closure(o)
|
|
771
|
-
o.type
|
|
496
|
+
o.type
|
|
497
|
+
end
|
|
498
|
+
|
|
499
|
+
# @api private
|
|
500
|
+
def infer_Iterator(o)
|
|
501
|
+
PIteratorType.new(o.element_type)
|
|
772
502
|
end
|
|
773
503
|
|
|
774
504
|
# @api private
|
|
@@ -778,16 +508,21 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
778
508
|
|
|
779
509
|
# @api private
|
|
780
510
|
def infer_Object(o)
|
|
781
|
-
|
|
511
|
+
if o.is_a?(PuppetObject)
|
|
512
|
+
o._pcore_type
|
|
513
|
+
else
|
|
514
|
+
name = o.class.name
|
|
515
|
+
ir = Loaders.implementation_registry
|
|
516
|
+
type = ir.nil? ? nil : ir.type_for_module(name)
|
|
517
|
+
type.nil? ? PRuntimeType.new(:ruby, name) : type
|
|
518
|
+
end
|
|
782
519
|
end
|
|
783
520
|
|
|
784
521
|
# The type of all types is PType
|
|
785
522
|
# @api private
|
|
786
523
|
#
|
|
787
524
|
def infer_PAnyType(o)
|
|
788
|
-
|
|
789
|
-
type.type = o.copy
|
|
790
|
-
type
|
|
525
|
+
PType.new(o)
|
|
791
526
|
end
|
|
792
527
|
|
|
793
528
|
# The type of all types is PType
|
|
@@ -795,45 +530,32 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
795
530
|
# @api private
|
|
796
531
|
#
|
|
797
532
|
def infer_PType(o)
|
|
798
|
-
|
|
799
|
-
type.type = o.copy
|
|
800
|
-
type
|
|
533
|
+
PType.new(o)
|
|
801
534
|
end
|
|
802
535
|
|
|
803
536
|
# @api private
|
|
804
537
|
def infer_String(o)
|
|
805
|
-
|
|
806
|
-
t.addValues(o)
|
|
807
|
-
t.size_type = size_as_type(o)
|
|
808
|
-
t
|
|
538
|
+
PStringType.new(o)
|
|
809
539
|
end
|
|
810
540
|
|
|
811
541
|
# @api private
|
|
812
542
|
def infer_Float(o)
|
|
813
|
-
|
|
814
|
-
t.from = o
|
|
815
|
-
t.to = o
|
|
816
|
-
t
|
|
543
|
+
PFloatType.new(o, o)
|
|
817
544
|
end
|
|
818
545
|
|
|
819
546
|
# @api private
|
|
820
547
|
def infer_Integer(o)
|
|
821
|
-
|
|
822
|
-
t.from = o
|
|
823
|
-
t.to = o
|
|
824
|
-
t
|
|
548
|
+
PIntegerType.new(o, o)
|
|
825
549
|
end
|
|
826
550
|
|
|
827
551
|
# @api private
|
|
828
552
|
def infer_Regexp(o)
|
|
829
|
-
|
|
830
|
-
t.pattern = o.source
|
|
831
|
-
t
|
|
553
|
+
PRegexpType.new(o.source)
|
|
832
554
|
end
|
|
833
555
|
|
|
834
556
|
# @api private
|
|
835
557
|
def infer_NilClass(o)
|
|
836
|
-
|
|
558
|
+
PUndefType::DEFAULT
|
|
837
559
|
end
|
|
838
560
|
|
|
839
561
|
# @api private
|
|
@@ -845,16 +567,15 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
845
567
|
case p[0]
|
|
846
568
|
when :rest
|
|
847
569
|
max = :default
|
|
848
|
-
break
|
|
570
|
+
break PAnyType::DEFAULT
|
|
849
571
|
when :req
|
|
850
572
|
min += 1
|
|
851
573
|
end
|
|
852
574
|
max += 1
|
|
853
|
-
|
|
575
|
+
PAnyType::DEFAULT
|
|
854
576
|
end
|
|
855
|
-
mapped_types
|
|
856
|
-
|
|
857
|
-
Types::TypeFactory.callable(*mapped_types)
|
|
577
|
+
param_types = Types::PTupleType.new(mapped_types, Types::PIntegerType.new(min, max))
|
|
578
|
+
Types::PCallableType.new(param_types)
|
|
858
579
|
end
|
|
859
580
|
|
|
860
581
|
# @api private
|
|
@@ -867,72 +588,96 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
867
588
|
def infer_Symbol(o)
|
|
868
589
|
case o
|
|
869
590
|
when :default
|
|
870
|
-
|
|
591
|
+
PDefaultType::DEFAULT
|
|
592
|
+
when :undef
|
|
593
|
+
PUndefType::DEFAULT
|
|
871
594
|
else
|
|
872
595
|
infer_Object(o)
|
|
873
596
|
end
|
|
874
597
|
end
|
|
875
598
|
|
|
599
|
+
# @api private
|
|
600
|
+
def infer_Sensitive(o)
|
|
601
|
+
PSensitiveType.new(infer(o.unwrap))
|
|
602
|
+
end
|
|
603
|
+
|
|
604
|
+
# @api private
|
|
605
|
+
def infer_Timespan(o)
|
|
606
|
+
PTimespanType.new(o, o)
|
|
607
|
+
end
|
|
608
|
+
|
|
609
|
+
# @api private
|
|
610
|
+
def infer_Timestamp(o)
|
|
611
|
+
PTimestampType.new(o, o)
|
|
612
|
+
end
|
|
613
|
+
|
|
876
614
|
# @api private
|
|
877
615
|
def infer_TrueClass(o)
|
|
878
|
-
|
|
616
|
+
PBooleanType::DEFAULT
|
|
879
617
|
end
|
|
880
618
|
|
|
881
619
|
# @api private
|
|
882
620
|
def infer_FalseClass(o)
|
|
883
|
-
|
|
621
|
+
PBooleanType::DEFAULT
|
|
884
622
|
end
|
|
885
623
|
|
|
886
624
|
# @api private
|
|
887
625
|
# A Puppet::Parser::Resource, or Puppet::Resource
|
|
888
626
|
#
|
|
889
627
|
def infer_Resource(o)
|
|
890
|
-
t = Types::PResourceType.new()
|
|
891
|
-
t.type_name = o.type.to_s.downcase
|
|
892
628
|
# Only Puppet::Resource can have a title that is a symbol :undef, a PResource cannot.
|
|
893
629
|
# A mapping must be made to empty string. A nil value will result in an error later
|
|
894
630
|
title = o.title
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
type.type = t
|
|
898
|
-
type
|
|
631
|
+
title = '' if :undef == title
|
|
632
|
+
PType.new(PResourceType.new(o.type.to_s, title))
|
|
899
633
|
end
|
|
900
634
|
|
|
901
635
|
# @api private
|
|
902
636
|
def infer_Array(o)
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
637
|
+
if o.instance_of?(Array)
|
|
638
|
+
if o.empty?
|
|
639
|
+
PArrayType::EMPTY
|
|
640
|
+
else
|
|
641
|
+
PArrayType.new(infer_and_reduce_type(o), size_as_type(o))
|
|
642
|
+
end
|
|
907
643
|
else
|
|
908
|
-
|
|
644
|
+
infer_Object(o)
|
|
909
645
|
end
|
|
910
|
-
|
|
911
|
-
|
|
646
|
+
end
|
|
647
|
+
|
|
648
|
+
# @api private
|
|
649
|
+
def infer_Binary(o)
|
|
650
|
+
PBinaryType::DEFAULT
|
|
651
|
+
end
|
|
652
|
+
|
|
653
|
+
# @api private
|
|
654
|
+
def infer_Version(o)
|
|
655
|
+
PSemVerType::DEFAULT
|
|
656
|
+
end
|
|
657
|
+
|
|
658
|
+
# @api private
|
|
659
|
+
def infer_VersionRange(o)
|
|
660
|
+
PSemVerRangeType::DEFAULT
|
|
912
661
|
end
|
|
913
662
|
|
|
914
663
|
# @api private
|
|
915
664
|
def infer_Hash(o)
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
665
|
+
if o.instance_of?(Hash)
|
|
666
|
+
if o.empty?
|
|
667
|
+
PHashType::EMPTY
|
|
668
|
+
else
|
|
669
|
+
ktype = infer_and_reduce_type(o.keys)
|
|
670
|
+
etype = infer_and_reduce_type(o.values)
|
|
671
|
+
PHashType.new(ktype, etype, size_as_type(o))
|
|
672
|
+
end
|
|
920
673
|
else
|
|
921
|
-
|
|
922
|
-
etype = infer_and_reduce_type(o.values())
|
|
674
|
+
infer_Object(o)
|
|
923
675
|
end
|
|
924
|
-
type.key_type = ktype
|
|
925
|
-
type.element_type = etype
|
|
926
|
-
type.size_type = size_as_type(o)
|
|
927
|
-
type
|
|
928
676
|
end
|
|
929
677
|
|
|
930
678
|
def size_as_type(collection)
|
|
931
679
|
size = collection.size
|
|
932
|
-
|
|
933
|
-
t.from = size
|
|
934
|
-
t.to = size
|
|
935
|
-
t
|
|
680
|
+
PIntegerType.new(size, size)
|
|
936
681
|
end
|
|
937
682
|
|
|
938
683
|
# Common case for everything that intrinsically only has a single type
|
|
@@ -942,104 +687,37 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
942
687
|
|
|
943
688
|
def infer_set_Array(o)
|
|
944
689
|
if o.empty?
|
|
945
|
-
|
|
946
|
-
type.element_type = Types::PUndefType.new()
|
|
947
|
-
type.size_type = size_as_type(o)
|
|
690
|
+
PArrayType::EMPTY
|
|
948
691
|
else
|
|
949
|
-
|
|
950
|
-
type.types = o.map() {|x| infer_set(x) }
|
|
692
|
+
PTupleType.new(o.map {|x| infer_set(x) })
|
|
951
693
|
end
|
|
952
|
-
type
|
|
953
694
|
end
|
|
954
695
|
|
|
955
696
|
def infer_set_Hash(o)
|
|
956
697
|
if o.empty?
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
type.size_type = size_as_type(o)
|
|
961
|
-
elsif o.keys.all? {|k| instance_of_PStringType(@non_empty_string_t, k) }
|
|
962
|
-
type = Types::PStructType.new
|
|
963
|
-
type.elements = o.map do |k,v|
|
|
964
|
-
element = Types::PStructElement.new
|
|
965
|
-
element.key_type = infer_String(k)
|
|
966
|
-
element.value_type = infer_set(v)
|
|
967
|
-
element
|
|
968
|
-
end
|
|
698
|
+
PHashType::EMPTY
|
|
699
|
+
elsif o.keys.all? {|k| PStringType::NON_EMPTY.instance?(k) }
|
|
700
|
+
PStructType.new(o.each_pair.map { |k,v| PStructElement.new(PStringType.new(k), infer_set(v)) })
|
|
969
701
|
else
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
ktype
|
|
973
|
-
etype = Types::PVariantType.new
|
|
974
|
-
etype.types = o.values.map {|e| infer_set(e) }
|
|
975
|
-
type.key_type = unwrap_single_variant(ktype)
|
|
976
|
-
type.element_type = unwrap_single_variant(etype)
|
|
977
|
-
type.size_type = size_as_type(o)
|
|
702
|
+
ktype = PVariantType.maybe_create(o.keys.map {|k| infer_set(k) })
|
|
703
|
+
etype = PVariantType.maybe_create(o.values.map {|e| infer_set(e) })
|
|
704
|
+
PHashType.new(unwrap_single_variant(ktype), unwrap_single_variant(etype), size_as_type(o))
|
|
978
705
|
end
|
|
979
|
-
|
|
706
|
+
end
|
|
707
|
+
|
|
708
|
+
# @api private
|
|
709
|
+
def infer_set_Version(o)
|
|
710
|
+
PSemVerType.new([SemanticPuppet::VersionRange.new(o, o)])
|
|
980
711
|
end
|
|
981
712
|
|
|
982
713
|
def unwrap_single_variant(possible_variant)
|
|
983
|
-
if possible_variant.is_a?(
|
|
714
|
+
if possible_variant.is_a?(PVariantType) && possible_variant.types.size == 1
|
|
984
715
|
possible_variant.types[0]
|
|
985
716
|
else
|
|
986
717
|
possible_variant
|
|
987
718
|
end
|
|
988
719
|
end
|
|
989
720
|
|
|
990
|
-
# False in general type calculator
|
|
991
|
-
# @api private
|
|
992
|
-
def assignable_Object(t, t2)
|
|
993
|
-
false
|
|
994
|
-
end
|
|
995
|
-
|
|
996
|
-
# @api private
|
|
997
|
-
def assignable_PAnyType(t, t2)
|
|
998
|
-
t2.is_a?(Types::PAnyType)
|
|
999
|
-
end
|
|
1000
|
-
|
|
1001
|
-
# @api private
|
|
1002
|
-
def assignable_PNotUndefType(t, t2)
|
|
1003
|
-
!assignable?(t2, @nil_t) && (t.type.nil? || assignable?(t.type, t2))
|
|
1004
|
-
end
|
|
1005
|
-
|
|
1006
|
-
# @api private
|
|
1007
|
-
def assignable_PUndefType(t, t2)
|
|
1008
|
-
# Only undef/nil is assignable to nil type
|
|
1009
|
-
t2.is_a?(Types::PUndefType)
|
|
1010
|
-
end
|
|
1011
|
-
|
|
1012
|
-
# Anything is assignable to a Unit type
|
|
1013
|
-
# @api private
|
|
1014
|
-
def assignable_PUnitType(t, t2)
|
|
1015
|
-
true
|
|
1016
|
-
end
|
|
1017
|
-
|
|
1018
|
-
# @api private
|
|
1019
|
-
def assignable_PDefaultType(t, t2)
|
|
1020
|
-
# Only default is assignable to default type
|
|
1021
|
-
t2.is_a?(Types::PDefaultType)
|
|
1022
|
-
end
|
|
1023
|
-
|
|
1024
|
-
# @api private
|
|
1025
|
-
def assignable_PScalarType(t, t2)
|
|
1026
|
-
t2.is_a?(Types::PScalarType)
|
|
1027
|
-
end
|
|
1028
|
-
|
|
1029
|
-
# @api private
|
|
1030
|
-
def assignable_PNumericType(t, t2)
|
|
1031
|
-
t2.is_a?(Types::PNumericType)
|
|
1032
|
-
end
|
|
1033
|
-
|
|
1034
|
-
# @api private
|
|
1035
|
-
def assignable_PIntegerType(t, t2)
|
|
1036
|
-
return false unless t2.is_a?(Types::PIntegerType)
|
|
1037
|
-
trange = from_to_ordered(t.from, t.to)
|
|
1038
|
-
t2range = from_to_ordered(t2.from, t2.to)
|
|
1039
|
-
# If t2 min and max are within the range of t
|
|
1040
|
-
trange[0] <= t2range[0] && trange[1] >= t2range[1]
|
|
1041
|
-
end
|
|
1042
|
-
|
|
1043
721
|
# Transform int range to a size constraint
|
|
1044
722
|
# if range == nil the constraint is 1,1
|
|
1045
723
|
# if range.from == nil min size = 1
|
|
@@ -1050,125 +728,13 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
1050
728
|
from = range.from
|
|
1051
729
|
to = range.to
|
|
1052
730
|
x = from.nil? ? 1 : from
|
|
1053
|
-
y = to.nil? ?
|
|
1054
|
-
|
|
1055
|
-
[x, y]
|
|
1056
|
-
else
|
|
1057
|
-
[y, x]
|
|
1058
|
-
end
|
|
1059
|
-
end
|
|
1060
|
-
|
|
1061
|
-
# @api private
|
|
1062
|
-
def from_to_ordered(from, to)
|
|
1063
|
-
x = (from.nil? || from == :default) ? -Float::INFINITY : from
|
|
1064
|
-
y = (to.nil? || to == :default) ? Float::INFINITY : to
|
|
1065
|
-
if x < y
|
|
1066
|
-
[x, y]
|
|
1067
|
-
else
|
|
1068
|
-
[y, x]
|
|
1069
|
-
end
|
|
1070
|
-
end
|
|
1071
|
-
|
|
1072
|
-
# @api private
|
|
1073
|
-
def assignable_PVariantType(t, t2)
|
|
1074
|
-
# Data is a specific variant
|
|
1075
|
-
t2 = @data_variant_t if t2.is_a?(Types::PDataType)
|
|
1076
|
-
if t2.is_a?(Types::PVariantType)
|
|
1077
|
-
# A variant is assignable if all of its options are assignable to one of this type's options
|
|
1078
|
-
return true if t == t2
|
|
1079
|
-
t2.types.all? do |other|
|
|
1080
|
-
# if the other is a Variant, all of its options, but be assignable to one of this type's options
|
|
1081
|
-
other = other.is_a?(Types::PDataType) ? @data_variant_t : other
|
|
1082
|
-
if other.is_a?(Types::PVariantType)
|
|
1083
|
-
assignable?(t, other)
|
|
1084
|
-
else
|
|
1085
|
-
t.types.any? {|option_t| assignable?(option_t, other) }
|
|
1086
|
-
end
|
|
1087
|
-
end
|
|
1088
|
-
else
|
|
1089
|
-
# A variant is assignable if t2 is assignable to any of its types
|
|
1090
|
-
t.types.any? { |option_t| assignable?(option_t, t2) }
|
|
1091
|
-
end
|
|
1092
|
-
end
|
|
1093
|
-
|
|
1094
|
-
# Catch all not callable combinations
|
|
1095
|
-
def callable_Object(o, callable_t)
|
|
1096
|
-
false
|
|
1097
|
-
end
|
|
1098
|
-
|
|
1099
|
-
def callable_PTupleType(args_tuple, callable_t)
|
|
1100
|
-
if args_tuple.size_type
|
|
1101
|
-
raise ArgumentError, "Callable tuple may not have a size constraint when used as args"
|
|
1102
|
-
end
|
|
1103
|
-
|
|
1104
|
-
params_tuple = callable_t.param_types
|
|
1105
|
-
param_block_t = callable_t.block_type
|
|
1106
|
-
arg_types = args_tuple.types
|
|
1107
|
-
arg_block_t = arg_types.last()
|
|
1108
|
-
if self.class.is_kind_of_callable?(arg_block_t)
|
|
1109
|
-
# Can't pass a block to a callable that doesn't accept one
|
|
1110
|
-
return false if param_block_t.nil?
|
|
1111
|
-
|
|
1112
|
-
# Check that the block is of the right tyṕe
|
|
1113
|
-
return false unless assignable?(param_block_t, arg_block_t)
|
|
1114
|
-
|
|
1115
|
-
# Check other arguments
|
|
1116
|
-
arg_count = arg_types.size - 1
|
|
1117
|
-
params_size_t = params_tuple.size_type || Types::TypeFactory.range(*params_tuple.size_range)
|
|
1118
|
-
return false unless assignable?(params_size_t, Types::TypeFactory.range(arg_count, arg_count))
|
|
1119
|
-
|
|
1120
|
-
ctypes = params_tuple.types
|
|
1121
|
-
args_assignable = false
|
|
1122
|
-
arg_count.times do |index|
|
|
1123
|
-
return false unless assignable?((ctypes[index] || ctypes[-1]), arg_types[index])
|
|
1124
|
-
end
|
|
1125
|
-
return true
|
|
1126
|
-
end
|
|
1127
|
-
|
|
1128
|
-
# Check that tuple is assignable and that the block (if declared) is optional
|
|
1129
|
-
assignable?(params_tuple, args_tuple) && (param_block_t.nil? || assignable?(param_block_t, @nil_t))
|
|
731
|
+
y = to.nil? ? TheInfinity : to
|
|
732
|
+
[x, y]
|
|
1130
733
|
end
|
|
1131
734
|
|
|
1132
735
|
# @api private
|
|
1133
736
|
def self.is_kind_of_callable?(t, optional = true)
|
|
1134
|
-
|
|
1135
|
-
when Types::PCallableType
|
|
1136
|
-
true
|
|
1137
|
-
when Types::POptionalType
|
|
1138
|
-
optional && is_kind_of_callable?(t.optional_type, optional)
|
|
1139
|
-
when Types::PVariantType
|
|
1140
|
-
t.types.all? {|t2| is_kind_of_callable?(t2, optional) }
|
|
1141
|
-
else
|
|
1142
|
-
false
|
|
1143
|
-
end
|
|
1144
|
-
end
|
|
1145
|
-
|
|
1146
|
-
# @api private
|
|
1147
|
-
def self.is_kind_of_optional?(t, optional = true)
|
|
1148
|
-
case t
|
|
1149
|
-
when Types::POptionalType
|
|
1150
|
-
true
|
|
1151
|
-
when Types::PVariantType
|
|
1152
|
-
t.types.all? {|t2| is_kind_of_optional?(t2, optional) }
|
|
1153
|
-
else
|
|
1154
|
-
false
|
|
1155
|
-
end
|
|
1156
|
-
end
|
|
1157
|
-
|
|
1158
|
-
def callable_PArrayType(args_array, callable_t)
|
|
1159
|
-
return false unless assignable?(callable_t.param_types, args_array)
|
|
1160
|
-
# does not support calling with a block, but have to check that callable is ok with missing block
|
|
1161
|
-
assignable?(callable_t.block_type || @nil_t, @nil_t)
|
|
1162
|
-
end
|
|
1163
|
-
|
|
1164
|
-
def callable_PUndefType(nil_t, callable_t)
|
|
1165
|
-
# if callable_t is Optional (or indeed PUndefType), this means that 'missing callable' is accepted
|
|
1166
|
-
assignable?(callable_t, nil_t)
|
|
1167
|
-
end
|
|
1168
|
-
|
|
1169
|
-
def callable_PCallableType(given_callable_t, required_callable_t)
|
|
1170
|
-
# If the required callable is euqal or more specific than the given, the given is callable
|
|
1171
|
-
assignable?(required_callable_t, given_callable_t)
|
|
737
|
+
t.is_a?(PAnyType) && t.kind_of_callable?(optional)
|
|
1172
738
|
end
|
|
1173
739
|
|
|
1174
740
|
def max(a,b)
|
|
@@ -1179,41 +745,6 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
1179
745
|
a <= b ? a : b
|
|
1180
746
|
end
|
|
1181
747
|
|
|
1182
|
-
def assignable_PTupleType(t, t2)
|
|
1183
|
-
return true if t == t2 || t.types.empty? && (t2.is_a?(Types::PArrayType))
|
|
1184
|
-
size_t = t.size_type || Puppet::Pops::Types::TypeFactory.range(*t.size_range)
|
|
1185
|
-
|
|
1186
|
-
if t2.is_a?(Types::PTupleType)
|
|
1187
|
-
size_t2 = t2.size_type || Puppet::Pops::Types::TypeFactory.range(*t2.size_range)
|
|
1188
|
-
|
|
1189
|
-
# not assignable if the number of types in t2 is outside number of types in t1
|
|
1190
|
-
if assignable?(size_t, size_t2)
|
|
1191
|
-
t2.types.size.times do |index|
|
|
1192
|
-
return false unless assignable?((t.types[index] || t.types[-1]), t2.types[index])
|
|
1193
|
-
end
|
|
1194
|
-
return true
|
|
1195
|
-
else
|
|
1196
|
-
return false
|
|
1197
|
-
end
|
|
1198
|
-
elsif t2.is_a?(Types::PArrayType)
|
|
1199
|
-
t2_entry = t2.element_type
|
|
1200
|
-
|
|
1201
|
-
# Array of anything can not be assigned (unless tuple is tuple of anything) - this case
|
|
1202
|
-
# was handled at the top of this method.
|
|
1203
|
-
#
|
|
1204
|
-
return false if t2_entry.nil?
|
|
1205
|
-
size_t = t.size_type || Puppet::Pops::Types::TypeFactory.range(*t.size_range)
|
|
1206
|
-
size_t2 = t2.size_type || @collection_default_size_t
|
|
1207
|
-
return false unless assignable?(size_t, size_t2)
|
|
1208
|
-
min(t.types.size, size_t2.range()[1]).times do |index|
|
|
1209
|
-
return false unless assignable?((t.types[index] || t.types[-1]), t2_entry)
|
|
1210
|
-
end
|
|
1211
|
-
true
|
|
1212
|
-
else
|
|
1213
|
-
false
|
|
1214
|
-
end
|
|
1215
|
-
end
|
|
1216
|
-
|
|
1217
748
|
# Produces the tuple entry at the given index given a tuple type, its from/to constraints on the last
|
|
1218
749
|
# type, and an index.
|
|
1219
750
|
# Produces nil if the index is out of bounds
|
|
@@ -1233,614 +764,6 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
1233
764
|
end
|
|
1234
765
|
end
|
|
1235
766
|
|
|
1236
|
-
# @api private
|
|
1237
|
-
#
|
|
1238
|
-
def assignable_PStructType(t, t2)
|
|
1239
|
-
if t2.is_a?(Types::PStructType)
|
|
1240
|
-
h2 = t2.hashed_elements
|
|
1241
|
-
matched = 0
|
|
1242
|
-
t.elements.all? do |e1|
|
|
1243
|
-
e2 = h2[e1.name]
|
|
1244
|
-
if e2.nil?
|
|
1245
|
-
assignable?(e1.key_type, @nil_t)
|
|
1246
|
-
else
|
|
1247
|
-
matched += 1
|
|
1248
|
-
assignable?(e1.key_type, e2.key_type) && assignable?(e1.value_type, e2.value_type)
|
|
1249
|
-
end
|
|
1250
|
-
end && matched == h2.size
|
|
1251
|
-
elsif t2.is_a?(Types::PHashType)
|
|
1252
|
-
required = 0
|
|
1253
|
-
required_elements_assignable = t.elements.all? do |e|
|
|
1254
|
-
if assignable?(e.key_type, @nil_t)
|
|
1255
|
-
true
|
|
1256
|
-
else
|
|
1257
|
-
required += 1
|
|
1258
|
-
assignable?(e.value_type, t2.element_type)
|
|
1259
|
-
end
|
|
1260
|
-
end
|
|
1261
|
-
if required_elements_assignable
|
|
1262
|
-
size_t2 = t2.size_type || @collection_default_size_t
|
|
1263
|
-
size_t = Types::PIntegerType.new
|
|
1264
|
-
size_t.from = required
|
|
1265
|
-
size_t.to = t.elements.size
|
|
1266
|
-
assignable_PIntegerType(size_t, size_t2)
|
|
1267
|
-
end
|
|
1268
|
-
else
|
|
1269
|
-
false
|
|
1270
|
-
end
|
|
1271
|
-
end
|
|
1272
|
-
|
|
1273
|
-
# @api private
|
|
1274
|
-
def assignable_POptionalType(t, t2)
|
|
1275
|
-
return true if t2.is_a?(Types::PUndefType)
|
|
1276
|
-
return true if t.optional_type.nil?
|
|
1277
|
-
if t2.is_a?(Types::POptionalType)
|
|
1278
|
-
assignable?(t.optional_type, t2.optional_type || @t)
|
|
1279
|
-
else
|
|
1280
|
-
assignable?(t.optional_type, t2)
|
|
1281
|
-
end
|
|
1282
|
-
end
|
|
1283
|
-
|
|
1284
|
-
# @api private
|
|
1285
|
-
def assignable_PEnumType(t, t2)
|
|
1286
|
-
return true if t == t2
|
|
1287
|
-
if t.values.empty?
|
|
1288
|
-
return true if t2.is_a?(Types::PStringType) || t2.is_a?(Types::PEnumType) || t2.is_a?(Types::PPatternType)
|
|
1289
|
-
end
|
|
1290
|
-
case t2
|
|
1291
|
-
when Types::PStringType
|
|
1292
|
-
# if the set of strings are all found in the set of enums
|
|
1293
|
-
!t2.values.empty?() && t2.values.all? { |s| t.values.any? { |e| e == s }}
|
|
1294
|
-
when Types::PVariantType
|
|
1295
|
-
t2.types.all? {|variant_t| assignable_PEnumType(t, variant_t) }
|
|
1296
|
-
when Types::PEnumType
|
|
1297
|
-
# empty means any enum
|
|
1298
|
-
return true if t.values.empty?
|
|
1299
|
-
!t2.values.empty? && t2.values.all? { |s| t.values.any? {|e| e == s }}
|
|
1300
|
-
else
|
|
1301
|
-
false
|
|
1302
|
-
end
|
|
1303
|
-
end
|
|
1304
|
-
|
|
1305
|
-
# @api private
|
|
1306
|
-
def assignable_PStringType(t, t2)
|
|
1307
|
-
if t.values.empty?
|
|
1308
|
-
# A general string is assignable by any other string or pattern restricted string
|
|
1309
|
-
# if the string has a size constraint it does not match since there is no reasonable way
|
|
1310
|
-
# to compute the min/max length a pattern will match. For enum, it is possible to test that
|
|
1311
|
-
# each enumerator value is within range
|
|
1312
|
-
size_t = t.size_type || @collection_default_size_t
|
|
1313
|
-
case t2
|
|
1314
|
-
when Types::PStringType
|
|
1315
|
-
# true if size compliant
|
|
1316
|
-
size_t2 = t2.size_type || @collection_default_size_t
|
|
1317
|
-
assignable_PIntegerType(size_t, size_t2)
|
|
1318
|
-
|
|
1319
|
-
when Types::PPatternType
|
|
1320
|
-
# true if size constraint is at least 0 to +Infinity (which is the same as the default)
|
|
1321
|
-
assignable_PIntegerType(size_t, @collection_default_size_t)
|
|
1322
|
-
|
|
1323
|
-
when Types::PEnumType
|
|
1324
|
-
if t2.values && !t2.values.empty?
|
|
1325
|
-
# true if all enum values are within range
|
|
1326
|
-
min, max = t2.values.map(&:size).minmax
|
|
1327
|
-
trange = from_to_ordered(size_t.from, size_t.to)
|
|
1328
|
-
t2range = [min, max]
|
|
1329
|
-
# If t2 min and max are within the range of t
|
|
1330
|
-
trange[0] <= t2range[0] && trange[1] >= t2range[1]
|
|
1331
|
-
else
|
|
1332
|
-
# enum represents all enums, and thus all strings, a sized constrained string can thus not
|
|
1333
|
-
# be assigned any enum (unless it is max size).
|
|
1334
|
-
assignable_PIntegerType(size_t, @collection_default_size_t)
|
|
1335
|
-
end
|
|
1336
|
-
else
|
|
1337
|
-
# no other type matches string
|
|
1338
|
-
false
|
|
1339
|
-
end
|
|
1340
|
-
elsif t2.is_a?(Types::PStringType)
|
|
1341
|
-
# A specific string acts as a set of strings - must have exactly the same strings
|
|
1342
|
-
# In this case, size does not matter since the definition is very precise anyway
|
|
1343
|
-
Set.new(t.values) == Set.new(t2.values)
|
|
1344
|
-
else
|
|
1345
|
-
# All others are false, since no other type describes the same set of specific strings
|
|
1346
|
-
false
|
|
1347
|
-
end
|
|
1348
|
-
end
|
|
1349
|
-
|
|
1350
|
-
# @api private
|
|
1351
|
-
def assignable_PPatternType(t, t2)
|
|
1352
|
-
return true if t == t2
|
|
1353
|
-
case t2
|
|
1354
|
-
when Types::PStringType, Types::PEnumType
|
|
1355
|
-
values = t2.values
|
|
1356
|
-
when Types::PVariantType
|
|
1357
|
-
return t2.types.all? {|variant_t| assignable_PPatternType(t, variant_t) }
|
|
1358
|
-
when Types::PPatternType
|
|
1359
|
-
return t.patterns.empty? ? true : false
|
|
1360
|
-
else
|
|
1361
|
-
return false
|
|
1362
|
-
end
|
|
1363
|
-
|
|
1364
|
-
if t2.values.empty?
|
|
1365
|
-
# Strings / Enums (unknown which ones) cannot all match a pattern, but if there is no pattern it is ok
|
|
1366
|
-
# (There should really always be a pattern, but better safe than sorry).
|
|
1367
|
-
return t.patterns.empty? ? true : false
|
|
1368
|
-
end
|
|
1369
|
-
# all strings in String/Enum type must match one of the patterns in Pattern type,
|
|
1370
|
-
# or Pattern represents all Patterns == all Strings
|
|
1371
|
-
regexps = t.patterns.map {|p| p.regexp }
|
|
1372
|
-
regexps.empty? || t2.values.all? { |v| regexps.any? {|re| re.match(v) } }
|
|
1373
|
-
end
|
|
1374
|
-
|
|
1375
|
-
# @api private
|
|
1376
|
-
def assignable_PFloatType(t, t2)
|
|
1377
|
-
return false unless t2.is_a?(Types::PFloatType)
|
|
1378
|
-
trange = from_to_ordered(t.from, t.to)
|
|
1379
|
-
t2range = from_to_ordered(t2.from, t2.to)
|
|
1380
|
-
# If t2 min and max are within the range of t
|
|
1381
|
-
trange[0] <= t2range[0] && trange[1] >= t2range[1]
|
|
1382
|
-
end
|
|
1383
|
-
|
|
1384
|
-
# @api private
|
|
1385
|
-
def assignable_PBooleanType(t, t2)
|
|
1386
|
-
t2.is_a?(Types::PBooleanType)
|
|
1387
|
-
end
|
|
1388
|
-
|
|
1389
|
-
# @api private
|
|
1390
|
-
def assignable_PRegexpType(t, t2)
|
|
1391
|
-
t2.is_a?(Types::PRegexpType) && (t.pattern.nil? || t.pattern == t2.pattern)
|
|
1392
|
-
end
|
|
1393
|
-
|
|
1394
|
-
# @api private
|
|
1395
|
-
def assignable_PCallableType(t, t2)
|
|
1396
|
-
return false unless t2.is_a?(Types::PCallableType)
|
|
1397
|
-
# nil param_types means, any other Callable is assignable
|
|
1398
|
-
return true if t.param_types.nil?
|
|
1399
|
-
|
|
1400
|
-
# NOTE: these tests are made in reverse as it is calling the callable that is constrained
|
|
1401
|
-
# (it's lower bound), not its upper bound
|
|
1402
|
-
return false unless assignable?(t2.param_types, t.param_types)
|
|
1403
|
-
# names are ignored, they are just information
|
|
1404
|
-
# Blocks must be compatible
|
|
1405
|
-
this_block_t = t.block_type || @nil_t
|
|
1406
|
-
that_block_t = t2.block_type || @nil_t
|
|
1407
|
-
assignable?(that_block_t, this_block_t)
|
|
1408
|
-
|
|
1409
|
-
end
|
|
1410
|
-
|
|
1411
|
-
# @api private
|
|
1412
|
-
def assignable_PCollectionType(t, t2)
|
|
1413
|
-
size_t = t.size_type || @collection_default_size_t
|
|
1414
|
-
case t2
|
|
1415
|
-
when Types::PCollectionType
|
|
1416
|
-
size_t2 = t2.size_type || @collection_default_size_t
|
|
1417
|
-
assignable_PIntegerType(size_t, size_t2)
|
|
1418
|
-
when Types::PTupleType
|
|
1419
|
-
# compute the tuple's min/max size, and check if that size matches
|
|
1420
|
-
from, to = size_range(t2.size_type)
|
|
1421
|
-
t2s = Types::PIntegerType.new()
|
|
1422
|
-
t2s.from = t2.types.size - 1 + from
|
|
1423
|
-
t2s.to = t2.types.size - 1 + to
|
|
1424
|
-
assignable_PIntegerType(size_t, t2s)
|
|
1425
|
-
when Types::PStructType
|
|
1426
|
-
from = to = t2.elements.size
|
|
1427
|
-
t2s = Types::PIntegerType.new()
|
|
1428
|
-
t2s.from = from
|
|
1429
|
-
t2s.to = to
|
|
1430
|
-
assignable_PIntegerType(size_t, t2s)
|
|
1431
|
-
else
|
|
1432
|
-
false
|
|
1433
|
-
end
|
|
1434
|
-
end
|
|
1435
|
-
|
|
1436
|
-
# @api private
|
|
1437
|
-
def assignable_PType(t, t2)
|
|
1438
|
-
return false unless t2.is_a?(Types::PType)
|
|
1439
|
-
return true if t.type.nil? # wide enough to handle all types
|
|
1440
|
-
return false if t2.type.nil? # wider than t
|
|
1441
|
-
assignable?(t.type, t2.type)
|
|
1442
|
-
end
|
|
1443
|
-
|
|
1444
|
-
# Array is assignable if t2 is an Array and t2's element type is assignable, or if t2 is a Tuple
|
|
1445
|
-
# @api private
|
|
1446
|
-
def assignable_PArrayType(t, t2)
|
|
1447
|
-
if t2.is_a?(Types::PArrayType)
|
|
1448
|
-
return false unless t.element_type.nil? || assignable?(t.element_type, t2.element_type || @t)
|
|
1449
|
-
assignable_PCollectionType(t, t2)
|
|
1450
|
-
|
|
1451
|
-
elsif t2.is_a?(Types::PTupleType)
|
|
1452
|
-
return false unless t.element_type.nil? || t2.types.all? {|t2_element| assignable?(t.element_type, t2_element) }
|
|
1453
|
-
t2_regular = t2.types[0..-2]
|
|
1454
|
-
t2_ranged = t2.types[-1]
|
|
1455
|
-
t2_from, t2_to = size_range(t2.size_type)
|
|
1456
|
-
t2_required = t2_regular.size + t2_from
|
|
1457
|
-
|
|
1458
|
-
t_entry = t.element_type
|
|
1459
|
-
|
|
1460
|
-
# Tuple of anything can not be assigned (unless array is tuple of anything) - this case
|
|
1461
|
-
# was handled at the top of this method.
|
|
1462
|
-
#
|
|
1463
|
-
return false if t_entry.nil?
|
|
1464
|
-
|
|
1465
|
-
# array type may be size constrained
|
|
1466
|
-
size_t = t.size_type || @collection_default_size_t
|
|
1467
|
-
min, max = size_t.range
|
|
1468
|
-
# Tuple with fewer min entries can not be assigned
|
|
1469
|
-
return false if t2_required < min
|
|
1470
|
-
# Tuple with more optionally available entries can not be assigned
|
|
1471
|
-
return false if t2_regular.size + t2_to > max
|
|
1472
|
-
# each tuple type must be assignable to the element type
|
|
1473
|
-
t2_required.times do |index|
|
|
1474
|
-
t2_entry = tuple_entry_at(t2, t2_from, t2_to, index)
|
|
1475
|
-
return false unless assignable?(t_entry, t2_entry)
|
|
1476
|
-
end
|
|
1477
|
-
# ... and so must the last, possibly optional (ranged) type
|
|
1478
|
-
return assignable?(t_entry, t2_ranged)
|
|
1479
|
-
else
|
|
1480
|
-
false
|
|
1481
|
-
end
|
|
1482
|
-
end
|
|
1483
|
-
|
|
1484
|
-
# Hash is assignable if t2 is a Hash and t2's key and element types are assignable
|
|
1485
|
-
# @api private
|
|
1486
|
-
def assignable_PHashType(t, t2)
|
|
1487
|
-
case t2
|
|
1488
|
-
when Types::PHashType
|
|
1489
|
-
return true if (t.size_type.nil? || t.size_type.from == 0) && t2.is_the_empty_hash?
|
|
1490
|
-
return false unless t.key_type.nil? || assignable?(t.key_type, t2.key_type || @t)
|
|
1491
|
-
return false unless t.element_type.nil? || assignable?(t.element_type, t2.element_type || @t)
|
|
1492
|
-
assignable_PCollectionType(t, t2)
|
|
1493
|
-
when Types::PStructType
|
|
1494
|
-
# hash must accept String as key type
|
|
1495
|
-
# hash must accept all value types
|
|
1496
|
-
# hash must accept the size of the struct
|
|
1497
|
-
size_t = t.size_type || @collection_default_size_t
|
|
1498
|
-
min, max = size_t.range
|
|
1499
|
-
struct_size = t2.elements.size
|
|
1500
|
-
key_type = t.key_type
|
|
1501
|
-
element_type = t.element_type
|
|
1502
|
-
( struct_size >= min && struct_size <= max &&
|
|
1503
|
-
t2.elements.all? {|e| (key_type.nil? || instance_of(key_type, e.name)) && (element_type.nil? || assignable?(element_type, e.value_type)) })
|
|
1504
|
-
else
|
|
1505
|
-
false
|
|
1506
|
-
end
|
|
1507
|
-
end
|
|
1508
|
-
|
|
1509
|
-
# @api private
|
|
1510
|
-
def assignable_PCatalogEntryType(t1, t2)
|
|
1511
|
-
t2.is_a?(Types::PCatalogEntryType)
|
|
1512
|
-
end
|
|
1513
|
-
|
|
1514
|
-
# @api private
|
|
1515
|
-
def assignable_PHostClassType(t1, t2)
|
|
1516
|
-
return false unless t2.is_a?(Types::PHostClassType)
|
|
1517
|
-
# Class = Class[name}, Class[name] != Class
|
|
1518
|
-
return true if t1.class_name.nil?
|
|
1519
|
-
# Class[name] = Class[name]
|
|
1520
|
-
return t1.class_name == t2.class_name
|
|
1521
|
-
end
|
|
1522
|
-
|
|
1523
|
-
# @api private
|
|
1524
|
-
def assignable_PResourceType(t1, t2)
|
|
1525
|
-
return false unless t2.is_a?(Types::PResourceType)
|
|
1526
|
-
return true if t1.type_name.nil?
|
|
1527
|
-
return false if t1.type_name != t2.type_name
|
|
1528
|
-
return true if t1.title.nil?
|
|
1529
|
-
return t1.title == t2.title
|
|
1530
|
-
end
|
|
1531
|
-
|
|
1532
|
-
# Data is assignable by other Data and by Array[Data] and Hash[Scalar, Data]
|
|
1533
|
-
# @api private
|
|
1534
|
-
def assignable_PDataType(t, t2)
|
|
1535
|
-
# We cannot put the NotUndefType[Data] in the @data_variant_t since that causes an endless recursion
|
|
1536
|
-
case t2
|
|
1537
|
-
when Types::PDataType
|
|
1538
|
-
true
|
|
1539
|
-
when Types::PNotUndefType
|
|
1540
|
-
assignable?(t, t2.type || @t)
|
|
1541
|
-
else
|
|
1542
|
-
assignable?(@data_variant_t, t2)
|
|
1543
|
-
end
|
|
1544
|
-
end
|
|
1545
|
-
|
|
1546
|
-
# Assignable if t2's has the same runtime and the runtime name resolves to
|
|
1547
|
-
# a class that is the same or subclass of t1's resolved runtime type name
|
|
1548
|
-
# @api private
|
|
1549
|
-
def assignable_PRuntimeType(t1, t2)
|
|
1550
|
-
return false unless t2.is_a?(Types::PRuntimeType)
|
|
1551
|
-
return false unless t1.runtime == t2.runtime
|
|
1552
|
-
return true if t1.runtime_type_name.nil? # t1 is wider
|
|
1553
|
-
return false if t2.runtime_type_name.nil? # t1 not nil, so t2 can not be wider
|
|
1554
|
-
|
|
1555
|
-
# NOTE: This only supports Ruby, must change when/if the set of runtimes is expanded
|
|
1556
|
-
c1 = class_from_string(t1.runtime_type_name)
|
|
1557
|
-
c2 = class_from_string(t2.runtime_type_name)
|
|
1558
|
-
return false unless c1.is_a?(Class) && c2.is_a?(Class)
|
|
1559
|
-
!!(c2 <= c1)
|
|
1560
|
-
end
|
|
1561
|
-
|
|
1562
|
-
# @api private
|
|
1563
|
-
def debug_string_Object(t)
|
|
1564
|
-
string(t)
|
|
1565
|
-
end
|
|
1566
|
-
|
|
1567
|
-
# @api private
|
|
1568
|
-
def string_PType(t)
|
|
1569
|
-
if t.type.nil?
|
|
1570
|
-
"Type"
|
|
1571
|
-
else
|
|
1572
|
-
"Type[#{string(t.type)}]"
|
|
1573
|
-
end
|
|
1574
|
-
end
|
|
1575
|
-
|
|
1576
|
-
# @api private
|
|
1577
|
-
def string_NilClass(t) ; '?' ; end
|
|
1578
|
-
|
|
1579
|
-
# @api private
|
|
1580
|
-
def string_String(t) ; t ; end
|
|
1581
|
-
|
|
1582
|
-
# @api private
|
|
1583
|
-
def string_Symbol(t) ; t.to_s ; end
|
|
1584
|
-
|
|
1585
|
-
def string_PAnyType(t) ; "Any" ; end
|
|
1586
|
-
|
|
1587
|
-
# @api private
|
|
1588
|
-
def string_PUndefType(t) ; 'Undef' ; end
|
|
1589
|
-
|
|
1590
|
-
# @api private
|
|
1591
|
-
def string_PDefaultType(t) ; 'Default' ; end
|
|
1592
|
-
|
|
1593
|
-
# @api private
|
|
1594
|
-
def string_PBooleanType(t) ; "Boolean" ; end
|
|
1595
|
-
|
|
1596
|
-
# @api private
|
|
1597
|
-
def string_PScalarType(t) ; "Scalar" ; end
|
|
1598
|
-
|
|
1599
|
-
# @api private
|
|
1600
|
-
def string_PDataType(t) ; "Data" ; end
|
|
1601
|
-
|
|
1602
|
-
# @api private
|
|
1603
|
-
def string_PNumericType(t) ; "Numeric" ; end
|
|
1604
|
-
|
|
1605
|
-
# @api private
|
|
1606
|
-
def string_PIntegerType(t)
|
|
1607
|
-
range = range_array_part(t)
|
|
1608
|
-
unless range.empty?
|
|
1609
|
-
"Integer[#{range.join(', ')}]"
|
|
1610
|
-
else
|
|
1611
|
-
"Integer"
|
|
1612
|
-
end
|
|
1613
|
-
end
|
|
1614
|
-
|
|
1615
|
-
# Produces a string from an Integer range type that is used inside other type strings
|
|
1616
|
-
# @api private
|
|
1617
|
-
def range_array_part(t)
|
|
1618
|
-
return [] if t.nil? || (t.from.nil? && t.to.nil?)
|
|
1619
|
-
[t.from.nil? ? 'default' : t.from , t.to.nil? ? 'default' : t.to ]
|
|
1620
|
-
end
|
|
1621
|
-
|
|
1622
|
-
# @api private
|
|
1623
|
-
def string_PFloatType(t)
|
|
1624
|
-
range = range_array_part(t)
|
|
1625
|
-
unless range.empty?
|
|
1626
|
-
"Float[#{range.join(', ')}]"
|
|
1627
|
-
else
|
|
1628
|
-
"Float"
|
|
1629
|
-
end
|
|
1630
|
-
end
|
|
1631
|
-
|
|
1632
|
-
# @api private
|
|
1633
|
-
def string_PRegexpType(t)
|
|
1634
|
-
t.pattern.nil? ? "Regexp" : "Regexp[#{t.regexp.inspect}]"
|
|
1635
|
-
end
|
|
1636
|
-
|
|
1637
|
-
# @api private
|
|
1638
|
-
def string_PStringType(t)
|
|
1639
|
-
# skip values in regular output - see debug_string
|
|
1640
|
-
range = range_array_part(t.size_type)
|
|
1641
|
-
unless range.empty?
|
|
1642
|
-
"String[#{range.join(', ')}]"
|
|
1643
|
-
else
|
|
1644
|
-
"String"
|
|
1645
|
-
end
|
|
1646
|
-
end
|
|
1647
|
-
|
|
1648
|
-
# @api private
|
|
1649
|
-
def debug_string_PStringType(t)
|
|
1650
|
-
range = range_array_part(t.size_type)
|
|
1651
|
-
range_part = range.empty? ? '' : '[' << range.join(' ,') << '], '
|
|
1652
|
-
"String[" << range_part << (t.values.map {|s| "'#{s}'" }).join(', ') << ']'
|
|
1653
|
-
end
|
|
1654
|
-
|
|
1655
|
-
# @api private
|
|
1656
|
-
def string_PEnumType(t)
|
|
1657
|
-
return "Enum" if t.values.empty?
|
|
1658
|
-
"Enum[" << t.values.map {|s| "'#{s}'" }.join(', ') << ']'
|
|
1659
|
-
end
|
|
1660
|
-
|
|
1661
|
-
# @api private
|
|
1662
|
-
def string_PVariantType(t)
|
|
1663
|
-
return "Variant" if t.types.empty?
|
|
1664
|
-
"Variant[" << t.types.map {|t2| string(t2) }.join(', ') << ']'
|
|
1665
|
-
end
|
|
1666
|
-
|
|
1667
|
-
# @api private
|
|
1668
|
-
def string_PTupleType(t)
|
|
1669
|
-
range = range_array_part(t.size_type)
|
|
1670
|
-
return "Tuple" if t.types.empty?
|
|
1671
|
-
s = "Tuple[" << t.types.map {|t2| string(t2) }.join(', ')
|
|
1672
|
-
unless range.empty?
|
|
1673
|
-
s << ", " << range.join(', ')
|
|
1674
|
-
end
|
|
1675
|
-
s << "]"
|
|
1676
|
-
s
|
|
1677
|
-
end
|
|
1678
|
-
|
|
1679
|
-
# @api private
|
|
1680
|
-
def string_PCallableType(t)
|
|
1681
|
-
# generic
|
|
1682
|
-
return "Callable" if t.param_types.nil?
|
|
1683
|
-
|
|
1684
|
-
if t.param_types.types.empty?
|
|
1685
|
-
range = [0, 0]
|
|
1686
|
-
else
|
|
1687
|
-
range = range_array_part(t.param_types.size_type)
|
|
1688
|
-
end
|
|
1689
|
-
# translate to string, and skip Unit types
|
|
1690
|
-
types = t.param_types.types.map {|t2| string(t2) unless t2.class == Types::PUnitType }.compact
|
|
1691
|
-
|
|
1692
|
-
s = "Callable[" << types.join(', ')
|
|
1693
|
-
unless range.empty?
|
|
1694
|
-
(s << ', ') unless types.empty?
|
|
1695
|
-
s << range.join(', ')
|
|
1696
|
-
end
|
|
1697
|
-
# Add block T last (after min, max) if present)
|
|
1698
|
-
#
|
|
1699
|
-
unless t.block_type.nil?
|
|
1700
|
-
(s << ', ') unless types.empty? && range.empty?
|
|
1701
|
-
s << string(t.block_type)
|
|
1702
|
-
end
|
|
1703
|
-
s << "]"
|
|
1704
|
-
s
|
|
1705
|
-
end
|
|
1706
|
-
|
|
1707
|
-
# @api private
|
|
1708
|
-
def string_PStructType(t)
|
|
1709
|
-
return "Struct" if t.elements.empty?
|
|
1710
|
-
"Struct[{" << t.elements.map {|element| string(element) }.join(', ') << "}]"
|
|
1711
|
-
end
|
|
1712
|
-
|
|
1713
|
-
def string_PStructElement(t)
|
|
1714
|
-
k = t.key_type
|
|
1715
|
-
value_optional = assignable?(t.value_type, @nil_t)
|
|
1716
|
-
key_string =
|
|
1717
|
-
if k.is_a?(Types::POptionalType)
|
|
1718
|
-
# Output as literal String
|
|
1719
|
-
value_optional ? "'#{t.name}'" : string(k)
|
|
1720
|
-
else
|
|
1721
|
-
value_optional ? "NotUndef['#{t.name}']" : "'#{t.name}'"
|
|
1722
|
-
end
|
|
1723
|
-
"#{key_string}=>#{string(t.value_type)}"
|
|
1724
|
-
end
|
|
1725
|
-
|
|
1726
|
-
# @api private
|
|
1727
|
-
def string_PPatternType(t)
|
|
1728
|
-
return "Pattern" if t.patterns.empty?
|
|
1729
|
-
"Pattern[" << t.patterns.map {|s| "#{s.regexp.inspect}" }.join(', ') << ']'
|
|
1730
|
-
end
|
|
1731
|
-
|
|
1732
|
-
# @api private
|
|
1733
|
-
def string_PCollectionType(t)
|
|
1734
|
-
range = range_array_part(t.size_type)
|
|
1735
|
-
unless range.empty?
|
|
1736
|
-
"Collection[#{range.join(', ')}]"
|
|
1737
|
-
else
|
|
1738
|
-
"Collection"
|
|
1739
|
-
end
|
|
1740
|
-
end
|
|
1741
|
-
|
|
1742
|
-
# @api private
|
|
1743
|
-
def string_PUnitType(t)
|
|
1744
|
-
"Unit"
|
|
1745
|
-
end
|
|
1746
|
-
|
|
1747
|
-
# @api private
|
|
1748
|
-
def string_PRuntimeType(t) ; "Runtime[#{string(t.runtime)}, #{string(t.runtime_type_name)}]" ; end
|
|
1749
|
-
|
|
1750
|
-
# @api private
|
|
1751
|
-
def string_PArrayType(t)
|
|
1752
|
-
parts = [string(t.element_type)] + range_array_part(t.size_type)
|
|
1753
|
-
"Array[#{parts.join(', ')}]"
|
|
1754
|
-
end
|
|
1755
|
-
|
|
1756
|
-
# @api private
|
|
1757
|
-
def string_PHashType(t)
|
|
1758
|
-
parts = [string(t.key_type), string(t.element_type)] + range_array_part(t.size_type)
|
|
1759
|
-
"Hash[#{parts.join(', ')}]"
|
|
1760
|
-
end
|
|
1761
|
-
|
|
1762
|
-
# @api private
|
|
1763
|
-
def string_PCatalogEntryType(t)
|
|
1764
|
-
"CatalogEntry"
|
|
1765
|
-
end
|
|
1766
|
-
|
|
1767
|
-
# @api private
|
|
1768
|
-
def string_PHostClassType(t)
|
|
1769
|
-
if t.class_name
|
|
1770
|
-
"Class[#{t.class_name}]"
|
|
1771
|
-
else
|
|
1772
|
-
"Class"
|
|
1773
|
-
end
|
|
1774
|
-
end
|
|
1775
|
-
|
|
1776
|
-
# @api private
|
|
1777
|
-
def string_PResourceType(t)
|
|
1778
|
-
if t.type_name
|
|
1779
|
-
if t.title
|
|
1780
|
-
"#{capitalize_segments(t.type_name)}['#{t.title}']"
|
|
1781
|
-
else
|
|
1782
|
-
capitalize_segments(t.type_name)
|
|
1783
|
-
end
|
|
1784
|
-
else
|
|
1785
|
-
"Resource"
|
|
1786
|
-
end
|
|
1787
|
-
end
|
|
1788
|
-
|
|
1789
|
-
# @api private
|
|
1790
|
-
def string_PNotUndefType(t)
|
|
1791
|
-
contained_type = t.type
|
|
1792
|
-
if contained_type.nil? || contained_type.class == Puppet::Pops::Types::PAnyType
|
|
1793
|
-
'NotUndef'
|
|
1794
|
-
else
|
|
1795
|
-
if contained_type.is_a?(Puppet::Pops::Types::PStringType) && contained_type.values.size == 1
|
|
1796
|
-
"NotUndef['#{contained_type.values[0]}']"
|
|
1797
|
-
else
|
|
1798
|
-
"NotUndef[#{string(contained_type)}]"
|
|
1799
|
-
end
|
|
1800
|
-
end
|
|
1801
|
-
end
|
|
1802
|
-
|
|
1803
|
-
def string_POptionalType(t)
|
|
1804
|
-
optional_type = t.optional_type
|
|
1805
|
-
if optional_type.nil?
|
|
1806
|
-
"Optional"
|
|
1807
|
-
else
|
|
1808
|
-
if optional_type.is_a?(Puppet::Pops::Types::PStringType) && optional_type.values.size == 1
|
|
1809
|
-
"Optional['#{optional_type.values[0]}']"
|
|
1810
|
-
else
|
|
1811
|
-
"Optional[#{string(optional_type)}]"
|
|
1812
|
-
end
|
|
1813
|
-
end
|
|
1814
|
-
end
|
|
1815
|
-
|
|
1816
|
-
# Catches all non enumerable types
|
|
1817
|
-
# @api private
|
|
1818
|
-
def enumerable_Object(o)
|
|
1819
|
-
nil
|
|
1820
|
-
end
|
|
1821
|
-
|
|
1822
|
-
# @api private
|
|
1823
|
-
def enumerable_PIntegerType(t)
|
|
1824
|
-
# Not enumerable if representing an infinite range
|
|
1825
|
-
return nil if t.size == Float::INFINITY
|
|
1826
|
-
t
|
|
1827
|
-
end
|
|
1828
|
-
|
|
1829
|
-
def self.copy_as_tuple(t)
|
|
1830
|
-
case t
|
|
1831
|
-
when Types::PTupleType
|
|
1832
|
-
t.copy
|
|
1833
|
-
when Types::PArrayType
|
|
1834
|
-
# transform array to tuple
|
|
1835
|
-
result = Types::PTupleType.new
|
|
1836
|
-
result.addTypes(t.element_type.copy)
|
|
1837
|
-
result.size_type = t.size_type.nil? ? nil : t.size_type.copy
|
|
1838
|
-
result
|
|
1839
|
-
else
|
|
1840
|
-
raise ArgumentError, "Internal Error: Only Array and Tuple can be given to copy_as_tuple"
|
|
1841
|
-
end
|
|
1842
|
-
end
|
|
1843
|
-
|
|
1844
767
|
# Debugging to_s to reduce the amount of output
|
|
1845
768
|
def to_s
|
|
1846
769
|
'[a TypeCalculator]'
|
|
@@ -1848,32 +771,28 @@ class Puppet::Pops::Types::TypeCalculator
|
|
|
1848
771
|
|
|
1849
772
|
private
|
|
1850
773
|
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
s.split(NAME_SEGMENT_SEPARATOR).map(&:capitalize).join(NAME_SEGMENT_SEPARATOR)
|
|
774
|
+
def common_rich_data?(t1, t2)
|
|
775
|
+
d = TypeFactory.rich_data
|
|
776
|
+
d.assignable?(t1) && d.assignable?(t2)
|
|
1855
777
|
end
|
|
1856
778
|
|
|
1857
|
-
def
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
memo.const_get(name_segment)
|
|
1861
|
-
end
|
|
1862
|
-
rescue NameError
|
|
1863
|
-
return nil
|
|
1864
|
-
end
|
|
779
|
+
def common_data?(t1, t2)
|
|
780
|
+
d = TypeFactory.data
|
|
781
|
+
d.assignable?(t1) && d.assignable?(t2)
|
|
1865
782
|
end
|
|
1866
783
|
|
|
1867
|
-
def
|
|
1868
|
-
assignable?(
|
|
784
|
+
def common_scalar_data?(t1, t2)
|
|
785
|
+
PScalarDataType::DEFAULT.assignable?(t1) && PScalarDataType::DEFAULT.assignable?(t2)
|
|
1869
786
|
end
|
|
1870
787
|
|
|
1871
788
|
def common_scalar?(t1, t2)
|
|
1872
|
-
assignable?(
|
|
789
|
+
PScalarType::DEFAULT.assignable?(t1) && PScalarType::DEFAULT.assignable?(t2)
|
|
1873
790
|
end
|
|
1874
791
|
|
|
1875
792
|
def common_numeric?(t1, t2)
|
|
1876
|
-
assignable?(
|
|
793
|
+
PNumericType::DEFAULT.assignable?(t1) && PNumericType::DEFAULT.assignable?(t2)
|
|
1877
794
|
end
|
|
1878
795
|
|
|
1879
796
|
end
|
|
797
|
+
end
|
|
798
|
+
end
|