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
data/lib/puppet/parser/scope.rb
CHANGED
|
@@ -504,29 +504,32 @@ class Puppet::Parser::Scope
|
|
|
504
504
|
end
|
|
505
505
|
|
|
506
506
|
UNDEFINED_VARIABLES_KIND = 'undefined_variables'.freeze
|
|
507
|
+
DEPRECATION_KIND = 'deprecation'.freeze
|
|
508
|
+
|
|
509
|
+
# The exception raised when a throw is uncaught is different in different versions
|
|
510
|
+
# of ruby. In >=2.2.0 it is UncaughtThrowError (which did not exist prior to this)
|
|
511
|
+
#
|
|
512
|
+
UNCAUGHT_THROW_EXCEPTION = defined?(UncaughtThrowError) ? UncaughtThrowError : ArgumentError
|
|
507
513
|
|
|
508
514
|
def variable_not_found(name, reason=nil)
|
|
509
|
-
# Built in variables always exist
|
|
510
|
-
if BUILT_IN_VARS.include?(name)
|
|
515
|
+
# Built in variables and numeric variables always exist
|
|
516
|
+
if BUILT_IN_VARS.include?(name) || name =~ Puppet::Pops::Patterns::NUMERIC_VAR_NAME
|
|
511
517
|
return nil
|
|
512
518
|
end
|
|
513
|
-
|
|
519
|
+
begin
|
|
514
520
|
throw(:undefined_variable, reason)
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
# wait until a major release. It would then force all callers of scope to deal with
|
|
521
|
-
# the case of :undefined_variable. (Should check with include? first or catch the throw).
|
|
522
|
-
# Use deprecation warning to enable turning off these warnings, and to ensure each variable
|
|
523
|
-
# is only logged once.
|
|
524
|
-
unless name =~ Puppet::Pops::Patterns::NUMERIC_VAR_NAME
|
|
521
|
+
rescue UNCAUGHT_THROW_EXCEPTION
|
|
522
|
+
case Puppet[:strict]
|
|
523
|
+
when :off
|
|
524
|
+
# do nothing
|
|
525
|
+
when :warning
|
|
525
526
|
Puppet.warn_once(UNDEFINED_VARIABLES_KIND, "Variable: #{name}",
|
|
526
|
-
|
|
527
|
+
"Undefined variable '#{name}'; #{reason}" )
|
|
528
|
+
when :error
|
|
529
|
+
raise ArgumentError, "Undefined variable '#{name}'; #{reason}"
|
|
527
530
|
end
|
|
528
|
-
nil
|
|
529
531
|
end
|
|
532
|
+
nil
|
|
530
533
|
end
|
|
531
534
|
|
|
532
535
|
# Retrieves the variable value assigned to the name given as an argument. The name must be a String,
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
require 'puppet/pops/lookup/interpolation'
|
|
2
|
+
|
|
1
3
|
module Puppet::Plugins::DataProviders
|
|
2
4
|
module DataProvider
|
|
5
|
+
include Puppet::Pops::Lookup::Interpolation
|
|
6
|
+
|
|
3
7
|
# Performs a lookup with an endless recursion check.
|
|
4
8
|
#
|
|
5
9
|
# @param key [String] The key to lookup
|
|
@@ -19,10 +23,13 @@ module Puppet::Plugins::DataProviders
|
|
|
19
23
|
#
|
|
20
24
|
# @api public
|
|
21
25
|
def unchecked_lookup(key, lookup_invocation, merge)
|
|
26
|
+
segments = split_key(key)
|
|
27
|
+
root_key = segments.shift
|
|
22
28
|
lookup_invocation.with(:data_provider, self) do
|
|
23
|
-
hash = data(data_key(
|
|
24
|
-
value = hash[
|
|
25
|
-
if value || hash.include?(
|
|
29
|
+
hash = data(data_key(root_key, lookup_invocation), lookup_invocation)
|
|
30
|
+
value = hash[root_key]
|
|
31
|
+
if value || hash.include?(root_key)
|
|
32
|
+
value = sub_lookup(key, lookup_invocation, segments, value) unless segments.empty?
|
|
26
33
|
lookup_invocation.report_found(key, post_process(value, lookup_invocation))
|
|
27
34
|
else
|
|
28
35
|
lookup_invocation.report_not_found(key)
|
|
@@ -31,8 +38,8 @@ module Puppet::Plugins::DataProviders
|
|
|
31
38
|
end
|
|
32
39
|
end
|
|
33
40
|
|
|
34
|
-
# Perform optional post processing of found value.
|
|
35
|
-
#
|
|
41
|
+
# Perform optional post processing of found value. The default implementation resolves
|
|
42
|
+
# interpolation expressions
|
|
36
43
|
#
|
|
37
44
|
# @param value [Object] The value to perform post processing on
|
|
38
45
|
# @param lookup_invocation [Puppet::Pops::Lookup::Invocation] The current lookup invocation
|
|
@@ -40,7 +47,7 @@ module Puppet::Plugins::DataProviders
|
|
|
40
47
|
#
|
|
41
48
|
# @api public
|
|
42
49
|
def post_process(value, lookup_invocation)
|
|
43
|
-
value
|
|
50
|
+
interpolate(value, lookup_invocation, true)
|
|
44
51
|
end
|
|
45
52
|
|
|
46
53
|
# Gets the data from the compiler, or initializes it by calling #initialize_data if not present in the compiler.
|
|
@@ -223,6 +230,9 @@ module Puppet::Plugins::DataProviders
|
|
|
223
230
|
#
|
|
224
231
|
# @api public
|
|
225
232
|
def unchecked_lookup(key, lookup_invocation, merge)
|
|
233
|
+
segments = split_key(key)
|
|
234
|
+
root_key = segments.shift
|
|
235
|
+
|
|
226
236
|
module_name = @parent_data_provider.nil? ? nil : @parent_data_provider.data_key(key, lookup_invocation)
|
|
227
237
|
lookup_invocation.with(:data_provider, self) do
|
|
228
238
|
merge_strategy = Puppet::Pops::MergeStrategy.strategy(merge)
|
|
@@ -231,8 +241,9 @@ module Puppet::Plugins::DataProviders
|
|
|
231
241
|
lookup_invocation.with(:path, path) do
|
|
232
242
|
if path.exists?
|
|
233
243
|
hash = load_data(path.path, module_name, lookup_invocation)
|
|
234
|
-
value = hash[
|
|
235
|
-
if value || hash.include?(
|
|
244
|
+
value = hash[root_key]
|
|
245
|
+
if value || hash.include?(root_key)
|
|
246
|
+
value = sub_lookup(key, lookup_invocation, segments, value) unless segments.empty?
|
|
236
247
|
lookup_invocation.report_found(key, post_process(value, lookup_invocation))
|
|
237
248
|
else
|
|
238
249
|
lookup_invocation.report_not_found(key)
|
data/lib/puppet/pops/adapters.rb
CHANGED
|
@@ -103,7 +103,11 @@ module Adapters
|
|
|
103
103
|
# Produces an URI with path?line=n&pos=n. If origin is unknown the URI is string:?line=n&pos=n
|
|
104
104
|
def to_uri
|
|
105
105
|
f = locator.file
|
|
106
|
-
|
|
106
|
+
if f.nil? || f.empty?
|
|
107
|
+
f = 'string:'
|
|
108
|
+
else
|
|
109
|
+
f = Puppet::Util.path_to_uri(f).to_s
|
|
110
|
+
end
|
|
107
111
|
URI("#{f}?line=#{line.to_s}&pos=#{pos.to_s}")
|
|
108
112
|
end
|
|
109
113
|
end
|
|
@@ -154,6 +154,12 @@ class AccessOperator
|
|
|
154
154
|
Types::TypeFactory.variant(*keys)
|
|
155
155
|
end
|
|
156
156
|
|
|
157
|
+
def access_PSemVerType(o, scope, keys)
|
|
158
|
+
keys.flatten!
|
|
159
|
+
assert_keys(keys, o, 1, Float::INFINITY, String, Semantic::VersionRange)
|
|
160
|
+
Types::TypeFactory.sem_ver(*keys)
|
|
161
|
+
end
|
|
162
|
+
|
|
157
163
|
def access_PTupleType(o, scope, keys)
|
|
158
164
|
keys.flatten!
|
|
159
165
|
if Types::TypeFactory.is_range_parameter?(keys[-2]) && Types::TypeFactory.is_range_parameter?(keys[-1])
|
|
@@ -260,6 +266,15 @@ class AccessOperator
|
|
|
260
266
|
end
|
|
261
267
|
end
|
|
262
268
|
|
|
269
|
+
def access_PObjectType(o, scope, keys)
|
|
270
|
+
keys.flatten!
|
|
271
|
+
if keys.size == 1
|
|
272
|
+
Types::TypeFactory.object(keys[0])
|
|
273
|
+
else
|
|
274
|
+
fail(Issues::BAD_TYPE_SLICE_ARITY, @semantic, {:base_type => 'Object-Type', :min => 1, :actual => keys.size})
|
|
275
|
+
end
|
|
276
|
+
end
|
|
277
|
+
|
|
263
278
|
def access_PNotUndefType(o, scope, keys)
|
|
264
279
|
keys.flatten!
|
|
265
280
|
case keys.size
|
|
@@ -293,6 +308,30 @@ class AccessOperator
|
|
|
293
308
|
end
|
|
294
309
|
end
|
|
295
310
|
|
|
311
|
+
def access_PIterableType(o, scope, keys)
|
|
312
|
+
keys.flatten!
|
|
313
|
+
if keys.size == 1
|
|
314
|
+
unless keys[0].is_a?(Types::PAnyType)
|
|
315
|
+
fail(Issues::BAD_TYPE_SLICE_TYPE, @semantic.keys[0], {:base_type => 'Iterable-Type', :actual => keys[0].class})
|
|
316
|
+
end
|
|
317
|
+
Types::PIterableType.new(keys[0])
|
|
318
|
+
else
|
|
319
|
+
fail(Issues::BAD_TYPE_SLICE_ARITY, @semantic, {:base_type => 'Iterable-Type', :min => 1, :actual => keys.size})
|
|
320
|
+
end
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
def access_PIteratorType(o, scope, keys)
|
|
324
|
+
keys.flatten!
|
|
325
|
+
if keys.size == 1
|
|
326
|
+
unless keys[0].is_a?(Types::PAnyType)
|
|
327
|
+
fail(Issues::BAD_TYPE_SLICE_TYPE, @semantic.keys[0], {:base_type => 'Iterator-Type', :actual => keys[0].class})
|
|
328
|
+
end
|
|
329
|
+
Types::PIteratorType.new(keys[0])
|
|
330
|
+
else
|
|
331
|
+
fail(Issues::BAD_TYPE_SLICE_ARITY, @semantic, {:base_type => 'Iterator-Type', :min => 1, :actual => keys.size})
|
|
332
|
+
end
|
|
333
|
+
end
|
|
334
|
+
|
|
296
335
|
def access_PRuntimeType(o, scope, keys)
|
|
297
336
|
keys.flatten!
|
|
298
337
|
assert_keys(keys, o, 2, 2, String, String)
|
|
@@ -333,6 +372,10 @@ class AccessOperator
|
|
|
333
372
|
#
|
|
334
373
|
def access_PHashType(o, scope, keys)
|
|
335
374
|
keys.flatten!
|
|
375
|
+
if keys.size == 2 && keys[0].is_a?(Integer) && keys[1].is_a?(Integer)
|
|
376
|
+
return Types::PHashType.new(nil, nil, Types::PIntegerType.new(*keys))
|
|
377
|
+
end
|
|
378
|
+
|
|
336
379
|
keys[0,2].each_with_index do |k, index|
|
|
337
380
|
unless k.is_a?(Types::PAnyType)
|
|
338
381
|
fail(Issues::BAD_TYPE_SLICE_TYPE, @semantic.keys[index], {:base_type => 'Hash-Type', :actual => k.class})
|
|
@@ -340,18 +383,18 @@ class AccessOperator
|
|
|
340
383
|
end
|
|
341
384
|
case keys.size
|
|
342
385
|
when 2
|
|
343
|
-
|
|
386
|
+
size_t = nil
|
|
344
387
|
when 3
|
|
345
388
|
size_t = keys[2]
|
|
346
389
|
size_t = Types::PIntegerType.new(size_t) unless size_t.is_a?(Types::PIntegerType)
|
|
347
|
-
Types::PHashType.new(keys[0], keys[1], size_t)
|
|
348
390
|
when 4
|
|
349
|
-
|
|
391
|
+
size_t = collection_size_t(2, keys[2], keys[3])
|
|
350
392
|
else
|
|
351
393
|
fail(Issues::BAD_TYPE_SLICE_ARITY, @semantic, {
|
|
352
394
|
:base_type => 'Hash-Type', :min => 2, :max => 4, :actual => keys.size
|
|
353
395
|
})
|
|
354
396
|
end
|
|
397
|
+
Types::PHashType.new(keys[0], keys[1], size_t)
|
|
355
398
|
end
|
|
356
399
|
|
|
357
400
|
# CollectionType is parameterized with a range
|
|
@@ -359,14 +402,14 @@ class AccessOperator
|
|
|
359
402
|
keys.flatten!
|
|
360
403
|
case keys.size
|
|
361
404
|
when 1
|
|
362
|
-
size_t = collection_size_t(
|
|
405
|
+
size_t = collection_size_t(0, keys[0])
|
|
363
406
|
when 2
|
|
364
|
-
size_t = collection_size_t(
|
|
407
|
+
size_t = collection_size_t(0, keys[0], keys[1])
|
|
365
408
|
else
|
|
366
409
|
fail(Issues::BAD_TYPE_SLICE_ARITY, @semantic,
|
|
367
410
|
{:base_type => 'Collection-Type', :min => 1, :max => 2, :actual => keys.size})
|
|
368
411
|
end
|
|
369
|
-
Types::PCollectionType.new(size_t)
|
|
412
|
+
Types::PCollectionType.new(nil, size_t)
|
|
370
413
|
end
|
|
371
414
|
|
|
372
415
|
# An Array can create a new Array type. It is not possible to create a collection of Array types.
|
|
@@ -375,19 +418,31 @@ class AccessOperator
|
|
|
375
418
|
keys.flatten!
|
|
376
419
|
case keys.size
|
|
377
420
|
when 1
|
|
421
|
+
unless keys[0].is_a?(Types::PAnyType)
|
|
422
|
+
fail(Issues::BAD_TYPE_SLICE_TYPE, @semantic.keys[0], {:base_type => 'Array-Type', :actual => keys[0].class})
|
|
423
|
+
end
|
|
424
|
+
type = keys[0]
|
|
378
425
|
size_t = nil
|
|
379
426
|
when 2
|
|
380
|
-
|
|
427
|
+
if keys[0].is_a?(Types::PAnyType)
|
|
428
|
+
size_t = collection_size_t(1, keys[1])
|
|
429
|
+
type = keys[0]
|
|
430
|
+
else
|
|
431
|
+
size_t = collection_size_t(0, keys[0], keys[1])
|
|
432
|
+
type = nil
|
|
433
|
+
end
|
|
381
434
|
when 3
|
|
382
|
-
|
|
435
|
+
if keys[0].is_a?(Types::PAnyType)
|
|
436
|
+
size_t = collection_size_t(1, keys[1], keys[2])
|
|
437
|
+
type = keys[0]
|
|
438
|
+
else
|
|
439
|
+
fail(Issues::BAD_TYPE_SLICE_TYPE, @semantic.keys[0], {:base_type => 'Array-Type', :actual => keys[0].class})
|
|
440
|
+
end
|
|
383
441
|
else
|
|
384
442
|
fail(Issues::BAD_TYPE_SLICE_ARITY, @semantic,
|
|
385
443
|
{:base_type => 'Array-Type', :min => 1, :max => 3, :actual => keys.size})
|
|
386
444
|
end
|
|
387
|
-
|
|
388
|
-
fail(Issues::BAD_TYPE_SLICE_TYPE, @semantic.keys[0], {:base_type => 'Array-Type', :actual => keys[0].class})
|
|
389
|
-
end
|
|
390
|
-
Types::PArrayType.new(keys[0], size_t)
|
|
445
|
+
Types::PArrayType.new(type, size_t)
|
|
391
446
|
end
|
|
392
447
|
|
|
393
448
|
# Produces an PIntegerType (range) given one or two keys.
|
|
@@ -414,6 +469,11 @@ class AccessOperator
|
|
|
414
469
|
access(t, scope, *keys)
|
|
415
470
|
end
|
|
416
471
|
|
|
472
|
+
# If a type reference is encountered here, it's an error
|
|
473
|
+
def access_PTypeReferenceType(o, scope, keys)
|
|
474
|
+
fail(Issues::UNKNOWN_RESOURCE_TYPE, @semantic, {:type_name => o.type_string })
|
|
475
|
+
end
|
|
476
|
+
|
|
417
477
|
# A Resource can create a new more specific Resource type, and/or an array of resource types
|
|
418
478
|
# If the given type has title set, it can not be specified further.
|
|
419
479
|
# @example
|
|
@@ -437,12 +497,12 @@ class AccessOperator
|
|
|
437
497
|
# Must know which concrete resource type to operate on in all cases.
|
|
438
498
|
# It is not allowed to specify the type in an array arg - e.g. Resource[[File, 'foo']]
|
|
439
499
|
# type_name is LHS type_name if set, else the first given arg
|
|
440
|
-
type_name = o.type_name || keys.shift
|
|
500
|
+
type_name = o.type_name || Types::TypeFormatter.singleton.capitalize_segments(keys.shift)
|
|
441
501
|
type_name = case type_name
|
|
442
502
|
when Types::PResourceType
|
|
443
503
|
type_name.type_name
|
|
444
504
|
when String
|
|
445
|
-
type_name
|
|
505
|
+
type_name
|
|
446
506
|
else
|
|
447
507
|
# blame given left expression if it defined the type, else the first given key expression
|
|
448
508
|
blame = o.type_name.nil? ? @semantic.keys[0] : @semantic.left_expr
|
|
@@ -450,7 +510,7 @@ class AccessOperator
|
|
|
450
510
|
end
|
|
451
511
|
|
|
452
512
|
# type name must conform
|
|
453
|
-
if type_name !~ Patterns::
|
|
513
|
+
if type_name !~ Patterns::CLASSREF_EXT
|
|
454
514
|
fail(Issues::ILLEGAL_CLASSREF, blamed, {:name=>type_name})
|
|
455
515
|
end
|
|
456
516
|
|
|
@@ -541,6 +601,8 @@ class AccessOperator
|
|
|
541
601
|
c.type_name
|
|
542
602
|
elsif c.is_a?(String)
|
|
543
603
|
c.downcase
|
|
604
|
+
elsif c.is_a?(Types::PTypeReferenceType)
|
|
605
|
+
c.type_string.downcase
|
|
544
606
|
else
|
|
545
607
|
fail(Issues::ILLEGAL_HOSTCLASS_NAME, @semantic.keys[i], {:name => c})
|
|
546
608
|
end
|
|
@@ -45,14 +45,19 @@ class Closure < CallableSignature
|
|
|
45
45
|
if enforce_parameters
|
|
46
46
|
# Push a temporary parameter scope used while resolving the parameter defaults
|
|
47
47
|
@enclosing_scope.with_parameter_scope(parameter_names) do |param_scope|
|
|
48
|
-
|
|
48
|
+
# Assign all non-nil values, even those that represent non-existent paramaters.
|
|
49
|
+
args_hash.each { |k, v| param_scope[k] = v unless v.nil? }
|
|
49
50
|
parameters.each do |p|
|
|
50
51
|
name = p.name
|
|
51
|
-
# only set result of default expr if it is defined (it is otherwise not possible to differentiate
|
|
52
|
-
# between explicit undef and no default expression
|
|
53
52
|
arg = args_hash[name]
|
|
54
|
-
if arg.nil?
|
|
55
|
-
|
|
53
|
+
if arg.nil?
|
|
54
|
+
# Arg either wasn't given, or it was undef
|
|
55
|
+
if p.value.nil?
|
|
56
|
+
# No default. Assign nil if the args_hash included it
|
|
57
|
+
param_scope[name] = nil if args_hash.include?(name)
|
|
58
|
+
else
|
|
59
|
+
param_scope[name] = param_scope.evaluate(name, p.value, @enclosing_scope, @evaluator)
|
|
60
|
+
end
|
|
56
61
|
end
|
|
57
62
|
end
|
|
58
63
|
args_hash = param_scope.to_hash
|
|
@@ -21,7 +21,6 @@ class CompareOperator
|
|
|
21
21
|
@@compare_visitor ||= Visitor.new(self, "cmp", 1, 1)
|
|
22
22
|
@@match_visitor ||= Visitor.new(self, "match", 2, 2)
|
|
23
23
|
@@include_visitor ||= Visitor.new(self, "include", 2, 2)
|
|
24
|
-
@type_calculator = Types::TypeCalculator.new()
|
|
25
24
|
end
|
|
26
25
|
|
|
27
26
|
def equals (a, b)
|
|
@@ -93,8 +92,13 @@ class CompareOperator
|
|
|
93
92
|
end
|
|
94
93
|
end
|
|
95
94
|
|
|
95
|
+
def cmp_Version(a, b)
|
|
96
|
+
raise ArgumentError.new('Versions not comparable to non Versions') unless b.is_a?(Semantic::Version)
|
|
97
|
+
a <=> b
|
|
98
|
+
end
|
|
99
|
+
|
|
96
100
|
def cmp_Object(a, b)
|
|
97
|
-
raise ArgumentError.new(
|
|
101
|
+
raise ArgumentError.new('Only Strings, Numbers, and Versions are comparable')
|
|
98
102
|
end
|
|
99
103
|
|
|
100
104
|
|
|
@@ -145,8 +149,10 @@ class CompareOperator
|
|
|
145
149
|
# Always set match data, a "not found" should not keep old match data visible
|
|
146
150
|
set_match_data(matched, scope) # creates ephemeral
|
|
147
151
|
return !!matched
|
|
152
|
+
when String, Semantic::Version
|
|
153
|
+
a.any? { |element| match(b, element, scope) }
|
|
148
154
|
when Types::PAnyType
|
|
149
|
-
a.each {|element| return true if
|
|
155
|
+
a.each {|element| return true if b.instance?(element) }
|
|
150
156
|
return false
|
|
151
157
|
else
|
|
152
158
|
a.each {|element| return true if equals(element, b) }
|
|
@@ -158,6 +164,10 @@ class CompareOperator
|
|
|
158
164
|
include?(a.keys, b, scope)
|
|
159
165
|
end
|
|
160
166
|
|
|
167
|
+
def include_VersionRange(a, b, scope)
|
|
168
|
+
Types::PSemVerRangeType.include?(a, b)
|
|
169
|
+
end
|
|
170
|
+
|
|
161
171
|
# Matches in general by using == operator
|
|
162
172
|
def match_Object(pattern, a, scope)
|
|
163
173
|
equals(a, pattern)
|
|
@@ -171,12 +181,32 @@ class CompareOperator
|
|
|
171
181
|
!!matched # convert to boolean
|
|
172
182
|
end
|
|
173
183
|
|
|
184
|
+
# Matches against semvers and strings
|
|
185
|
+
def match_Version(version, left, scope)
|
|
186
|
+
if left.is_a?(Semantic::Version)
|
|
187
|
+
version == left
|
|
188
|
+
elsif left.is_a? String
|
|
189
|
+
begin
|
|
190
|
+
version == Semantic::Version.parse(left)
|
|
191
|
+
rescue ArgumentError
|
|
192
|
+
false
|
|
193
|
+
end
|
|
194
|
+
else
|
|
195
|
+
false
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# Matches against semvers and strings
|
|
200
|
+
def match_VersionRange(range, left, scope)
|
|
201
|
+
Types::PSemVerRangeType.include?(range, left)
|
|
202
|
+
end
|
|
203
|
+
|
|
174
204
|
def match_PAnyType(any_type, left, scope)
|
|
175
205
|
# right is a type and left is not - check if left is an instance of the given type
|
|
176
206
|
# (The reverse is not terribly meaningful - computing which of the case options that first produces
|
|
177
207
|
# an instance of a given type).
|
|
178
208
|
#
|
|
179
|
-
|
|
209
|
+
any_type.instance?(left)
|
|
180
210
|
end
|
|
181
211
|
|
|
182
212
|
def match_Array(array, left, scope)
|
|
@@ -77,7 +77,7 @@ class EvaluatorImpl
|
|
|
77
77
|
@@eval_visitor.visit_this_1(self, target, scope)
|
|
78
78
|
|
|
79
79
|
rescue SemanticError => e
|
|
80
|
-
# A raised issue may not know the semantic target, use errors call stack, but fill in the
|
|
80
|
+
# A raised issue may not know the semantic target, use errors call stack, but fill in the
|
|
81
81
|
# rest from a supplied semantic object, or the target instruction if there is not semantic
|
|
82
82
|
# object.
|
|
83
83
|
#
|
|
@@ -223,6 +223,28 @@ class EvaluatorImpl
|
|
|
223
223
|
values.fetch(lval) {|k| fail(Issues::MISSING_MULTI_ASSIGNMENT_KEY, o, :key =>k)},
|
|
224
224
|
o, scope)
|
|
225
225
|
end
|
|
226
|
+
elsif values.is_a?(Puppet::Pops::Types::PHostClassType)
|
|
227
|
+
# assign variables from class variables
|
|
228
|
+
# lookup class resource and return one or more parameter values
|
|
229
|
+
# TODO: behavior when class_name is nil
|
|
230
|
+
resource = find_resource(scope, 'class', values.class_name)
|
|
231
|
+
if resource
|
|
232
|
+
base_name = "#{values.class_name.downcase}::"
|
|
233
|
+
idx = -1
|
|
234
|
+
result = lvalues.map do |lval|
|
|
235
|
+
idx += 1
|
|
236
|
+
varname = "#{base_name}#{lval}"
|
|
237
|
+
if variable_exists?(varname, scope)
|
|
238
|
+
result = get_variable_value(varname, o, scope)
|
|
239
|
+
assign(lval, result, o, scope)
|
|
240
|
+
else
|
|
241
|
+
fail(Puppet::Pops::Issues::MISSING_MULTI_ASSIGNMENT_VARIABLE, o.left_expr.values[idx], {:name => varname})
|
|
242
|
+
end
|
|
243
|
+
end
|
|
244
|
+
else
|
|
245
|
+
fail(Issues::UNKNOWN_RESOURCE, o.right_expr, {:type_name => 'Class', :title => values.class_name})
|
|
246
|
+
end
|
|
247
|
+
|
|
226
248
|
else
|
|
227
249
|
values = [values] unless values.is_a?(Array)
|
|
228
250
|
if values.size != lvalues.size
|
|
@@ -278,7 +300,9 @@ class EvaluatorImpl
|
|
|
278
300
|
# A QualifiedReference (i.e. a capitalized qualified name such as Foo, or Foo::Bar) evaluates to a PType
|
|
279
301
|
#
|
|
280
302
|
def eval_QualifiedReference(o, scope)
|
|
281
|
-
@@type_parser.interpret(o, scope)
|
|
303
|
+
type = @@type_parser.interpret(o, scope)
|
|
304
|
+
fail(Issues::UNKNOWN_RESOURCE_TYPE, o, {:type_name => type.type_string }) if type.is_a?(Types::PTypeReferenceType)
|
|
305
|
+
type
|
|
282
306
|
end
|
|
283
307
|
|
|
284
308
|
def eval_NotExpression(o, scope)
|
|
@@ -424,7 +448,15 @@ class EvaluatorImpl
|
|
|
424
448
|
#
|
|
425
449
|
def eval_AccessExpression(o, scope)
|
|
426
450
|
left = evaluate(o.left_expr, scope)
|
|
427
|
-
keys = o.keys
|
|
451
|
+
keys = o.keys || []
|
|
452
|
+
if left.is_a?(Types::PHostClassType)
|
|
453
|
+
# Evaluate qualified references without errors no undefined types
|
|
454
|
+
keys = keys.map {|key| key.is_a?(Model::QualifiedReference) ? @@type_parser.interpret(key, scope) : evaluate(key, scope) }
|
|
455
|
+
else
|
|
456
|
+
keys = keys.map {|key| evaluate(key, scope) }
|
|
457
|
+
# Resource[File] becomes File
|
|
458
|
+
return keys[0] if Types::PResourceType::DEFAULT == left && keys.size == 1 && keys[0].is_a?(Types::PResourceType)
|
|
459
|
+
end
|
|
428
460
|
AccessOperator.new(o).access(left, scope, *keys)
|
|
429
461
|
end
|
|
430
462
|
|
|
@@ -511,11 +543,17 @@ class EvaluatorImpl
|
|
|
511
543
|
# matches RHS types as instance of for all types except a parameterized Regexp[R]
|
|
512
544
|
if pattern.is_a?(Types::PAnyType)
|
|
513
545
|
# evaluate as instance? of type check
|
|
514
|
-
matched =
|
|
546
|
+
matched = pattern.instance?(left)
|
|
515
547
|
# convert match result to Boolean true, or false
|
|
516
548
|
return o.operator == :'=~' ? !!matched : !matched
|
|
517
549
|
end
|
|
518
550
|
|
|
551
|
+
if pattern.is_a?(Semantic::VersionRange)
|
|
552
|
+
# evaluate if range includes version
|
|
553
|
+
matched = Types::PSemVerRangeType.include?(pattern, left)
|
|
554
|
+
return o.operator == :'=~' ? matched : !matched
|
|
555
|
+
end
|
|
556
|
+
|
|
519
557
|
begin
|
|
520
558
|
pattern = Regexp.new(pattern) unless pattern.is_a?(Regexp)
|
|
521
559
|
rescue StandardError => e
|
|
@@ -692,6 +730,9 @@ class EvaluatorImpl
|
|
|
692
730
|
end
|
|
693
731
|
evaluated_name.type_name # assume validated
|
|
694
732
|
|
|
733
|
+
when Types::PTypeReferenceType
|
|
734
|
+
fail(Issues::UNKNOWN_RESOURCE_TYPE, o.type_string, {:type_name => evaluated_name.to_s})
|
|
735
|
+
|
|
695
736
|
else
|
|
696
737
|
actual = type_calculator.generalize(type_calculator.infer(evaluated_name)).to_s
|
|
697
738
|
fail(Issues::ILLEGAL_RESOURCE_TYPE, o.type_name, {:actual=>actual})
|
|
@@ -814,9 +855,20 @@ class EvaluatorImpl
|
|
|
814
855
|
# Evaluates function call by name.
|
|
815
856
|
#
|
|
816
857
|
def eval_CallNamedFunctionExpression(o, scope)
|
|
858
|
+
# If LHS is a type (i.e. Integer, or Integer[...]
|
|
859
|
+
# the call is taken as an instantiation of the given type
|
|
860
|
+
#
|
|
861
|
+
functor = o.functor_expr
|
|
862
|
+
if functor.is_a?(Model::QualifiedReference) ||
|
|
863
|
+
functor.is_a?(Model::AccessExpression) && functor.left_expr.is_a?(Model::QualifiedReference)
|
|
864
|
+
# instantiation
|
|
865
|
+
type = evaluate(functor, scope)
|
|
866
|
+
return call_function_with_block('new', unfold([type], o.arguments || [], scope), o, scope)
|
|
867
|
+
end
|
|
868
|
+
|
|
817
869
|
# The functor expression is not evaluated, it is not possible to select the function to call
|
|
818
870
|
# via an expression like $a()
|
|
819
|
-
case
|
|
871
|
+
case functor
|
|
820
872
|
when Model::QualifiedName
|
|
821
873
|
# ok
|
|
822
874
|
when Model::RenderStringExpression
|
|
@@ -841,6 +893,17 @@ class EvaluatorImpl
|
|
|
841
893
|
fail(Issues::ILLEGAL_EXPRESSION, o.functor_expr, {:feature=>'function name', :container => o})
|
|
842
894
|
end
|
|
843
895
|
name = name.value # the string function name
|
|
896
|
+
|
|
897
|
+
obj = receiver[0]
|
|
898
|
+
receiver_type = Types::TypeCalculator.infer(obj)
|
|
899
|
+
if receiver_type.is_a?(Types::PObjectType)
|
|
900
|
+
member = receiver_type[name]
|
|
901
|
+
unless member.nil?
|
|
902
|
+
args = unfold([], o.arguments || [], scope)
|
|
903
|
+
return o.lambda.nil? ? member.invoke(obj, scope, args) : member.invoke(obj, scope, args, &proc_from_lambda(o.lambda, scope))
|
|
904
|
+
end
|
|
905
|
+
end
|
|
906
|
+
|
|
844
907
|
call_function_with_block(name, unfold(receiver, o.arguments || [], scope), o, scope)
|
|
845
908
|
end
|
|
846
909
|
|
|
@@ -848,12 +911,17 @@ class EvaluatorImpl
|
|
|
848
911
|
if o.lambda.nil?
|
|
849
912
|
call_function(name, evaluated_arguments, o, scope)
|
|
850
913
|
else
|
|
851
|
-
|
|
852
|
-
call_function(name, evaluated_arguments, o, scope, &PuppetProc.new(closure) { |*args| closure.call(*args) })
|
|
914
|
+
call_function(name, evaluated_arguments, o, scope, &proc_from_lambda(o.lambda, scope))
|
|
853
915
|
end
|
|
854
916
|
end
|
|
855
917
|
private :call_function_with_block
|
|
856
918
|
|
|
919
|
+
def proc_from_lambda(lambda, scope)
|
|
920
|
+
closure = Closure.new(self, lambda, scope)
|
|
921
|
+
PuppetProc.new(closure) { |*args| closure.call(*args) }
|
|
922
|
+
end
|
|
923
|
+
private :proc_from_lambda
|
|
924
|
+
|
|
857
925
|
# @example
|
|
858
926
|
# $x ? { 10 => true, 20 => false, default => 0 }
|
|
859
927
|
#
|
|
@@ -1117,21 +1185,6 @@ class EvaluatorImpl
|
|
|
1117
1185
|
# of value except regular expression where a match is performed.
|
|
1118
1186
|
#
|
|
1119
1187
|
def is_match?(left, right, o, option_expr, scope)
|
|
1120
|
-
if right.is_a?(Regexp)
|
|
1121
|
-
return false unless left.is_a? String
|
|
1122
|
-
matched = right.match(left)
|
|
1123
|
-
set_match_data(matched, scope) # creates or clears ephemeral
|
|
1124
|
-
!!matched # convert to boolean
|
|
1125
|
-
elsif right.is_a?(Types::PAnyType)
|
|
1126
|
-
# right is a type and left is not - check if left is an instance of the given type
|
|
1127
|
-
# (The reverse is not terribly meaningful - computing which of the case options that first produces
|
|
1128
|
-
# an instance of a given type).
|
|
1129
|
-
#
|
|
1130
|
-
@@type_calculator.instance?(right, left)
|
|
1131
|
-
else
|
|
1132
|
-
# Handle equality the same way as the language '==' operator (case insensitive etc.)
|
|
1133
|
-
@@compare_operator.equals(left,right)
|
|
1134
|
-
end
|
|
1135
1188
|
@@compare_operator.match(left, right, scope)
|
|
1136
1189
|
end
|
|
1137
1190
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
module Puppet::Pops
|
|
2
|
+
module Evaluator
|
|
3
3
|
# Literal values for
|
|
4
4
|
# String (not containing interpolation)
|
|
5
5
|
# Numbers
|
|
@@ -14,14 +14,13 @@ require 'rgen/ecore/ecore'
|
|
|
14
14
|
# Not considered literal
|
|
15
15
|
# QualifiedReference # i.e. File, FooBar
|
|
16
16
|
#
|
|
17
|
-
class
|
|
18
|
-
#include Puppet::Pops::Utils
|
|
17
|
+
class LiteralEvaluator
|
|
19
18
|
|
|
20
19
|
EMPTY_STRING = ''.freeze
|
|
21
20
|
COMMA_SEPARATOR = ', '.freeze
|
|
22
21
|
|
|
23
22
|
def initialize
|
|
24
|
-
@@literal_visitor ||=
|
|
23
|
+
@@literal_visitor ||= Visitor.new(self, "literal", 0, 0)
|
|
25
24
|
end
|
|
26
25
|
|
|
27
26
|
def literal(ast)
|
|
@@ -70,7 +69,7 @@ class Puppet::Pops::Evaluator::LiteralEvaluator
|
|
|
70
69
|
|
|
71
70
|
def literal_ConcatenatedString(o)
|
|
72
71
|
# use double quoted string value if there is no interpolation
|
|
73
|
-
throw :not_literal unless o.segments.size == 1 && o.segments[0].is_a?(
|
|
72
|
+
throw :not_literal unless o.segments.size == 1 && o.segments[0].is_a?(Model::LiteralString)
|
|
74
73
|
o.segments[0].value
|
|
75
74
|
end
|
|
76
75
|
|
|
@@ -85,3 +84,5 @@ class Puppet::Pops::Evaluator::LiteralEvaluator
|
|
|
85
84
|
end
|
|
86
85
|
end
|
|
87
86
|
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
@@ -100,6 +100,18 @@ class Runtime3Converter
|
|
|
100
100
|
end
|
|
101
101
|
alias :convert2_Regexp :convert_Regexp
|
|
102
102
|
|
|
103
|
+
def convert_SemVer(o, scope, undef_value)
|
|
104
|
+
# Puppet 3x cannot handle SemVers. Use the string form
|
|
105
|
+
o.to_s
|
|
106
|
+
end
|
|
107
|
+
alias :convert2_SemVer :convert_SemVer
|
|
108
|
+
|
|
109
|
+
def convert_SemVerRange(o, scope, undef_value)
|
|
110
|
+
# Puppet 3x cannot handle SemVerRanges. Use the string form
|
|
111
|
+
o.to_s
|
|
112
|
+
end
|
|
113
|
+
alias :convert2_SemVerRange :convert_SemVerRange
|
|
114
|
+
|
|
103
115
|
def convert_Symbol(o, scope, undef_value)
|
|
104
116
|
case o
|
|
105
117
|
# Support :undef since it may come from a 3x structure
|
|
@@ -150,7 +162,7 @@ class Runtime3Converter
|
|
|
150
162
|
else
|
|
151
163
|
# Ensure that title is '' if nil
|
|
152
164
|
# Resources with absolute name always results in error because tagging does not support leading ::
|
|
153
|
-
[type_name.nil? ? nil : type_name.sub(/^::/, ''), title.nil? ? '' : title]
|
|
165
|
+
[type_name.nil? ? nil : type_name.sub(/^::/, '').downcase, title.nil? ? '' : title]
|
|
154
166
|
end
|
|
155
167
|
else
|
|
156
168
|
raise ArgumentError, "Cannot split the type #{catalog_type.class}, it represents neither a PHostClassType, nor a PResourceType."
|