puppet 4.4.0 → 4.5.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/CONTRIBUTING.md +5 -5
- data/Gemfile +2 -2
- data/LICENSE +2 -2
- data/README.md +5 -0
- data/conf/puppet.conf +1 -1
- data/ext/project_data.yaml +2 -0
- data/ext/redhat/puppet.spec.erb +0 -9
- data/ext/upload_facts.rb +1 -1
- data/lib/hiera_puppet.rb +6 -14
- data/lib/puppet/application/agent.rb +3 -4
- data/lib/puppet/application/apply.rb +1 -1
- data/lib/puppet/application/ca.rb +1 -0
- data/lib/puppet/application/cert.rb +1 -1
- data/lib/puppet/application/filebucket.rb +1 -1
- data/lib/puppet/application/inspect.rb +2 -2
- data/lib/puppet/application/lookup.rb +8 -20
- data/lib/puppet/application/master.rb +1 -1
- data/lib/puppet/application/resource.rb +1 -5
- data/lib/puppet/data_providers/hiera_config.rb +2 -4
- data/lib/puppet/data_providers/hiera_interpolate.rb +12 -105
- data/lib/puppet/data_providers/json_data_provider_factory.rb +1 -8
- data/lib/puppet/data_providers/yaml_data_provider_factory.rb +2 -8
- data/lib/puppet/defaults.rb +104 -25
- data/lib/puppet/face/config.rb +1 -1
- data/lib/puppet/face/help/man.erb +1 -1
- data/lib/puppet/file_system/uniquefile.rb +2 -2
- data/lib/puppet/file_system/windows.rb +1 -15
- data/lib/puppet/functions/assert_type.rb +1 -1
- data/lib/puppet/functions/dig.rb +39 -0
- data/lib/puppet/functions/hiera_include.rb +2 -2
- data/lib/puppet/functions/inline_epp.rb +1 -1
- data/lib/puppet/functions/lest.rb +53 -0
- data/lib/puppet/functions/lookup.rb +40 -30
- data/lib/puppet/functions/new.rb +502 -0
- data/lib/puppet/functions/regsubst.rb +11 -10
- data/lib/puppet/functions/then.rb +74 -0
- data/lib/puppet/functions/type.rb +4 -4
- data/lib/puppet/functions/with.rb +1 -1
- data/lib/puppet/functions.rb +69 -0
- data/lib/puppet/indirector/catalog/compiler.rb +4 -1
- data/lib/puppet/indirector/msgpack.rb +1 -1
- data/lib/puppet/indirector/resource_type/parser.rb +5 -0
- data/lib/puppet/indirector/rest.rb +5 -1
- data/lib/puppet/indirector/terminus.rb +4 -4
- data/lib/puppet/loaders.rb +2 -0
- data/lib/puppet/metatype/manager.rb +19 -2
- data/lib/puppet/module.rb +3 -3
- data/lib/puppet/module_tool/applications/application.rb +1 -1
- data/lib/puppet/module_tool/applications/builder.rb +2 -2
- data/lib/puppet/module_tool/skeleton/templates/generator/Gemfile +6 -2
- data/lib/puppet/module_tool/skeleton/templates/generator/Rakefile +19 -4
- data/lib/puppet/module_tool/skeleton/templates/generator/{tests → examples}/init.pp.erb +1 -1
- data/lib/puppet/module_tool/skeleton/templates/generator/spec/classes/init_spec.rb.erb +0 -1
- data/lib/puppet/network/auth_config_parser.rb +1 -1
- data/lib/puppet/network/http/api/indirected_routes.rb +0 -2
- data/lib/puppet/network/http/api/master/v3/environment.rb +6 -2
- data/lib/puppet/network/http/rack/rest.rb +10 -1
- data/lib/puppet/parser/ast/pops_bridge.rb +20 -3
- data/lib/puppet/parser/compiler/catalog_validator/relationship_validator.rb +24 -2
- data/lib/puppet/parser/e4_parser_adapter.rb +13 -12
- data/lib/puppet/parser/environment_compiler.rb +2 -2
- data/lib/puppet/parser/functions/hiera_include.rb +2 -2
- data/lib/puppet/parser/functions/inline_epp.rb +1 -1
- data/lib/puppet/parser/functions/lookup.rb +0 -3
- data/lib/puppet/parser/resource.rb +14 -5
- data/lib/puppet/parser/scope.rb +18 -15
- data/lib/puppet/plugins/data_providers/data_provider.rb +19 -8
- data/lib/puppet/pops/adapters.rb +5 -1
- data/lib/puppet/pops/evaluator/access_operator.rb +77 -15
- data/lib/puppet/pops/evaluator/closure.rb +10 -5
- data/lib/puppet/pops/evaluator/compare_operator.rb +34 -4
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +75 -22
- data/lib/puppet/pops/evaluator/literal_evaluator.rb +7 -6
- data/lib/puppet/pops/evaluator/runtime3_converter.rb +13 -1
- data/lib/puppet/pops/evaluator/runtime3_support.rb +14 -4
- data/lib/puppet/pops/functions/dispatcher.rb +1 -1
- data/lib/puppet/pops/issues.rb +18 -2
- data/lib/puppet/pops/loader/base_loader.rb +48 -7
- data/lib/puppet/pops/loader/dependency_loader.rb +27 -2
- data/lib/puppet/pops/loader/loader.rb +12 -0
- data/lib/puppet/pops/loader/predefined_loader.rb +29 -0
- data/lib/puppet/pops/loader/runtime3_type_loader.rb +57 -0
- data/lib/puppet/pops/loader/static_loader.rb +92 -5
- data/lib/puppet/pops/loader/type_definition_instantiator.rb +25 -3
- data/lib/puppet/pops/loaders.rb +84 -14
- data/lib/puppet/pops/lookup/explainer.rb +38 -1
- data/lib/puppet/pops/lookup/interpolation.rb +115 -0
- data/lib/puppet/pops/lookup/sub_lookup.rb +86 -0
- data/lib/puppet/pops/merge_strategy.rb +0 -10
- data/lib/puppet/pops/model/ast_transformer.rb +8 -1
- data/lib/puppet/pops/model/factory.rb +31 -8
- data/lib/puppet/pops/model/model.rb +8 -0
- data/lib/puppet/pops/model/model_label_provider.rb +1 -0
- data/lib/puppet/pops/model/model_meta.rb +7 -1
- data/lib/puppet/pops/model/model_tree_dumper.rb +4 -0
- data/lib/puppet/pops/parser/egrammar.ra +24 -7
- data/lib/puppet/pops/parser/eparser.rb +863 -798
- data/lib/puppet/pops/parser/evaluating_parser.rb +4 -0
- data/lib/puppet/pops/parser/locator.rb +8 -4
- data/lib/puppet/pops/pcore.rb +30 -0
- data/lib/puppet/pops/types/class_loader.rb +2 -4
- data/lib/puppet/pops/types/implementation_registry.rb +146 -0
- data/lib/puppet/pops/types/iterable.rb +4 -4
- data/lib/puppet/pops/types/p_object_type.rb +846 -0
- data/lib/puppet/pops/types/p_runtime_type.rb +102 -0
- data/lib/puppet/pops/types/p_sem_ver_range_type.rb +164 -0
- data/lib/puppet/pops/types/p_sem_ver_type.rb +113 -0
- data/lib/puppet/pops/types/puppet_object.rb +21 -0
- data/lib/puppet/pops/types/recursion_guard.rb +10 -0
- data/lib/puppet/pops/types/ruby_generator.rb +258 -0
- data/lib/puppet/pops/types/string_converter.rb +922 -0
- data/lib/puppet/pops/types/type_asserter.rb +2 -2
- data/lib/puppet/pops/types/type_calculator.rb +30 -6
- data/lib/puppet/pops/types/type_conversion_error.rb +15 -0
- data/lib/puppet/pops/types/type_factory.rb +49 -16
- data/lib/puppet/pops/types/type_formatter.rb +341 -106
- data/lib/puppet/pops/types/type_mismatch_describer.rb +132 -41
- data/lib/puppet/pops/types/type_parser.rb +205 -197
- data/lib/puppet/pops/types/types.rb +722 -202
- data/lib/puppet/pops/validation/checker4_0.rb +66 -4
- data/lib/puppet/pops/validation/validator_factory_4_0.rb +1 -0
- data/lib/puppet/pops/validation.rb +1 -1
- data/lib/puppet/pops/visitor.rb +3 -1
- data/lib/puppet/pops.rb +6 -0
- data/lib/puppet/property.rb +1 -1
- data/lib/puppet/provider/augeas/augeas.rb +1 -1
- data/lib/puppet/provider/package/pip.rb +64 -20
- data/lib/puppet/provider/package/pip3.rb +2 -0
- data/lib/puppet/provider/package/puppet_gem.rb +0 -0
- data/lib/puppet/provider/package/rpm.rb +112 -0
- data/lib/puppet/provider/package/yum.rb +7 -68
- data/lib/puppet/provider/service/daemontools.rb +3 -3
- data/lib/puppet/provider/service/init.rb +4 -2
- data/lib/puppet/provider/service/runit.rb +3 -3
- data/lib/puppet/provider/service/smf.rb +6 -3
- data/lib/puppet/provider/service/systemd.rb +59 -73
- data/lib/puppet/provider/user/user_role_add.rb +3 -1
- data/lib/puppet/reference/providers.rb +2 -3
- data/lib/puppet/resource/catalog.rb +34 -30
- data/lib/puppet/resource/type_collection.rb +23 -8
- data/lib/puppet/resource.rb +54 -37
- data/lib/puppet/settings/base_setting.rb +9 -3
- data/lib/puppet/settings/symbolic_enum_setting.rb +17 -0
- data/lib/puppet/settings.rb +5 -3
- data/lib/puppet/ssl/oids.rb +24 -2
- data/lib/puppet/test/test_helper.rb +0 -1
- data/lib/puppet/transaction.rb +0 -24
- data/lib/puppet/type/exec.rb +17 -17
- data/lib/puppet/type/file/content.rb +8 -8
- data/lib/puppet/type/file/ensure.rb +4 -4
- data/lib/puppet/type/file/source.rb +4 -4
- data/lib/puppet/type/file/target.rb +2 -2
- data/lib/puppet/type/file.rb +15 -5
- data/lib/puppet/type/filebucket.rb +1 -1
- data/lib/puppet/type/mount.rb +18 -1
- data/lib/puppet/type/package.rb +3 -3
- data/lib/puppet/type/schedule.rb +5 -5
- data/lib/puppet/type/service.rb +15 -0
- data/lib/puppet/type/sshkey.rb +5 -3
- data/lib/puppet/type/stage.rb +1 -1
- data/lib/puppet/type/tidy.rb +3 -3
- data/lib/puppet/type/zone.rb +5 -5
- data/lib/puppet/type.rb +13 -7
- data/lib/puppet/util/feature.rb +1 -1
- data/lib/puppet/util/monkey_patches.rb +18 -5
- data/lib/puppet/util/network_device/cisco/device.rb +16 -6
- data/lib/puppet/util/network_device/cisco/interface.rb +5 -6
- data/lib/puppet/util/plist.rb +3 -3
- data/lib/puppet/util/windows/file.rb +40 -10
- data/lib/puppet/util/windows.rb +1 -0
- data/lib/puppet/version.rb +1 -1
- data/spec/fixtures/unit/application/environments/production/data/common.yaml +13 -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/hiera.yaml +5 -1
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/manifests/site.pp +2 -2
- 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/functions/lookup/environments/production/modules/empty_key_json/data/empty_key.json +1 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/empty_key_json/hiera.yaml +5 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/empty_key_json/manifests/init.pp +2 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/empty_key_json/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/empty_key_yaml/data/empty_key.yaml +1 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/empty_key_yaml/hiera.yaml +5 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/empty_key_yaml/manifests/init.pp +2 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/empty_key_yaml/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/empty_yaml/data/empty.yaml +1 -0
- 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/lib/puppet/type/usee_type.rb +5 -0
- data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/modules/user/manifests/init.pp +6 -0
- data/spec/fixtures/unit/pops/parser/lexer/subclass_name_duplication.pp +0 -0
- data/spec/fixtures/unit/provider/service/smf/svcs.out +4 -3
- data/spec/integration/agent/logging_spec.rb +0 -0
- data/spec/integration/application/apply_spec.rb +0 -0
- data/spec/integration/application/doc_spec.rb +0 -0
- data/spec/integration/configurer_spec.rb +0 -0
- data/spec/integration/data_binding_spec.rb +0 -34
- data/spec/integration/defaults_spec.rb +0 -0
- data/spec/integration/faces/ca_spec.rb +0 -0
- data/spec/integration/faces/documentation_spec.rb +0 -0
- data/spec/integration/file_serving/fileset_spec.rb +0 -0
- data/spec/integration/file_serving/terminus_helper_spec.rb +0 -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/file_content/file_server_spec.rb +0 -0
- data/spec/integration/indirector/file_metadata/file_server_spec.rb +0 -0
- data/spec/integration/indirector/node/ldap_spec.rb +0 -0
- data/spec/integration/module_tool/tar/mini_spec.rb +27 -27
- data/spec/integration/network/formats_spec.rb +0 -0
- data/spec/integration/node/environment_spec.rb +0 -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 +14 -2
- data/spec/integration/parser/collection_spec.rb +0 -0
- data/spec/integration/parser/compiler_spec.rb +94 -3
- data/spec/integration/parser/functions/require_spec.rb +0 -0
- data/spec/integration/parser/parameter_defaults_spec.rb +19 -1
- data/spec/integration/parser/resource_expressions_spec.rb +1 -1
- data/spec/integration/provider/mailalias/aliases_spec.rb +0 -0
- data/spec/integration/provider/mount_spec.rb +0 -0
- data/spec/integration/provider/service/init_spec.rb +0 -0
- data/spec/integration/provider/ssh_authorized_key_spec.rb +0 -0
- data/spec/integration/reference/providers_spec.rb +0 -0
- data/spec/integration/reports_spec.rb +0 -0
- data/spec/integration/resource/catalog_spec.rb +0 -0
- data/spec/integration/resource/type_collection_spec.rb +8 -0
- data/spec/integration/ssl/certificate_authority_spec.rb +0 -0
- data/spec/integration/ssl/certificate_request_spec.rb +0 -0
- data/spec/integration/ssl/certificate_revocation_list_spec.rb +0 -0
- data/spec/integration/ssl/host_spec.rb +0 -0
- data/spec/integration/transaction/report_spec.rb +0 -0
- data/spec/integration/transaction_spec.rb +0 -0
- data/spec/integration/type/exec_spec.rb +0 -0
- data/spec/integration/type/file_spec.rb +0 -0
- data/spec/integration/type/package_spec.rb +0 -0
- data/spec/integration/type/tidy_spec.rb +0 -0
- data/spec/integration/type_spec.rb +0 -0
- data/spec/integration/util/autoload_spec.rb +0 -0
- data/spec/integration/util/rdoc/parser_spec.rb +0 -0
- data/spec/integration/util/settings_spec.rb +26 -0
- data/spec/integration/util/windows/registry_spec.rb +0 -0
- data/spec/integration/util/windows/security_spec.rb +0 -0
- data/spec/integration/util/windows/user_spec.rb +0 -0
- data/spec/integration/util_spec.rb +0 -0
- data/spec/lib/puppet/face/1.0.0/huzzah.rb +0 -0
- data/spec/lib/puppet/face/basetest.rb +0 -0
- data/spec/lib/puppet/face/huzzah.rb +0 -0
- data/spec/lib/puppet_spec/compiler.rb +11 -4
- data/spec/lib/puppet_spec/files.rb +0 -0
- data/spec/lib/puppet_spec/fixtures.rb +0 -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/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 +4 -0
- data/spec/spec_helper.rb +0 -0
- data/spec/unit/agent/locker_spec.rb +0 -0
- data/spec/unit/agent_spec.rb +0 -0
- data/spec/unit/application/agent_spec.rb +0 -0
- data/spec/unit/application/apply_spec.rb +0 -0
- data/spec/unit/application/cert_spec.rb +0 -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 +0 -0
- data/spec/unit/application/device_spec.rb +0 -0
- data/spec/unit/application/doc_spec.rb +0 -0
- data/spec/unit/application/face_base_spec.rb +0 -0
- data/spec/unit/application/facts_spec.rb +0 -0
- data/spec/unit/application/filebucket_spec.rb +0 -0
- data/spec/unit/application/indirection_base_spec.rb +0 -0
- data/spec/unit/application/inspect_spec.rb +19 -8
- data/spec/unit/application/lookup_spec.rb +92 -10
- data/spec/unit/application/master_spec.rb +0 -0
- data/spec/unit/application/resource_spec.rb +0 -0
- data/spec/unit/application_spec.rb +0 -0
- data/spec/unit/appmgmt_spec.rb +44 -35
- data/spec/unit/capability_spec.rb +33 -53
- data/spec/unit/configurer/downloader_factory_spec.rb +0 -0
- data/spec/unit/configurer/downloader_spec.rb +0 -0
- data/spec/unit/configurer/fact_handler_spec.rb +0 -0
- data/spec/unit/configurer/plugin_handler_spec.rb +0 -0
- data/spec/unit/configurer_spec.rb +0 -0
- 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/daemon_spec.rb +0 -0
- data/spec/unit/data_providers/function_data_provider_spec.rb +19 -1
- data/spec/unit/data_providers/hiera_data_provider_spec.rb +2 -2
- data/spec/unit/defaults_spec.rb +18 -0
- data/spec/unit/external/pson_spec.rb +0 -0
- data/spec/unit/face/catalog_spec.rb +0 -0
- data/spec/unit/face/certificate_spec.rb +0 -0
- data/spec/unit/face/config_spec.rb +0 -0
- data/spec/unit/face/facts_spec.rb +0 -0
- data/spec/unit/face/file_spec.rb +0 -0
- data/spec/unit/face/help_spec.rb +0 -0
- data/spec/unit/face/node_spec.rb +0 -0
- data/spec/unit/face/plugin_spec.rb +0 -0
- data/spec/unit/face_spec.rb +0 -0
- data/spec/unit/file_bucket/dipper_spec.rb +0 -0
- data/spec/unit/file_bucket/file_spec.rb +0 -0
- data/spec/unit/file_serving/base_spec.rb +0 -0
- data/spec/unit/file_serving/configuration/parser_spec.rb +0 -0
- data/spec/unit/file_serving/configuration_spec.rb +0 -0
- 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/metadata_spec.rb +0 -0
- 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 +0 -0
- data/spec/unit/file_system/uniquefile_spec.rb +20 -0
- data/spec/unit/file_system_spec.rb +61 -0
- data/spec/unit/functions/assert_type_spec.rb +8 -0
- data/spec/unit/functions/defined_spec.rb +0 -0
- data/spec/unit/functions/dig_spec.rb +58 -0
- data/spec/unit/functions/hiera_spec.rb +0 -0
- data/spec/unit/functions/lest_spec.rb +34 -0
- data/spec/unit/functions/lookup_spec.rb +109 -3
- data/spec/unit/functions/new_spec.rb +543 -0
- data/spec/unit/functions/regsubst_spec.rb +8 -0
- data/spec/unit/functions/split_spec.rb +0 -0
- data/spec/unit/functions/then_spec.rb +40 -0
- data/spec/unit/functions/versioncmp_spec.rb +0 -0
- data/spec/unit/functions4_spec.rb +78 -10
- data/spec/unit/graph/relationship_graph_spec.rb +0 -0
- data/spec/unit/graph/simple_graph_spec.rb +0 -0
- data/spec/unit/hiera_puppet_spec.rb +49 -8
- data/spec/unit/indirector/catalog/compiler_spec.rb +7 -0
- data/spec/unit/indirector/catalog/json_spec.rb +0 -0
- 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/static_compiler_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/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 +0 -0
- data/spec/unit/indirector/facts/facter_spec.rb +0 -0
- 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 +0 -0
- 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 +0 -0
- data/spec/unit/indirector/indirection_spec.rb +0 -0
- data/spec/unit/indirector/json_spec.rb +0 -0
- 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 +0 -0
- 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 +0 -0
- data/spec/unit/indirector/node/ldap_spec.rb +0 -0
- 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 +0 -0
- 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/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 +0 -0
- data/spec/unit/indirector/report/rest_spec.rb +0 -0
- data/spec/unit/indirector/report/yaml_spec.rb +0 -0
- data/spec/unit/indirector/request_spec.rb +0 -0
- 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/resource_type/parser_spec.rb +5 -0
- data/spec/unit/indirector/resource_type/rest_spec.rb +0 -0
- data/spec/unit/indirector/rest_spec.rb +12 -0
- data/spec/unit/indirector/ssl_file_spec.rb +0 -0
- 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 +0 -0
- data/spec/unit/indirector_spec.rb +0 -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 +0 -0
- 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 +0 -0
- data/spec/unit/man_spec.rb +0 -0
- data/spec/unit/module_spec.rb +30 -6
- data/spec/unit/module_tool/applications/builder_spec.rb +23 -3
- data/spec/unit/module_tool_spec.rb +0 -0
- data/spec/unit/network/auth_config_parser_spec.rb +16 -0
- data/spec/unit/network/authconfig_spec.rb +0 -0
- data/spec/unit/network/authstore_spec.rb +0 -0
- data/spec/unit/network/format_handler_spec.rb +0 -0
- data/spec/unit/network/format_spec.rb +0 -0
- data/spec/unit/network/formats_spec.rb +0 -0
- data/spec/unit/network/http/api/indirected_routes_spec.rb +21 -13
- data/spec/unit/network/http/api/master/v3/environment_spec.rb +60 -0
- data/spec/unit/network/http/api/master/v3_spec.rb +0 -0
- data/spec/unit/network/http/compression_spec.rb +0 -0
- data/spec/unit/network/http/connection_spec.rb +0 -0
- data/spec/unit/network/http/factory_spec.rb +0 -0
- data/spec/unit/network/http/handler_spec.rb +0 -0
- data/spec/unit/network/http/nocache_pool_spec.rb +0 -0
- data/spec/unit/network/http/pool_spec.rb +0 -0
- data/spec/unit/network/http/rack/rest_spec.rb +7 -0
- data/spec/unit/network/http/rack_spec.rb +0 -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 +0 -0
- 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 +0 -0
- 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 +0 -0
- data/spec/unit/node_spec.rb +0 -0
- 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 +0 -0
- data/spec/unit/parser/ast/leaf_spec.rb +0 -0
- data/spec/unit/parser/compiler_spec.rb +20 -1
- data/spec/unit/parser/files_spec.rb +0 -0
- data/spec/unit/parser/functions/create_resources_spec.rb +2 -2
- data/spec/unit/parser/functions/defined_spec.rb +0 -0
- 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 +0 -0
- data/spec/unit/parser/functions/generate_spec.rb +0 -0
- data/spec/unit/parser/functions/hiera_spec.rb +0 -0
- data/spec/unit/parser/functions/include_spec.rb +0 -0
- data/spec/unit/parser/functions/inline_template_spec.rb +0 -0
- data/spec/unit/parser/functions/realize_spec.rb +0 -0
- data/spec/unit/parser/functions/regsubst_spec.rb +0 -0
- data/spec/unit/parser/functions/require_spec.rb +0 -0
- data/spec/unit/parser/functions/scanf_spec.rb +0 -0
- data/spec/unit/parser/functions/shared.rb +1 -1
- data/spec/unit/parser/functions/shellquote_spec.rb +0 -0
- data/spec/unit/parser/functions/split_spec.rb +0 -0
- 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 +8 -1
- data/spec/unit/parser/scope_spec.rb +45 -0
- data/spec/unit/parser/templatewrapper_spec.rb +0 -0
- data/spec/unit/parser/type_loader_spec.rb +0 -0
- data/spec/unit/pops/evaluator/access_ops_spec.rb +14 -0
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +13 -5
- data/spec/unit/pops/loaders/loaders_spec.rb +8 -8
- data/spec/unit/pops/loaders/static_loader_spec.rb +92 -1
- data/spec/unit/pops/lookup/interpolation_spec.rb +313 -0
- data/spec/unit/pops/parser/lexer2_spec.rb +2 -9
- data/spec/unit/pops/parser/parse_application_spec.rb +3 -8
- data/spec/unit/pops/parser/parse_basic_expressions_spec.rb +19 -0
- data/spec/unit/pops/parser/parse_capabilities_spec.rb +3 -10
- data/spec/unit/pops/parser/parse_site_spec.rb +19 -10
- data/spec/unit/pops/parser/parser_rspec_helper.rb +0 -4
- data/spec/unit/pops/types/enumeration_spec.rb +13 -12
- data/spec/unit/pops/types/iterable_spec.rb +2 -2
- data/spec/unit/pops/types/p_object_type_spec.rb +1060 -0
- data/spec/unit/pops/types/p_sem_ver_type_spec.rb +285 -0
- data/spec/unit/pops/types/recursion_guard_spec.rb +19 -17
- data/spec/unit/pops/types/ruby_generator_spec.rb +261 -0
- data/spec/unit/pops/types/string_converter_spec.rb +904 -0
- data/spec/unit/pops/types/type_asserter_spec.rb +3 -3
- data/spec/unit/pops/types/type_calculator_spec.rb +462 -412
- data/spec/unit/pops/types/type_factory_spec.rb +129 -88
- data/spec/unit/pops/types/type_formatter_spec.rb +80 -8
- data/spec/unit/pops/types/type_mismatch_describer_spec.rb +27 -2
- data/spec/unit/pops/types/type_parser_spec.rb +55 -16
- data/spec/unit/pops/types/types_spec.rb +320 -0
- data/spec/unit/pops/validator/validator_spec.rb +84 -10
- 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 +0 -0
- data/spec/unit/property/ordered_list_spec.rb +0 -0
- data/spec/unit/property_spec.rb +0 -0
- data/spec/unit/provider/augeas/augeas_spec.rb +0 -0
- 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/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/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 +0 -0
- 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 +0 -0
- 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 +0 -0
- data/spec/unit/provider/nameservice_spec.rb +0 -0
- 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 +0 -0
- 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 +0 -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 +0 -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 +0 -0
- 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 +0 -0
- data/spec/unit/provider/package/pip3_spec.rb +9 -262
- data/spec/unit/provider/package/pip_spec.rb +85 -22
- data/spec/unit/provider/package/pkg_spec.rb +0 -0
- data/spec/unit/provider/package/pkgutil_spec.rb +0 -0
- data/spec/unit/provider/package/puppet_gem_spec.rb +0 -0
- data/spec/unit/provider/package/rpm_spec.rb +160 -3
- data/spec/unit/provider/package/sun_spec.rb +0 -0
- data/spec/unit/provider/package/windows/package_spec.rb +0 -0
- data/spec/unit/provider/package/windows_spec.rb +0 -0
- data/spec/unit/provider/package/yum_spec.rb +23 -134
- data/spec/unit/provider/package/zypper_spec.rb +0 -0
- data/spec/unit/provider/parsedfile_spec.rb +0 -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 +0 -0
- data/spec/unit/provider/service/bsd_spec.rb +0 -0
- data/spec/unit/provider/service/daemontools_spec.rb +0 -0
- data/spec/unit/provider/service/debian_spec.rb +0 -0
- data/spec/unit/provider/service/freebsd_spec.rb +0 -0
- data/spec/unit/provider/service/gentoo_spec.rb +0 -0
- data/spec/unit/provider/service/init_spec.rb +0 -0
- data/spec/unit/provider/service/launchd_spec.rb +0 -0
- data/spec/unit/provider/service/openbsd_spec.rb +0 -0
- data/spec/unit/provider/service/openrc_spec.rb +0 -0
- data/spec/unit/provider/service/openwrt_spec.rb +0 -0
- data/spec/unit/provider/service/rcng_spec.rb +0 -0
- data/spec/unit/provider/service/redhat_spec.rb +0 -0
- data/spec/unit/provider/service/runit_spec.rb +0 -0
- data/spec/unit/provider/service/smf_spec.rb +14 -2
- data/spec/unit/provider/service/src_spec.rb +0 -0
- data/spec/unit/provider/service/systemd_spec.rb +34 -42
- data/spec/unit/provider/service/upstart_spec.rb +0 -0
- data/spec/unit/provider/service/windows_spec.rb +0 -0
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +0 -0
- data/spec/unit/provider/sshkey/parsed_spec.rb +0 -0
- data/spec/unit/provider/user/directoryservice_spec.rb +0 -0
- 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 +0 -0
- data/spec/unit/provider/user/windows_adsi_spec.rb +0 -0
- data/spec/unit/provider/vlan/cisco_spec.rb +0 -0
- data/spec/unit/provider/zfs/zfs_spec.rb +0 -0
- data/spec/unit/provider/zone/solaris_spec.rb +0 -0
- data/spec/unit/provider/zpool/zpool_spec.rb +0 -0
- data/spec/unit/provider_spec.rb +0 -0
- data/spec/unit/puppet_spec.rb +0 -0
- data/spec/unit/relationship_spec.rb +0 -0
- data/spec/unit/reports/http_spec.rb +0 -0
- data/spec/unit/reports/store_spec.rb +0 -0
- data/spec/unit/reports_spec.rb +0 -0
- data/spec/unit/resource/capability_finder_spec.rb +10 -2
- data/spec/unit/resource/catalog_spec.rb +27 -0
- data/spec/unit/resource/status_spec.rb +0 -0
- data/spec/unit/resource/type_collection_helper_spec.rb +0 -0
- data/spec/unit/resource/type_collection_spec.rb +0 -0
- data/spec/unit/resource/type_spec.rb +0 -0
- data/spec/unit/resource_spec.rb +0 -0
- data/spec/unit/settings/directory_setting_spec.rb +0 -0
- data/spec/unit/settings/duration_setting_spec.rb +0 -0
- data/spec/unit/settings/file_setting_spec.rb +6 -0
- 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 +1 -1
- data/spec/unit/ssl/base_spec.rb +0 -0
- data/spec/unit/ssl/certificate_authority/interface_spec.rb +0 -0
- data/spec/unit/ssl/certificate_authority_spec.rb +0 -0
- data/spec/unit/ssl/certificate_factory_spec.rb +0 -0
- data/spec/unit/ssl/certificate_request_spec.rb +0 -0
- data/spec/unit/ssl/certificate_revocation_list_spec.rb +0 -0
- data/spec/unit/ssl/certificate_spec.rb +0 -0
- data/spec/unit/ssl/configuration_spec.rb +0 -0
- data/spec/unit/ssl/host_spec.rb +0 -0
- data/spec/unit/ssl/inventory_spec.rb +0 -0
- data/spec/unit/ssl/key_spec.rb +0 -0
- data/spec/unit/status_spec.rb +0 -0
- data/spec/unit/transaction/additional_resource_generator_spec.rb +80 -65
- data/spec/unit/transaction/event_manager_spec.rb +0 -0
- data/spec/unit/transaction/event_spec.rb +0 -0
- data/spec/unit/transaction/report_spec.rb +0 -0
- data/spec/unit/transaction/resource_harness_spec.rb +0 -0
- data/spec/unit/transaction_spec.rb +0 -0
- 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 +0 -0
- data/spec/unit/type/file/checksum_spec.rb +0 -0
- data/spec/unit/type/file/checksum_value_spec.rb +0 -0
- data/spec/unit/type/file/content_spec.rb +0 -0
- 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 +0 -0
- data/spec/unit/type/file/mode_spec.rb +0 -0
- data/spec/unit/type/file/mtime_spec.rb +0 -0
- data/spec/unit/type/file/owner_spec.rb +0 -0
- data/spec/unit/type/file/selinux_spec.rb +0 -0
- data/spec/unit/type/file/source_spec.rb +0 -0
- data/spec/unit/type/file/type_spec.rb +0 -0
- data/spec/unit/type/file_spec.rb +0 -0
- 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 +0 -0
- data/spec/unit/type/interface_spec.rb +0 -0
- data/spec/unit/type/k5login_spec.rb +0 -0
- data/spec/unit/type/macauthorization_spec.rb +0 -0
- 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 +51 -10
- 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 +0 -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 +16 -0
- data/spec/unit/type/ssh_authorized_key_spec.rb +0 -0
- 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 +0 -0
- data/spec/unit/type/user_spec.rb +0 -0
- data/spec/unit/type/vlan_spec.rb +0 -0
- data/spec/unit/type/whit_spec.rb +0 -0
- data/spec/unit/type/yumrepo_spec.rb +0 -0
- 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 +14 -0
- data/spec/unit/util/autoload_spec.rb +0 -0
- data/spec/unit/util/backups_spec.rb +0 -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 +0 -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 +0 -0
- 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 +0 -0
- data/spec/unit/util/ldap/connection_spec.rb +0 -0
- data/spec/unit/util/ldap/generator_spec.rb +0 -0
- data/spec/unit/util/ldap/manager_spec.rb +0 -0
- data/spec/unit/util/log/destinations_spec.rb +0 -0
- data/spec/unit/util/log_spec.rb +0 -0
- data/spec/unit/util/logging_spec.rb +0 -0
- data/spec/unit/util/metric_spec.rb +0 -0
- data/spec/unit/util/monkey_patches_spec.rb +79 -3
- data/spec/unit/util/nagios_maker_spec.rb +0 -0
- data/spec/unit/util/network_device/cisco/device_spec.rb +1 -1
- 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 +0 -0
- data/spec/unit/util/network_device/transport/telnet_spec.rb +0 -0
- data/spec/unit/util/package_spec.rb +0 -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 +0 -0
- data/spec/unit/util/retry_action_spec.rb +0 -0
- data/spec/unit/util/run_mode_spec.rb +0 -0
- data/spec/unit/util/selinux_spec.rb +0 -0
- data/spec/unit/util/storage_spec.rb +0 -0
- data/spec/unit/util/suidmanager_spec.rb +0 -0
- data/spec/unit/util/symbolic_file_mode_spec.rb +0 -0
- data/spec/unit/util/tagging_spec.rb +0 -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 +0 -0
- data/spec/unit/util/windows/file_spec.rb +34 -0
- data/spec/unit/util/windows/root_certs_spec.rb +0 -0
- data/spec/unit/util/windows/sid_spec.rb +0 -0
- data/spec/unit/util_spec.rb +0 -0
- data/spec/watchr.rb +0 -0
- metadata +3402 -3337
- checksums.yaml +0 -7
- data/ext/puppet-nm-dispatcher +0 -13
- data/lib/puppet/pops/types/types_meta.rb +0 -0
- data/spec/integration/provider/package_spec.rb +0 -35
- data/spec/unit/data_providers/hiera_interpolation_spec.rb +0 -57
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
require 'puppet/pops'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
module Puppet::Pops
|
|
5
|
+
module Types
|
|
6
|
+
describe TypeParser do
|
|
5
7
|
extend RSpec::Matchers::DSL
|
|
6
8
|
|
|
7
|
-
let(:parser) {
|
|
8
|
-
let(:types) {
|
|
9
|
+
let(:parser) { TypeParser.new }
|
|
10
|
+
let(:types) { TypeFactory }
|
|
9
11
|
it "rejects a puppet expression" do
|
|
10
12
|
expect { parser.parse("1 + 1") }.to raise_error(Puppet::ParseError, /The expression <1 \+ 1> is not a valid type specification/)
|
|
11
13
|
end
|
|
@@ -60,6 +62,14 @@ describe Puppet::Pops::Types::TypeParser do
|
|
|
60
62
|
expect(parser.parse("Hash")).to be_the_type(types.hash_of_data)
|
|
61
63
|
end
|
|
62
64
|
|
|
65
|
+
it "interprets a parameterized Array[0, 0] as an empty hash with no key and value type" do
|
|
66
|
+
expect(parser.parse("Array[0, 0]")).to be_the_type(types.array_of(types.default, types.range(0, 0)))
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
it "interprets a parameterized Hash[0, 0] as an empty hash with no key and value type" do
|
|
70
|
+
expect(parser.parse("Hash[0, 0]")).to be_the_type(types.hash_of(types.default, types.default, types.range(0, 0)))
|
|
71
|
+
end
|
|
72
|
+
|
|
63
73
|
it "interprets a parameterized Hash[t] as a Hash of Scalar to t" do
|
|
64
74
|
expect(parser.parse("Hash[Scalar, Integer]")).to be_the_type(types.hash_of(types.integer))
|
|
65
75
|
end
|
|
@@ -123,7 +133,7 @@ describe Puppet::Pops::Types::TypeParser do
|
|
|
123
133
|
'Pattern[/x9/, /([a-z]+)([1-9]+)/]' => [:pattern, [/x9/, /([a-z]+)([1-9]+)/]],
|
|
124
134
|
}.each do |source, type|
|
|
125
135
|
it "such that the source '#{source}' yields the type #{type.to_s}" do
|
|
126
|
-
expect(parser.parse(source)).to be_the_type(
|
|
136
|
+
expect(parser.parse(source)).to be_the_type(TypeFactory.send(type[0], *type[1]))
|
|
127
137
|
end
|
|
128
138
|
end
|
|
129
139
|
end
|
|
@@ -135,50 +145,71 @@ describe Puppet::Pops::Types::TypeParser do
|
|
|
135
145
|
|
|
136
146
|
context 'with scope context and loader' do
|
|
137
147
|
let!(:scope) { {} }
|
|
148
|
+
let(:loader) { Object.new }
|
|
138
149
|
|
|
139
150
|
before :each do
|
|
140
|
-
|
|
141
|
-
loader.stubs(:load).returns nil
|
|
142
|
-
Puppet::Pops::Adapters::LoaderAdapter.expects(:loader_for_model_object).with(instance_of(Puppet::Pops::Model::QualifiedReference), scope).at_most_once.returns loader
|
|
151
|
+
Adapters::LoaderAdapter.expects(:loader_for_model_object).with(instance_of(Model::QualifiedReference), scope).at_most_once.returns loader
|
|
143
152
|
end
|
|
144
153
|
|
|
145
|
-
it
|
|
146
|
-
|
|
154
|
+
it 'interprets anything that is not found by the loader to be a type reference' do
|
|
155
|
+
loader.expects(:load).with(:type, 'nonesuch').returns nil
|
|
156
|
+
expect(parser.parse('Nonesuch', scope)).to be_the_type(types.type_reference('Nonesuch'))
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
it 'interprets anything that is found by the loader to be what the loader found' do
|
|
160
|
+
loader.expects(:load).with(:type, 'file').returns types.resource('File')
|
|
161
|
+
expect(parser.parse('File', scope)).to be_the_type(types.resource('File'))
|
|
147
162
|
end
|
|
148
163
|
|
|
149
164
|
it "parses a resource type with title" do
|
|
165
|
+
loader.expects(:load).with(:type, 'file').returns types.resource('File')
|
|
150
166
|
expect(parser.parse("File['/tmp/foo']", scope)).to be_the_type(types.resource('file', '/tmp/foo'))
|
|
151
167
|
end
|
|
152
168
|
|
|
153
169
|
it "parses a resource type using 'Resource[type]' form" do
|
|
170
|
+
loader.expects(:load).with(:type, 'file').returns types.resource('File')
|
|
154
171
|
expect(parser.parse("Resource[File]", scope)).to be_the_type(types.resource('file'))
|
|
155
172
|
end
|
|
156
173
|
|
|
157
174
|
it "parses a resource type with title using 'Resource[type, title]'" do
|
|
175
|
+
loader.expects(:load).with(:type, 'file').returns nil
|
|
158
176
|
expect(parser.parse("Resource[File, '/tmp/foo']", scope)).to be_the_type(types.resource('file', '/tmp/foo'))
|
|
159
177
|
end
|
|
178
|
+
|
|
179
|
+
it "parses a resource type with title using 'Resource[Type[title]]'" do
|
|
180
|
+
loader.expects(:load).with(:type, 'nonesuch').returns nil
|
|
181
|
+
expect(parser.parse("Resource[Nonesuch['fife']]", scope)).to be_the_type(types.resource('nonesuch', 'fife'))
|
|
182
|
+
end
|
|
160
183
|
end
|
|
161
184
|
|
|
162
185
|
context 'with loader context' do
|
|
163
186
|
let(:loader) { Puppet::Pops::Loader::BaseLoader.new(nil, "type_parser_unit_test_loader") }
|
|
164
187
|
before :each do
|
|
165
|
-
loader.stubs(:load).returns nil
|
|
166
188
|
Puppet::Pops::Adapters::LoaderAdapter.expects(:loader_for_model_object).never
|
|
167
189
|
end
|
|
168
190
|
|
|
169
|
-
it
|
|
191
|
+
it 'interprets anything that is not found by the loader to be a type reference' do
|
|
192
|
+
loader.expects(:load).with(:type, 'nonesuch').returns nil
|
|
193
|
+
expect(parser.parse('Nonesuch', loader)).to be_the_type(types.type_reference('Nonesuch'))
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
it 'interprets anything that is found by the loader to be what the loader found' do
|
|
197
|
+
loader.expects(:load).with(:type, 'file').returns types.resource('File')
|
|
170
198
|
expect(parser.parse('File', loader)).to be_the_type(types.resource('file'))
|
|
171
199
|
end
|
|
172
200
|
|
|
173
201
|
it "parses a resource type with title" do
|
|
202
|
+
loader.expects(:load).with(:type, 'file').returns types.resource('File')
|
|
174
203
|
expect(parser.parse("File['/tmp/foo']", loader)).to be_the_type(types.resource('file', '/tmp/foo'))
|
|
175
204
|
end
|
|
176
205
|
|
|
177
206
|
it "parses a resource type using 'Resource[type]' form" do
|
|
207
|
+
loader.expects(:load).with(:type, 'file').returns types.resource('File')
|
|
178
208
|
expect(parser.parse("Resource[File]", loader)).to be_the_type(types.resource('file'))
|
|
179
209
|
end
|
|
180
210
|
|
|
181
211
|
it "parses a resource type with title using 'Resource[type, title]'" do
|
|
212
|
+
loader.expects(:load).with(:type, 'file').returns types.resource('File')
|
|
182
213
|
expect(parser.parse("Resource[File, '/tmp/foo']", loader)).to be_the_type(types.resource('file', '/tmp/foo'))
|
|
183
214
|
end
|
|
184
215
|
end
|
|
@@ -189,7 +220,7 @@ describe Puppet::Pops::Types::TypeParser do
|
|
|
189
220
|
end
|
|
190
221
|
|
|
191
222
|
it "interprets anything that is not a built in type with parameterers to be type reference with parameters" do
|
|
192
|
-
expect(parser.parse("File['/tmp/foo']")).to eq(types.type_reference(
|
|
223
|
+
expect(parser.parse("File['/tmp/foo']")).to eq(types.type_reference("File['/tmp/foo']"))
|
|
193
224
|
end
|
|
194
225
|
end
|
|
195
226
|
|
|
@@ -243,7 +274,7 @@ describe Puppet::Pops::Types::TypeParser do
|
|
|
243
274
|
|
|
244
275
|
it 'parses a parameterized callable type with 0 min/max' do
|
|
245
276
|
t = parser.parse("Callable[0,0]")
|
|
246
|
-
expect(t).to be_the_type(types.callable())
|
|
277
|
+
expect(t).to be_the_type(types.callable(0,0))
|
|
247
278
|
expect(t.param_types.types).to be_empty
|
|
248
279
|
end
|
|
249
280
|
|
|
@@ -251,11 +282,17 @@ describe Puppet::Pops::Types::TypeParser do
|
|
|
251
282
|
t = parser.parse("Callable[0,1]")
|
|
252
283
|
expect(t).to be_the_type(types.callable(0,1))
|
|
253
284
|
# Contains a Unit type to indicate "called with what you accept"
|
|
254
|
-
expect(t.param_types.types[0]).to be_the_type(
|
|
285
|
+
expect(t.param_types.types[0]).to be_the_type(PUnitType.new())
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
it 'parses all known literals' do
|
|
289
|
+
t = parser.parse('Nonesuch[{a=>undef,b=>true,c=>false,d=>default,e=>"string",f=>0,g=>1.0,h=>[1,2,3]}]')
|
|
290
|
+
expect(t).to be_a(PTypeReferenceType)
|
|
291
|
+
expect(t.type_string).to eql('Nonesuch[{a=>undef,b=>true,c=>false,d=>default,e=>"string",f=>0,g=>1.0,h=>[1,2,3]}]')
|
|
255
292
|
end
|
|
256
293
|
|
|
257
294
|
matcher :be_the_type do |type|
|
|
258
|
-
calc =
|
|
295
|
+
calc = TypeCalculator.new
|
|
259
296
|
|
|
260
297
|
match do |actual|
|
|
261
298
|
calc.assignable?(actual, type) && calc.assignable?(type, actual)
|
|
@@ -283,6 +320,8 @@ describe Puppet::Pops::Types::TypeParser do
|
|
|
283
320
|
end
|
|
284
321
|
|
|
285
322
|
def the_type_spec_for(type)
|
|
286
|
-
|
|
323
|
+
TypeFormatter.string(type)
|
|
287
324
|
end
|
|
288
325
|
end
|
|
326
|
+
end
|
|
327
|
+
end
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
require 'puppet/pops'
|
|
3
|
+
require 'puppet_spec/compiler'
|
|
3
4
|
|
|
4
5
|
module Puppet::Pops
|
|
5
6
|
module Types
|
|
6
7
|
describe 'Puppet Type System' do
|
|
8
|
+
include PuppetSpec::Compiler
|
|
9
|
+
|
|
7
10
|
let(:tf) { TypeFactory }
|
|
8
11
|
context 'Integer type' do
|
|
9
12
|
let!(:a) { tf.range(10, 20) }
|
|
@@ -150,6 +153,86 @@ describe 'Puppet Type System' do
|
|
|
150
153
|
end
|
|
151
154
|
end
|
|
152
155
|
|
|
156
|
+
context 'Iterable type' do
|
|
157
|
+
it 'can be parameterized with element type' do
|
|
158
|
+
code = <<-CODE
|
|
159
|
+
function foo(Iterable[String] $x) {
|
|
160
|
+
$x.each |$e| {
|
|
161
|
+
notice $e
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
foo([bar, baz, cake])
|
|
165
|
+
CODE
|
|
166
|
+
expect(eval_and_collect_notices(code)).to eq(['bar', 'baz', 'cake'])
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
context 'Iterator type' do
|
|
171
|
+
let!(:iterint) { tf.iterator(tf.integer) }
|
|
172
|
+
|
|
173
|
+
context 'when testing instance?' do
|
|
174
|
+
it 'will consider an iterable on an integer is an instance of Iterator[Integer]' do
|
|
175
|
+
expect(iterint.instance?(Iterable.on(3))).to be_truthy
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
it 'will consider an iterable on string to be an instance of Iterator[Integer]' do
|
|
179
|
+
expect(iterint.instance?(Iterable.on('string'))).to be_falsey
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
context 'when testing assignable?' do
|
|
184
|
+
it 'will consider an iterator with an assignable type as assignable' do
|
|
185
|
+
expect(tf.iterator(tf.numeric).assignable?(iterint)).to be_truthy
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
it 'will not consider an iterator with a non assignable type as assignable' do
|
|
189
|
+
expect(tf.iterator(tf.string).assignable?(iterint)).to be_falsey
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
context 'when asked for an iterable type' do
|
|
194
|
+
it 'the default iterator type returns the default iterable type' do
|
|
195
|
+
expect(PIteratorType::DEFAULT.iterable_type).to be(PIterableType::DEFAULT)
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
it 'a typed iterator type returns the an equally typed iterable type' do
|
|
199
|
+
expect(iterint.iterable_type).to eq(tf.iterable(tf.integer))
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
it 'can be parameterized with an element type' do
|
|
204
|
+
code = <<-CODE
|
|
205
|
+
function foo(Iterator[String] $x) {
|
|
206
|
+
$x.each |$e| {
|
|
207
|
+
notice $e
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
foo([bar, baz, cake].reverse_each)
|
|
211
|
+
CODE
|
|
212
|
+
expect(eval_and_collect_notices(code)).to eq(['cake', 'baz', 'bar'])
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
context 'Collection type' do
|
|
217
|
+
it 'can be parameterized with a range' do
|
|
218
|
+
code = <<-CODE
|
|
219
|
+
notice(Collection[5, default] == Collection[5])
|
|
220
|
+
notice(Collection[5, 5] > Tuple[Integer, 0, 10])
|
|
221
|
+
CODE
|
|
222
|
+
expect(eval_and_collect_notices(code)).to eq(['true', 'false'])
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
context 'Struct type' do
|
|
227
|
+
context 'can be used as key in hash' do
|
|
228
|
+
it 'compacts optional in optional in optional to just optional' do
|
|
229
|
+
key1 = tf.struct({'foo' => tf.string})
|
|
230
|
+
key2 = tf.struct({'foo' => tf.string})
|
|
231
|
+
expect({key1 => 'hi'}[key2]).to eq('hi')
|
|
232
|
+
end
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
|
|
153
236
|
context 'Optional type' do
|
|
154
237
|
let!(:overlapping_ints) { tf.variant(tf.range(10, 20), tf.range(18, 28)) }
|
|
155
238
|
let!(:optoptopt) { tf.optional(tf.optional(tf.optional(overlapping_ints))) }
|
|
@@ -169,6 +252,7 @@ describe 'Puppet Type System' do
|
|
|
169
252
|
context 'NotUndef type' do
|
|
170
253
|
let!(:nununu) { tf.not_undef(tf.not_undef(tf.not_undef(tf.any))) }
|
|
171
254
|
let!(:nuopt) { tf.not_undef(tf.optional(tf.any)) }
|
|
255
|
+
let!(:nuoptint) { tf.not_undef(tf.optional(tf.integer)) }
|
|
172
256
|
|
|
173
257
|
context 'when normalizing' do
|
|
174
258
|
it 'compacts NotUndef in NotUndef in NotUndef to just NotUndef' do
|
|
@@ -178,6 +262,10 @@ describe 'Puppet Type System' do
|
|
|
178
262
|
it 'compacts Optional in NotUndef to just NotUndef' do
|
|
179
263
|
expect(nuopt.normalize).to eq(tf.not_undef(tf.any))
|
|
180
264
|
end
|
|
265
|
+
|
|
266
|
+
it 'compacts NotUndef[Optional[Integer]] in NotUndef to just Integer' do
|
|
267
|
+
expect(nuoptint.normalize).to eq(tf.integer)
|
|
268
|
+
end
|
|
181
269
|
end
|
|
182
270
|
end
|
|
183
271
|
|
|
@@ -235,7 +323,239 @@ describe 'Puppet Type System' do
|
|
|
235
323
|
)
|
|
236
324
|
end
|
|
237
325
|
end
|
|
326
|
+
|
|
327
|
+
context 'when generalizing' do
|
|
328
|
+
it 'will generalize and compact contained types' do
|
|
329
|
+
expect(tf.variant(tf.string(tf.range(3,3)), tf.string(tf.range(5,5))).generalize).to eq(tf.variant(tf.string))
|
|
330
|
+
end
|
|
331
|
+
end
|
|
238
332
|
end
|
|
333
|
+
|
|
334
|
+
context 'Runtime type' do
|
|
335
|
+
it 'can be created with a runtime and a runtime type name' do
|
|
336
|
+
expect(tf.runtime('ruby', 'Hash').to_s).to eq("Runtime[ruby, 'Hash']")
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
it 'can be created with a runtime and, puppet name pattern, and runtime replacement' do
|
|
340
|
+
expect(tf.runtime('ruby', [/^MyPackage::(.*)$/, 'MyModule::\1']).to_s).to eq("Runtime[ruby, [/^MyPackage::(.*)$/, 'MyModule::\\1']]")
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
it 'will map a Puppet name to a runtime type' do
|
|
344
|
+
t = tf.runtime('ruby', [/^MyPackage::(.*)$/, 'MyModule::\1'])
|
|
345
|
+
expect(t.from_puppet_name('MyPackage::MyType').to_s).to eq("Runtime[ruby, 'MyModule::MyType']")
|
|
346
|
+
end
|
|
347
|
+
end
|
|
348
|
+
|
|
349
|
+
context 'Type aliases' do
|
|
350
|
+
it 'will resolve nested objects using self recursion' do
|
|
351
|
+
code = <<-CODE
|
|
352
|
+
type Tree = Hash[String,Variant[String,Tree]]
|
|
353
|
+
notice({a => {b => {c => d}}} =~ Tree)
|
|
354
|
+
CODE
|
|
355
|
+
expect(eval_and_collect_notices(code)).to eq(['true'])
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
it 'will find mismatches using self recursion' do
|
|
359
|
+
code = <<-CODE
|
|
360
|
+
type Tree = Hash[String,Variant[String,Tree]]
|
|
361
|
+
notice({a => {b => {c => 1}}} =~ Tree)
|
|
362
|
+
CODE
|
|
363
|
+
expect(eval_and_collect_notices(code)).to eq(['false'])
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
it 'will not allow an alias chain to only contain aliases' do
|
|
367
|
+
code = <<-CODE
|
|
368
|
+
type Foo = Bar
|
|
369
|
+
type Fee = Foo
|
|
370
|
+
type Bar = Fee
|
|
371
|
+
notice(0 =~ Bar)
|
|
372
|
+
CODE
|
|
373
|
+
expect { eval_and_collect_notices(code) }.to raise_error(Puppet::Error, /Type alias 'Foo' cannot be resolved to a real type/)
|
|
374
|
+
end
|
|
375
|
+
|
|
376
|
+
it 'will not allow an alias chain that contains nothing but aliases and variants' do
|
|
377
|
+
code = <<-CODE
|
|
378
|
+
type Foo = Bar
|
|
379
|
+
type Fee = Foo
|
|
380
|
+
type Bar = Variant[Fee,Foo]
|
|
381
|
+
notice(0 =~ Bar)
|
|
382
|
+
CODE
|
|
383
|
+
expect { eval_and_collect_notices(code) }.to raise_error(Puppet::Error, /Type alias 'Foo' cannot be resolved to a real type/)
|
|
384
|
+
end
|
|
385
|
+
|
|
386
|
+
it 'will not allow an alias to directly reference itself' do
|
|
387
|
+
code = <<-CODE
|
|
388
|
+
type Foo = Foo
|
|
389
|
+
notice(0 =~ Foo)
|
|
390
|
+
CODE
|
|
391
|
+
expect { eval_and_collect_notices(code) }.to raise_error(Puppet::Error, /Type alias 'Foo' cannot be resolved to a real type/)
|
|
392
|
+
end
|
|
393
|
+
|
|
394
|
+
it 'will allow an alias to directly reference itself in a variant with other types' do
|
|
395
|
+
code = <<-CODE
|
|
396
|
+
type Foo = Variant[Foo,String]
|
|
397
|
+
notice(a =~ Foo)
|
|
398
|
+
CODE
|
|
399
|
+
expect(eval_and_collect_notices(code)).to eq(['true'])
|
|
400
|
+
end
|
|
401
|
+
|
|
402
|
+
it 'will allow an alias where a variant references an alias with a variant that references itself' do
|
|
403
|
+
code = <<-CODE
|
|
404
|
+
type X = Variant[Y, Integer]
|
|
405
|
+
type Y = Variant[X, String]
|
|
406
|
+
|
|
407
|
+
notice(X >= X)
|
|
408
|
+
notice(X >= Y)
|
|
409
|
+
notice(Y >= X)
|
|
410
|
+
CODE
|
|
411
|
+
expect(eval_and_collect_notices(code)).to eq(['true','true','true'])
|
|
412
|
+
end
|
|
413
|
+
|
|
414
|
+
it 'will detect a mismatch in an alias that directly references itself in a variant with other types' do
|
|
415
|
+
code = <<-CODE
|
|
416
|
+
type Foo = Variant[Foo,String]
|
|
417
|
+
notice(3 =~ Foo)
|
|
418
|
+
CODE
|
|
419
|
+
expect(eval_and_collect_notices(code)).to eq(['false'])
|
|
420
|
+
end
|
|
421
|
+
|
|
422
|
+
it 'will normalize a Variant containing a self reference so that the self reference is removed' do
|
|
423
|
+
code = <<-CODE
|
|
424
|
+
type Foo = Variant[Foo,String,Integer]
|
|
425
|
+
assert_type(Foo, /x/)
|
|
426
|
+
CODE
|
|
427
|
+
expect { eval_and_collect_notices(code) }.to raise_error(/expected a value of type String or Integer, got Regexp/)
|
|
428
|
+
end
|
|
429
|
+
|
|
430
|
+
it 'will handle a scalar correctly in combinations of nested aliased variants' do
|
|
431
|
+
code = <<-CODE
|
|
432
|
+
type Bar = Variant[Foo,Integer]
|
|
433
|
+
type Foo = Variant[Bar,String]
|
|
434
|
+
notice(a =~ Foo)
|
|
435
|
+
notice(1 =~ Foo)
|
|
436
|
+
notice(/x/ =~ Foo)
|
|
437
|
+
CODE
|
|
438
|
+
expect(eval_and_collect_notices(code)).to eq(['true', 'true', 'false'])
|
|
439
|
+
end
|
|
440
|
+
|
|
441
|
+
it 'will handle a non scalar correctly in combinations of nested aliased array with nested variants' do
|
|
442
|
+
code = <<-CODE
|
|
443
|
+
type Bar = Variant[Foo,Integer]
|
|
444
|
+
type Foo = Array[Variant[Bar,String]]
|
|
445
|
+
notice([a] =~ Foo)
|
|
446
|
+
notice([1] =~ Foo)
|
|
447
|
+
notice([/x/] =~ Foo)
|
|
448
|
+
CODE
|
|
449
|
+
expect(eval_and_collect_notices(code)).to eq(['true', 'true', 'false'])
|
|
450
|
+
end
|
|
451
|
+
|
|
452
|
+
it 'will handle a non scalar correctly in combinations of nested aliased variants with array' do
|
|
453
|
+
code = <<-CODE
|
|
454
|
+
type Bar = Variant[Foo,Array[Integer]]
|
|
455
|
+
type Foo = Variant[Bar,Array[String]]
|
|
456
|
+
notice([a] =~ Foo)
|
|
457
|
+
notice([1] =~ Foo)
|
|
458
|
+
notice([/x/] =~ Foo)
|
|
459
|
+
CODE
|
|
460
|
+
expect(eval_and_collect_notices(code)).to eq(['true', 'true', 'false'])
|
|
461
|
+
end
|
|
462
|
+
|
|
463
|
+
it 'will not allow dynamic constructs in type definition' do
|
|
464
|
+
code = <<-CODE
|
|
465
|
+
type Foo = Enum[$facts[os][family]]
|
|
466
|
+
notice(Foo)
|
|
467
|
+
CODE
|
|
468
|
+
expect{ eval_and_collect_notices(code) }.to raise_error(Puppet::Error,
|
|
469
|
+
/The expression <\$facts\[os\]\[family\]> is not a valid type specification/)
|
|
470
|
+
end
|
|
471
|
+
end
|
|
472
|
+
|
|
473
|
+
context 'Type mappings' do
|
|
474
|
+
it 'can register a singe type mapping' do
|
|
475
|
+
source = <<-CODE
|
|
476
|
+
type MyModule::ImplementationRegistry = Object[{}]
|
|
477
|
+
type Runtime[ruby, 'Puppet::Pops::Types::ImplementationRegistry'] = MyModule::ImplementationRegistry
|
|
478
|
+
notice(true)
|
|
479
|
+
CODE
|
|
480
|
+
collect_notices(source) do |compiler|
|
|
481
|
+
compiler.compile do |catalog|
|
|
482
|
+
type = Loaders.implementation_registry.type_for_module(ImplementationRegistry)
|
|
483
|
+
expect(type).to be_a(PObjectType)
|
|
484
|
+
expect(type.name).to eql('MyModule::ImplementationRegistry')
|
|
485
|
+
catalog
|
|
486
|
+
end
|
|
487
|
+
end
|
|
488
|
+
end
|
|
489
|
+
|
|
490
|
+
it 'can register a regexp based mapping' do
|
|
491
|
+
source = <<-CODE
|
|
492
|
+
type MyModule::TypeMismatchDescriber = Object[{}]
|
|
493
|
+
type Runtime[ruby, [/^Puppet::Pops::Types::(\\w+)$/, 'MyModule::\\1']] = [/^MyModule::(\\w+)$/, 'Puppet::Pops::Types::\\1']
|
|
494
|
+
notice(true)
|
|
495
|
+
CODE
|
|
496
|
+
collect_notices(source) do |compiler|
|
|
497
|
+
compiler.compile do |catalog|
|
|
498
|
+
type = Loaders.implementation_registry.type_for_module(TypeMismatchDescriber)
|
|
499
|
+
expect(type).to be_a(PObjectType)
|
|
500
|
+
expect(type.name).to eql('MyModule::TypeMismatchDescriber')
|
|
501
|
+
catalog
|
|
502
|
+
end
|
|
503
|
+
end
|
|
504
|
+
end
|
|
505
|
+
|
|
506
|
+
it 'a type mapping affects type inference' do
|
|
507
|
+
source = <<-CODE
|
|
508
|
+
type MyModule::ImplementationRegistry = Object[{}]
|
|
509
|
+
type Runtime[ruby, 'Puppet::Pops::Types::ImplementationRegistry'] = MyModule::ImplementationRegistry
|
|
510
|
+
notice(true)
|
|
511
|
+
CODE
|
|
512
|
+
collect_notices(source) do |compiler|
|
|
513
|
+
compiler.compile do |catalog|
|
|
514
|
+
type = TypeCalculator.singleton.infer(Loaders.implementation_registry)
|
|
515
|
+
expect(type).to be_a(PObjectType)
|
|
516
|
+
expect(type.name).to eql('MyModule::ImplementationRegistry')
|
|
517
|
+
catalog
|
|
518
|
+
end
|
|
519
|
+
end
|
|
520
|
+
end
|
|
521
|
+
end
|
|
522
|
+
|
|
523
|
+
context 'When attempting to redefine a built in type' do
|
|
524
|
+
it 'such as Integer, an error is raised' do
|
|
525
|
+
code = <<-CODE
|
|
526
|
+
type Integer = String
|
|
527
|
+
notice 'hello' =~ Integer
|
|
528
|
+
CODE
|
|
529
|
+
expect{ eval_and_collect_notices(code) }.to raise_error(/Attempt to redefine entity 'type\/integer'. Originally set by Puppet-Type-System\/Static-Loader/)
|
|
530
|
+
end
|
|
531
|
+
end
|
|
532
|
+
|
|
533
|
+
context 'instantiation via new_function is supported by' do
|
|
534
|
+
let(:loader) { Loader::BaseLoader.new(nil, "types_unit_test_loader") }
|
|
535
|
+
it 'Integer' do
|
|
536
|
+
func_class = tf.integer.new_function(loader)
|
|
537
|
+
expect(func_class).to be_a(Class)
|
|
538
|
+
expect(func_class.superclass).to be(Puppet::Functions::Function)
|
|
539
|
+
end
|
|
540
|
+
|
|
541
|
+
it 'Optional[Integer]' do
|
|
542
|
+
func_class = tf.optional(tf.integer).new_function(loader)
|
|
543
|
+
expect(func_class).to be_a(Class)
|
|
544
|
+
expect(func_class.superclass).to be(Puppet::Functions::Function)
|
|
545
|
+
end
|
|
546
|
+
end
|
|
547
|
+
|
|
548
|
+
context 'instantiation via new_function is not supported by' do
|
|
549
|
+
let(:loader) { Loader::BaseLoader.new(nil, "types_unit_test_loader") }
|
|
550
|
+
|
|
551
|
+
it 'Any, Scalar, Collection' do
|
|
552
|
+
[tf.any, tf.scalar, tf.collection ].each do |t|
|
|
553
|
+
expect { t.new_function(loader)
|
|
554
|
+
}.to raise_error(ArgumentError, /Creation of new instance of type '#{t.to_s}' is not supported/)
|
|
555
|
+
end
|
|
556
|
+
end
|
|
557
|
+
end
|
|
558
|
+
|
|
239
559
|
end
|
|
240
560
|
end
|
|
241
561
|
end
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
require 'spec_helper'
|
|
3
3
|
require 'puppet/pops'
|
|
4
4
|
require 'puppet_spec/pops'
|
|
5
|
-
|
|
6
|
-
# relative to this spec file (./) does not work as this file is loaded by rspec
|
|
7
|
-
require File.join(File.dirname(__FILE__), '../parser/parser_rspec_helper')
|
|
5
|
+
require_relative '../parser/parser_rspec_helper'
|
|
8
6
|
|
|
9
7
|
describe "validating 4x" do
|
|
10
8
|
include ParserRspecHelper
|
|
@@ -34,6 +32,45 @@ describe "validating 4x" do
|
|
|
34
32
|
expect(validate(fqn('::_aa').var())).to_not have_issue(Puppet::Pops::Issues::ILLEGAL_VAR_NAME)
|
|
35
33
|
end
|
|
36
34
|
|
|
35
|
+
context 'with the default settings for --strict' do
|
|
36
|
+
it 'produces a warning for duplicate keyes in a literal hash' do
|
|
37
|
+
acceptor = validate(parse('{ a => 1, a => 2 }'))
|
|
38
|
+
expect(acceptor.warning_count).to eql(1)
|
|
39
|
+
expect(acceptor.error_count).to eql(0)
|
|
40
|
+
expect(acceptor).to have_issue(Puppet::Pops::Issues::DUPLICATE_KEY)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
context 'with --strict set to warning' do
|
|
45
|
+
before(:each) { Puppet[:strict] = :warning }
|
|
46
|
+
it 'produces a warning for duplicate keyes in a literal hash' do
|
|
47
|
+
acceptor = validate(parse('{ a => 1, a => 2 }'))
|
|
48
|
+
expect(acceptor.warning_count).to eql(1)
|
|
49
|
+
expect(acceptor.error_count).to eql(0)
|
|
50
|
+
expect(acceptor).to have_issue(Puppet::Pops::Issues::DUPLICATE_KEY)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
context 'with --strict set to error' do
|
|
55
|
+
before(:each) { Puppet[:strict] = :error }
|
|
56
|
+
it 'produces an error for duplicate keyes in a literal hash' do
|
|
57
|
+
acceptor = validate(parse('{ a => 1, a => 2 }'))
|
|
58
|
+
expect(acceptor.warning_count).to eql(0)
|
|
59
|
+
expect(acceptor.error_count).to eql(1)
|
|
60
|
+
expect(acceptor).to have_issue(Puppet::Pops::Issues::DUPLICATE_KEY)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
context 'with --strict set to off' do
|
|
65
|
+
before(:each) { Puppet[:strict] = :off }
|
|
66
|
+
it 'does not produce an error or warning for duplicate keyes in a literal hash' do
|
|
67
|
+
acceptor = validate(parse('{ a => 1, a => 2 }'))
|
|
68
|
+
expect(acceptor.warning_count).to eql(0)
|
|
69
|
+
expect(acceptor.error_count).to eql(0)
|
|
70
|
+
expect(acceptor).to_not have_issue(Puppet::Pops::Issues::DUPLICATE_KEY)
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
37
74
|
context 'for non productive expressions' do
|
|
38
75
|
[ '1',
|
|
39
76
|
'3.14',
|
|
@@ -385,16 +422,53 @@ describe "validating 4x" do
|
|
|
385
422
|
expect(validate(parse(source))).to have_issue(Puppet::Pops::Issues::ILLEGAL_EXPRESSION)
|
|
386
423
|
end
|
|
387
424
|
end
|
|
388
|
-
end
|
|
389
425
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
426
|
+
context 'that are type mappings' do
|
|
427
|
+
it 'accepts a valid type mapping expression' do
|
|
428
|
+
source = <<-CODE
|
|
429
|
+
type Runtime[ruby, 'MyModule::MyObject'] = MyPackage::MyObject
|
|
430
|
+
notice(true)
|
|
431
|
+
CODE
|
|
432
|
+
expect(validate(parse(source))).not_to have_any_issues
|
|
433
|
+
end
|
|
434
|
+
|
|
435
|
+
it 'accepts a valid regexp based type mapping expression' do
|
|
436
|
+
source = <<-CODE
|
|
437
|
+
type Runtime[ruby, [/^MyPackage::(\w+)$/, 'MyModule::\1']] = [/^MyModule::(\w+)$/, 'MyPackage::\1']
|
|
438
|
+
notice(true)
|
|
439
|
+
CODE
|
|
440
|
+
expect(validate(parse(source))).not_to have_any_issues
|
|
441
|
+
end
|
|
442
|
+
|
|
443
|
+
it 'raises an error when a regexp based Runtime type is paired with a Puppet Type' do
|
|
444
|
+
source = <<-CODE
|
|
445
|
+
type Runtime[ruby, [/^MyPackage::(\w+)$/, 'MyModule::\1']] = MyPackage::MyObject
|
|
446
|
+
notice(true)
|
|
447
|
+
CODE
|
|
448
|
+
expect(validate(parse(source))).to have_issue(Puppet::Pops::Issues::ILLEGAL_REGEXP_TYPE_MAPPING)
|
|
449
|
+
end
|
|
394
450
|
|
|
395
|
-
|
|
396
|
-
|
|
451
|
+
it 'raises an error when a singleton Runtime type is paired with replacement pattern' do
|
|
452
|
+
source = <<-CODE
|
|
453
|
+
type Runtime[ruby, 'MyModule::MyObject'] = [/^MyModule::(\w+)$/, 'MyPackage::\1']
|
|
454
|
+
notice(true)
|
|
455
|
+
CODE
|
|
456
|
+
expect(validate(parse(source))).to have_issue(Puppet::Pops::Issues::ILLEGAL_SINGLE_TYPE_MAPPING)
|
|
457
|
+
end
|
|
458
|
+
|
|
459
|
+
it 'raises errors unless LHS is Runtime type' do
|
|
460
|
+
source = <<-CODE
|
|
461
|
+
type Pattern[/^MyPackage::(\w+)$/, 'MyModule::\1'] = [/^MyModule::(\w+)$/, 'MyPackage::\1']
|
|
462
|
+
notice(true)
|
|
463
|
+
CODE
|
|
464
|
+
expect(validate(parse(source))).to have_issue(Puppet::Pops::Issues::UNSUPPORTED_EXPRESSION)
|
|
465
|
+
end
|
|
397
466
|
end
|
|
467
|
+
end
|
|
468
|
+
|
|
469
|
+
context "capability annotations" do
|
|
470
|
+
before(:each) { Puppet[:app_management] = true }
|
|
471
|
+
after(:each) { Puppet[:app_management] = false }
|
|
398
472
|
|
|
399
473
|
['produces', 'consumes'].each do |word|
|
|
400
474
|
it "rejects illegal resource types in #{word} clauses" do
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/spec/unit/property_spec.rb
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|