puppet 4.2.0 → 4.3.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 +1 -1
- data/Gemfile +5 -7
- data/README.md +1 -1
- data/Rakefile +20 -0
- data/ext/debian/puppet.init +0 -1
- data/ext/debian/puppet.logrotate +14 -5
- data/ext/osx/puppet.plist +2 -4
- data/ext/project_data.yaml +1 -1
- data/ext/redhat/client.init +65 -12
- data/ext/redhat/logrotate +15 -3
- data/ext/redhat/puppet.spec.erb +5 -1
- data/ext/redhat/server.init +1 -1
- data/ext/solaris/smf/puppet +44 -0
- data/ext/solaris/smf/puppet.xml +44 -0
- data/ext/suse/client.init +27 -27
- data/ext/suse/server.init +2 -2
- data/ext/systemd/puppet.service +1 -0
- data/install.rb +21 -39
- data/lib/hiera/puppet_function.rb +5 -5
- data/lib/puppet/agent/locker.rb +11 -2
- data/lib/puppet/agent.rb +4 -4
- data/lib/puppet/application/agent.rb +28 -14
- data/lib/puppet/application/apply.rb +17 -4
- data/lib/puppet/application/cert.rb +16 -0
- data/lib/puppet/application/filebucket.rb +78 -4
- data/lib/puppet/application/lookup.rb +356 -0
- data/lib/puppet/application/master.rb +5 -1
- data/lib/puppet/configurer.rb +9 -5
- data/lib/puppet/context/trusted_information.rb +21 -1
- data/lib/puppet/context.rb +16 -1
- data/lib/puppet/daemon.rb +17 -13
- data/lib/puppet/data_binding.rb +4 -2
- data/lib/puppet/data_providers/data_adapter.rb +7 -68
- data/lib/puppet/data_providers/data_function_support.rb +5 -26
- data/lib/puppet/data_providers/function_env_data_provider.rb +0 -10
- data/lib/puppet/data_providers/function_module_data_provider.rb +0 -22
- data/lib/puppet/data_providers/hiera_config.rb +106 -0
- data/lib/puppet/data_providers/hiera_env_data_provider.rb +18 -0
- data/lib/puppet/data_providers/hiera_interpolate.rb +97 -0
- data/lib/puppet/data_providers/hiera_module_data_provider.rb +23 -0
- data/lib/puppet/data_providers/hiera_support.rb +37 -0
- data/lib/puppet/data_providers/json_data_provider_factory.rb +31 -0
- data/lib/puppet/data_providers/lookup_adapter.rb +200 -0
- data/lib/puppet/data_providers/yaml_data_provider_factory.rb +32 -0
- data/lib/puppet/data_providers.rb +12 -13
- data/lib/puppet/defaults.rb +14 -3
- data/lib/puppet/environments.rb +94 -6
- data/lib/puppet/error.rb +4 -0
- data/lib/puppet/face/module/changes.rb +2 -1
- data/lib/puppet/feature/cfacter.rb +1 -0
- data/lib/puppet/file_bucket/dipper.rb +58 -2
- data/lib/puppet/file_system/windows.rb +3 -1
- data/lib/puppet/functions/assert_type.rb +48 -12
- data/lib/puppet/functions/defined.rb +79 -48
- data/lib/puppet/functions/each.rb +85 -27
- data/lib/puppet/functions/epp.rb +29 -37
- data/lib/puppet/functions/filter.rb +60 -25
- data/lib/puppet/functions/hiera.rb +76 -3
- data/lib/puppet/functions/hiera_array.rb +65 -3
- data/lib/puppet/functions/hiera_hash.rb +74 -2
- data/lib/puppet/functions/hiera_include.rb +77 -4
- data/lib/puppet/functions/inline_epp.rb +44 -71
- data/lib/puppet/functions/lookup.rb +19 -17
- data/lib/puppet/functions/map.rb +56 -21
- data/lib/puppet/functions/match.rb +29 -12
- data/lib/puppet/functions/reduce.rb +95 -58
- data/lib/puppet/functions/versioncmp.rb +36 -0
- data/lib/puppet/functions/with.rb +15 -7
- data/lib/puppet/functions.rb +2 -4
- data/lib/puppet/indirector/catalog/compiler.rb +3 -3
- data/lib/puppet/indirector/catalog/static_compiler.rb +46 -30
- data/lib/puppet/indirector/data_binding/none.rb +4 -1
- data/lib/puppet/indirector/file_bucket_file/file.rb +58 -1
- data/lib/puppet/indirector/hiera.rb +4 -0
- data/lib/puppet/indirector/indirection.rb +6 -1
- data/lib/puppet/indirector/json.rb +1 -1
- data/lib/puppet/indirector/msgpack.rb +1 -1
- data/lib/puppet/indirector/request.rb +7 -8
- data/lib/puppet/indirector/resource_type/parser.rb +5 -3
- data/lib/puppet/info_service/class_information_service.rb +111 -0
- data/lib/puppet/info_service.rb +7 -0
- data/lib/puppet/module_tool/applications/unpacker.rb +1 -1
- data/lib/puppet/module_tool/metadata.rb +32 -9
- data/lib/puppet/module_tool/skeleton/templates/generator/README.md.erb +42 -38
- data/lib/puppet/module_tool/skeleton/templates/generator/manifests/init.pp.erb +25 -18
- data/lib/puppet/network/authconfig.rb +21 -1
- data/lib/puppet/network/authorization.rb +8 -1
- data/lib/puppet/network/http/api/master/v3/environment.rb +59 -0
- data/lib/puppet/network/http/api/master/v3.rb +7 -1
- data/lib/puppet/node/environment.rb +9 -2
- data/lib/puppet/node.rb +11 -5
- data/lib/puppet/parser/ast/pops_bridge.rb +39 -1
- data/lib/puppet/parser/compiler/catalog_validator/env_relationship_validator.rb +64 -0
- data/lib/puppet/parser/compiler/catalog_validator/relationship_validator.rb +38 -0
- data/lib/puppet/parser/compiler/catalog_validator/site_validator.rb +20 -0
- data/lib/puppet/parser/compiler/catalog_validator.rb +33 -0
- data/lib/puppet/parser/compiler.rb +300 -12
- data/lib/puppet/parser/environment_compiler.rb +165 -0
- data/lib/puppet/parser/functions/assert_type.rb +46 -16
- data/lib/puppet/parser/functions/defined.rb +105 -68
- data/lib/puppet/parser/functions/each.rb +85 -27
- data/lib/puppet/parser/functions/epp.rb +29 -37
- data/lib/puppet/parser/functions/filter.rb +59 -23
- data/lib/puppet/parser/functions/hiera.rb +83 -27
- data/lib/puppet/parser/functions/hiera_array.rb +71 -28
- data/lib/puppet/parser/functions/hiera_hash.rb +81 -30
- data/lib/puppet/parser/functions/hiera_include.rb +81 -40
- data/lib/puppet/parser/functions/inline_epp.rb +35 -60
- data/lib/puppet/parser/functions/inline_template.rb +2 -2
- data/lib/puppet/parser/functions/map.rb +55 -20
- data/lib/puppet/parser/functions/match.rb +27 -12
- data/lib/puppet/parser/functions/reduce.rb +97 -60
- data/lib/puppet/parser/functions/with.rb +16 -8
- data/lib/puppet/parser/resource.rb +103 -21
- data/lib/puppet/parser.rb +3 -0
- data/lib/puppet/plugins/configuration.rb +3 -2
- data/lib/puppet/plugins/data_providers/data_provider.rb +283 -0
- data/lib/puppet/plugins/data_providers/registry.rb +84 -0
- data/lib/puppet/plugins/data_providers.rb +12 -60
- data/lib/puppet/pops/adapters.rb +12 -0
- data/lib/puppet/pops/binder/binder.rb +2 -2
- data/lib/puppet/pops/binder/bindings_checker.rb +1 -1
- data/lib/puppet/pops/binder/bindings_label_provider.rb +3 -1
- data/lib/puppet/pops/binder/bindings_loader.rb +6 -2
- data/lib/puppet/pops/binder/bindings_model_meta.rb +2 -2
- data/lib/puppet/pops/binder/config/binder_config.rb +1 -1
- data/lib/puppet/pops/binder/injector.rb +4 -4
- data/lib/puppet/pops/binder/key_factory.rb +3 -9
- data/lib/puppet/pops/binder/scheme_handler/module_scheme.rb +68 -9
- data/lib/puppet/pops/evaluator/access_operator.rb +27 -60
- data/lib/puppet/pops/evaluator/closure.rb +8 -8
- data/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +1 -1
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +10 -6
- data/lib/puppet/pops/evaluator/literal_evaluator.rb +87 -0
- data/lib/puppet/pops/evaluator/relationship_operator.rb +7 -1
- data/lib/puppet/pops/functions/dispatcher.rb +3 -3
- data/lib/puppet/pops/issues.rb +11 -3
- data/lib/puppet/pops/label_provider.rb +1 -1
- data/lib/puppet/pops/lookup/explainer.rb +402 -0
- data/lib/puppet/pops/lookup/invocation.rb +117 -0
- data/lib/puppet/pops/lookup.rb +25 -47
- data/lib/puppet/pops/merge_strategy.rb +73 -5
- data/lib/puppet/pops/model/factory.rb +38 -3
- data/lib/puppet/pops/model/model_label_provider.rb +10 -1
- data/lib/puppet/pops/model/model_meta.rb +19 -1
- data/lib/puppet/pops/model/model_tree_dumper.rb +18 -0
- data/lib/puppet/pops/parser/code_merger.rb +13 -1
- data/lib/puppet/pops/parser/egrammar.ra +65 -2
- data/lib/puppet/pops/parser/eparser.rb +1569 -1241
- data/lib/puppet/pops/parser/lexer2.rb +32 -1
- data/lib/puppet/pops/parser/locator.rb +1 -1
- data/lib/puppet/pops/parser/parser_support.rb +25 -13
- data/lib/puppet/pops/patterns.rb +3 -0
- data/lib/puppet/pops/types/enumeration.rb +1 -2
- data/lib/puppet/pops/types/type_asserter.rb +16 -15
- data/lib/puppet/pops/types/type_assertion_error.rb +1 -0
- data/lib/puppet/pops/types/type_calculator.rb +171 -1020
- data/lib/puppet/pops/types/type_factory.rb +87 -148
- data/lib/puppet/pops/types/type_mismatch_describer.rb +743 -0
- data/lib/puppet/pops/types/type_parser.rb +118 -129
- data/lib/puppet/pops/types/types.rb +1394 -255
- data/lib/puppet/pops/types/types_meta.rb +0 -234
- data/lib/puppet/pops/validation/checker4_0.rb +49 -1
- data/lib/puppet/pops/validation/validator_factory_4_0.rb +3 -1
- data/lib/puppet/pops/validation.rb +7 -2
- data/lib/puppet/pops.rb +19 -17
- data/lib/puppet/provider/augeas/augeas.rb +50 -0
- data/lib/puppet/provider/exec.rb +6 -1
- data/lib/puppet/provider/group/directoryservice.rb +10 -0
- data/lib/puppet/provider/package/dnf.rb +41 -0
- data/lib/puppet/provider/package/gem.rb +7 -2
- data/lib/puppet/provider/package/nim.rb +1 -1
- data/lib/puppet/provider/package/rpm.rb +1 -0
- data/lib/puppet/provider/package/windows/exe_package.rb +10 -8
- data/lib/puppet/provider/package/windows/msi_package.rb +4 -3
- data/lib/puppet/provider/package/windows/package.rb +9 -1
- data/lib/puppet/provider/package/yum.rb +20 -9
- data/lib/puppet/provider/service/bsd.rb +1 -1
- data/lib/puppet/provider/service/debian.rb +21 -0
- data/lib/puppet/provider/service/init.rb +6 -0
- data/lib/puppet/provider/service/launchd.rb +36 -7
- data/lib/puppet/provider/service/rcng.rb +51 -0
- data/lib/puppet/provider/service/redhat.rb +2 -1
- data/lib/puppet/provider/service/smf.rb +43 -2
- data/lib/puppet/provider/service/src.rb +27 -0
- data/lib/puppet/provider/service/systemd.rb +25 -5
- data/lib/puppet/provider/sshkey/parsed.rb +19 -9
- data/lib/puppet/provider/zone/solaris.rb +2 -2
- data/lib/puppet/reference/configuration.rb +10 -4
- data/lib/puppet/reference/report.rb +9 -12
- data/lib/puppet/reports.rb +5 -1
- data/lib/puppet/resource/capability_finder.rb +95 -0
- data/lib/puppet/resource/catalog.rb +47 -7
- data/lib/puppet/resource/status.rb +0 -2
- data/lib/puppet/resource/type.rb +238 -44
- data/lib/puppet/resource/type_collection.rb +60 -2
- data/lib/puppet/resource.rb +50 -73
- data/lib/puppet/settings/file_setting.rb +10 -9
- data/lib/puppet/settings.rb +2 -2
- data/lib/puppet/ssl/certificate_authority/interface.rb +2 -2
- data/lib/puppet/ssl/oids.rb +9 -1
- data/lib/puppet/transaction/additional_resource_generator.rb +71 -8
- data/lib/puppet/transaction/resource_harness.rb +9 -4
- data/lib/puppet/transaction.rb +8 -1
- data/lib/puppet/type/augeas.rb +8 -0
- data/lib/puppet/type/file/source.rb +14 -12
- data/lib/puppet/type/package.rb +9 -6
- data/lib/puppet/type/user.rb +4 -2
- data/lib/puppet/type.rb +78 -7
- data/lib/puppet/util/command_line.rb +4 -0
- data/lib/puppet/util/execution.rb +18 -2
- data/lib/puppet/util/tagging.rb +7 -1
- data/lib/puppet/util/windows/adsi.rb +5 -2
- data/lib/puppet/util/windows/security.rb +4 -1
- data/lib/puppet/util/windows/taskscheduler.rb +1 -1
- data/lib/puppet/util.rb +9 -1
- data/lib/puppet/version.rb +1 -1
- data/lib/puppet.rb +12 -0
- data/spec/fixtures/unit/application/environments/production/data/common.yaml +3 -0
- data/spec/fixtures/unit/application/environments/production/environment.conf +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_json/data/bad.json +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_json/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_json/hiera.yaml +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_json/manifests/site.pp +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_yaml/data/bad.yaml +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_yaml/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_yaml/hiera.yaml +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_yaml/manifests/site.pp +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/data/common.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/manifests/site.pp +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/modules/one/data/common.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/modules/one/manifests/init.pp +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/modules/one/metadata.json +9 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data1/first.json +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data1/name.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data1/second.json +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data1/single.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data2/single.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/hiera.yaml +18 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/manifests/site.pp +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/data/common.yaml +46 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/manifests/site.pp +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/modules/one/data/common.yaml +30 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/modules/one/manifests/init.pp +13 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/modules/one/metadata.json +9 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/manifests/site.pp +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data1/first.json +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data1/name.yaml +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data1/second.json +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data1/single.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data2/single.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/hiera.yaml +18 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/manifests/init.pp +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/metadata.json +9 -0
- data/spec/fixtures/unit/data_providers/environments/sample/modules/dataprovider/lib/puppet_x/helindbe/sample_env_data.rb +1 -0
- data/spec/fixtures/unit/data_providers/environments/sample/modules/dataprovider/lib/puppet_x/helindbe/sample_module_data.rb +1 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/hieraprovider/data/first.json +3 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/hieraprovider/hiera.yaml +8 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/hieraprovider/manifests/init.pp +5 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/hieraprovider/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/meta/lib/puppet/functions/meta/data.rb +9 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/meta/manifests/init.pp +3 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/meta/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/metawcp/lib/puppet/bindings/metawcp/default.rb +10 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/metawcp/lib/puppet_x/thallgren/sample_module_data.rb +23 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/metawcp/manifests/init.pp +3 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/metawcp/metadata.json +9 -0
- data/spec/fixtures/unit/provider/package/yum/yum-check-update-security.txt +184 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_get/should_yield_to_the_block.yml +24 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_head/should_yield_to_the_block.yml +24 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_post/should_yield_to_the_block.yml +24 -0
- data/spec/integration/data_binding_spec.rb +229 -0
- data/spec/integration/file_bucket/file_spec.rb +2 -2
- data/spec/integration/parser/compiler_spec.rb +30 -24
- data/spec/integration/parser/resource_expressions_spec.rb +4 -4
- data/spec/integration/parser/undef_param_spec.rb +1 -1
- data/spec/integration/provider/package_spec.rb +3 -1
- data/spec/integration/resource/catalog_spec.rb +1 -1
- data/spec/integration/ssl/certificate_authority_spec.rb +0 -1
- data/spec/integration/ssl/certificate_request_spec.rb +0 -1
- data/spec/integration/ssl/certificate_revocation_list_spec.rb +0 -1
- data/spec/integration/ssl/host_spec.rb +0 -1
- data/spec/integration/type/package_spec.rb +2 -0
- data/spec/integration/util/rdoc/parser_spec.rb +1 -1
- data/spec/integration/util/windows/security_spec.rb +18 -0
- data/spec/lib/matchers/include_in_order.rb +2 -2
- data/spec/shared_behaviours/iterative_functions.rb +8 -8
- data/spec/spec_helper.rb +7 -0
- data/spec/unit/agent/locker_spec.rb +4 -4
- data/spec/unit/agent_spec.rb +0 -8
- data/spec/unit/application/agent_spec.rb +5 -0
- data/spec/unit/application/apply_spec.rb +9 -1
- data/spec/unit/application/filebucket_spec.rb +88 -2
- data/spec/unit/application/lookup_spec.rb +195 -0
- data/spec/unit/application/master_spec.rb +2 -2
- data/spec/unit/application_spec.rb +3 -3
- data/spec/unit/appmgmt_spec.rb +657 -0
- data/spec/unit/capability_spec.rb +414 -0
- data/spec/unit/configurer_spec.rb +7 -1
- data/spec/unit/context/trusted_information_spec.rb +24 -1
- data/spec/unit/daemon_spec.rb +18 -8
- data/spec/unit/data_providers/hiera_data_provider_spec.rb +201 -0
- data/spec/unit/environments_spec.rb +2 -0
- data/spec/unit/face/node_spec.rb +1 -1
- data/spec/unit/file_bucket/dipper_spec.rb +210 -1
- data/spec/unit/file_serving/configuration_spec.rb +1 -1
- data/spec/unit/file_system_spec.rb +20 -0
- data/spec/unit/functions/assert_type_spec.rb +5 -7
- data/spec/unit/functions/defined_spec.rb +2 -2
- data/spec/unit/functions/epp_spec.rb +2 -2
- data/spec/unit/functions/filter_spec.rb +18 -0
- data/spec/unit/functions/hiera_spec.rb +2 -2
- data/spec/unit/functions/lookup_spec.rb +200 -9
- data/spec/unit/functions/regsubst_spec.rb +17 -8
- data/spec/unit/functions/scanf_spec.rb +1 -1
- data/spec/unit/functions/split_spec.rb +2 -2
- data/spec/unit/functions/versioncmp_spec.rb +36 -0
- data/spec/unit/functions4_spec.rb +58 -72
- data/spec/unit/graph/sequential_prioritizer_spec.rb +1 -1
- data/spec/unit/indirector/catalog/compiler_spec.rb +28 -8
- data/spec/unit/indirector/catalog/static_compiler_spec.rb +38 -20
- data/spec/unit/indirector/data_binding/none_spec.rb +2 -2
- data/spec/unit/indirector/file_bucket_file/file_spec.rb +52 -1
- data/spec/unit/indirector/indirection_spec.rb +13 -2
- data/spec/unit/indirector/request_spec.rb +8 -8
- data/spec/unit/indirector/ssl_file_spec.rb +1 -1
- data/spec/unit/indirector/yaml_spec.rb +1 -1
- data/spec/unit/info_service_spec.rb +236 -0
- data/spec/unit/module_tool/application_spec.rb +1 -1
- data/spec/unit/module_tool/applications/builder_spec.rb +1 -1
- data/spec/unit/module_tool/metadata_spec.rb +31 -2
- data/spec/unit/network/authconfig_spec.rb +62 -32
- data/spec/unit/network/authorization_spec.rb +30 -2
- data/spec/unit/network/authstore_spec.rb +1 -1
- data/spec/unit/network/http/compression_spec.rb +1 -1
- data/spec/unit/network/http/connection_spec.rb +14 -19
- data/spec/unit/network/http/handler_spec.rb +0 -5
- data/spec/unit/network/rights_spec.rb +3 -3
- data/spec/unit/node_spec.rb +27 -0
- data/spec/unit/parser/ast/leaf_spec.rb +1 -1
- data/spec/unit/parser/compiler_spec.rb +86 -2
- data/spec/unit/parser/functions/create_resources_spec.rb +1 -1
- data/spec/unit/parser/resource_spec.rb +2 -20
- data/spec/unit/pops/binder/config/binder_config_spec.rb +1 -1
- data/spec/unit/pops/binder/injector_spec.rb +3 -3
- data/spec/unit/pops/evaluator/access_ops_spec.rb +13 -11
- data/spec/unit/pops/evaluator/basic_expressions_spec.rb +1 -2
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +20 -11
- data/spec/unit/pops/evaluator/literal_evaluator_spec.rb +43 -0
- data/spec/unit/pops/label_provider_spec.rb +5 -1
- data/spec/unit/pops/parser/lexer2_spec.rb +39 -0
- data/spec/unit/pops/parser/parse_application_spec.rb +40 -0
- data/spec/unit/pops/parser/parse_basic_expressions_spec.rb +4 -0
- data/spec/unit/pops/parser/parse_capabilities_spec.rb +47 -0
- data/spec/unit/pops/parser/parse_site_spec.rb +38 -0
- data/spec/unit/pops/parser/parser_rspec_helper.rb +5 -0
- data/spec/unit/pops/parser/parser_spec.rb +18 -0
- data/spec/unit/pops/types/type_calculator_spec.rb +427 -444
- data/spec/unit/pops/types/type_factory_spec.rb +12 -12
- data/spec/unit/pops/types/type_parser_spec.rb +15 -12
- data/spec/unit/pops/validator/validator_spec.rb +68 -0
- data/spec/unit/property_spec.rb +1 -1
- data/spec/unit/provider/augeas/augeas_spec.rb +50 -0
- data/spec/unit/provider/group/directoryservice_spec.rb +33 -0
- data/spec/unit/provider/group/windows_adsi_spec.rb +3 -0
- data/spec/unit/provider/package/dnf_spec.rb +92 -0
- data/spec/unit/provider/package/gem_spec.rb +7 -0
- data/spec/unit/provider/package/nim_spec.rb +6 -6
- data/spec/unit/provider/package/rpm_spec.rb +25 -2
- data/spec/unit/provider/package/windows/package_spec.rb +41 -0
- data/spec/unit/provider/package/yum_spec.rb +35 -12
- data/spec/unit/provider/scheduled_task/win32_taskscheduler_spec.rb +10 -0
- data/spec/unit/provider/service/debian_spec.rb +28 -0
- data/spec/unit/provider/service/gentoo_spec.rb +1 -0
- data/spec/unit/provider/service/init_spec.rb +6 -0
- data/spec/unit/provider/service/launchd_spec.rb +85 -10
- data/spec/unit/provider/service/openrc_spec.rb +1 -0
- data/spec/unit/provider/service/rcng_spec.rb +41 -0
- data/spec/unit/provider/service/redhat_spec.rb +8 -1
- data/spec/unit/provider/service/smf_spec.rb +30 -5
- data/spec/unit/provider/service/src_spec.rb +20 -4
- data/spec/unit/provider/service/systemd_spec.rb +79 -29
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +1 -1
- data/spec/unit/provider/sshkey/parsed_spec.rb +23 -0
- data/spec/unit/provider/user/windows_adsi_spec.rb +2 -1
- data/spec/unit/provider/zone/solaris_spec.rb +19 -0
- data/spec/unit/reports_spec.rb +10 -0
- data/spec/unit/resource/capability_finder_spec.rb +56 -0
- data/spec/unit/resource/catalog_spec.rb +31 -8
- data/spec/unit/resource/type_collection_spec.rb +23 -2
- data/spec/unit/resource/type_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +23 -5
- data/spec/unit/settings/file_setting_spec.rb +31 -0
- data/spec/unit/settings_spec.rb +91 -2
- data/spec/unit/ssl/certificate_authority/interface_spec.rb +4 -3
- data/spec/unit/ssl/certificate_authority_spec.rb +5 -3
- data/spec/unit/ssl/host_spec.rb +2 -2
- data/spec/unit/ssl/oids_spec.rb +8 -0
- data/spec/unit/transaction/additional_resource_generator_spec.rb +78 -5
- data/spec/unit/transaction/report_spec.rb +24 -1
- data/spec/unit/transaction_spec.rb +7 -0
- data/spec/unit/type/exec_spec.rb +16 -8
- data/spec/unit/type/host_spec.rb +4 -4
- data/spec/unit/type/package_spec.rb +1 -0
- data/spec/unit/type/tidy_spec.rb +4 -4
- data/spec/unit/type/user_spec.rb +14 -7
- data/spec/unit/type/vlan_spec.rb +1 -1
- data/spec/unit/type_spec.rb +1 -1
- data/spec/unit/util/ldap/generator_spec.rb +1 -1
- data/spec/unit/util/network_device/cisco/device_spec.rb +1 -1
- data/spec/unit/util/network_device/transport/ssh_spec.rb +1 -1
- data/spec/unit/util/network_device_spec.rb +1 -1
- data/spec/unit/util/storage_spec.rb +5 -1
- data/spec/unit/util/windows/adsi_spec.rb +13 -0
- data/spec/unit/util_spec.rb +21 -2
- metadata +173 -7
- data/lib/puppet/pops/evaluator/callable_mismatch_describer.rb +0 -175
- data/spec/integration/data_binding.rb +0 -104
|
@@ -60,7 +60,7 @@ describe 'The type factory' do
|
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
it 'tuple() returns PTupleType' do
|
|
63
|
-
expect(Puppet::Pops::Types::TypeFactory.tuple
|
|
63
|
+
expect(Puppet::Pops::Types::TypeFactory.tuple.class()).to eq(Puppet::Pops::Types::PTupleType)
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
it 'undef() returns PUndefType' do
|
|
@@ -136,7 +136,7 @@ describe 'The type factory' do
|
|
|
136
136
|
end
|
|
137
137
|
|
|
138
138
|
it 'array_of(PIntegerType) returns PArrayType[PIntegerType]' do
|
|
139
|
-
at = Puppet::Pops::Types::TypeFactory.array_of(Puppet::Pops::Types::PIntegerType
|
|
139
|
+
at = Puppet::Pops::Types::TypeFactory.array_of(Puppet::Pops::Types::PIntegerType::DEFAULT)
|
|
140
140
|
expect(at.class()).to eq(Puppet::Pops::Types::PArrayType)
|
|
141
141
|
expect(at.element_type.class).to eq(Puppet::Pops::Types::PIntegerType)
|
|
142
142
|
end
|
|
@@ -162,16 +162,14 @@ describe 'The type factory' do
|
|
|
162
162
|
end
|
|
163
163
|
|
|
164
164
|
it 'a size constrained collection can be created from array' do
|
|
165
|
-
t = Puppet::Pops::Types::TypeFactory.
|
|
166
|
-
expect(Puppet::Pops::Types::TypeFactory.constrain_size(t, 1,2)).to eq(t)
|
|
165
|
+
t = Puppet::Pops::Types::TypeFactory.array_of(Puppet::Pops::Types::TypeFactory.data, Puppet::Pops::Types::TypeFactory.range(1,2))
|
|
167
166
|
expect(t.size_type.class).to eq(Puppet::Pops::Types::PIntegerType)
|
|
168
167
|
expect(t.size_type.from).to eq(1)
|
|
169
168
|
expect(t.size_type.to).to eq(2)
|
|
170
169
|
end
|
|
171
170
|
|
|
172
171
|
it 'a size constrained collection can be created from hash' do
|
|
173
|
-
t = Puppet::Pops::Types::TypeFactory.
|
|
174
|
-
expect(Puppet::Pops::Types::TypeFactory.constrain_size(t, 1,2)).to eq(t)
|
|
172
|
+
t = Puppet::Pops::Types::TypeFactory.hash_of(Puppet::Pops::Types::TypeFactory.scalar, Puppet::Pops::Types::TypeFactory.data, Puppet::Pops::Types::TypeFactory.range(1,2))
|
|
175
173
|
expect(t.size_type.class).to eq(Puppet::Pops::Types::PIntegerType)
|
|
176
174
|
expect(t.size_type.from).to eq(1)
|
|
177
175
|
expect(t.size_type.to).to eq(2)
|
|
@@ -252,11 +250,11 @@ describe 'The type factory' do
|
|
|
252
250
|
end
|
|
253
251
|
|
|
254
252
|
it 'the with_block methods decorates a Callable with a block_type' do
|
|
255
|
-
t = Puppet::Pops::Types::TypeFactory.callable
|
|
256
|
-
t2 = Puppet::Pops::Types::TypeFactory.
|
|
253
|
+
t = Puppet::Pops::Types::TypeFactory.callable
|
|
254
|
+
t2 = Puppet::Pops::Types::TypeFactory.callable(t)
|
|
257
255
|
block_t = t2.block_type
|
|
258
256
|
# given t is returned after mutation
|
|
259
|
-
expect(
|
|
257
|
+
expect(block_t).to be(t)
|
|
260
258
|
expect(block_t.class).to be(Puppet::Pops::Types::PCallableType)
|
|
261
259
|
expect(block_t.param_types.class).to be(Puppet::Pops::Types::PTupleType)
|
|
262
260
|
expect(block_t.param_types.types).to be_empty
|
|
@@ -264,13 +262,15 @@ describe 'The type factory' do
|
|
|
264
262
|
end
|
|
265
263
|
|
|
266
264
|
it 'the with_optional_block methods decorates a Callable with an optional block_type' do
|
|
267
|
-
|
|
268
|
-
|
|
265
|
+
b = Puppet::Pops::Types::TypeFactory.callable
|
|
266
|
+
t = Puppet::Pops::Types::TypeFactory.optional(b)
|
|
267
|
+
t2 = Puppet::Pops::Types::TypeFactory.callable(t)
|
|
269
268
|
opt_t = t2.block_type
|
|
270
269
|
expect(opt_t.class).to be(Puppet::Pops::Types::POptionalType)
|
|
271
270
|
block_t = opt_t.optional_type
|
|
272
271
|
# given t is returned after mutation
|
|
273
|
-
expect(
|
|
272
|
+
expect(opt_t).to be(t)
|
|
273
|
+
expect(block_t).to be(b)
|
|
274
274
|
expect(block_t.class).to be(Puppet::Pops::Types::PCallableType)
|
|
275
275
|
expect(block_t.param_types.class).to be(Puppet::Pops::Types::PTupleType)
|
|
276
276
|
expect(block_t.param_types.types).to be_empty
|
|
@@ -66,6 +66,14 @@ describe Puppet::Pops::Types::TypeParser do
|
|
|
66
66
|
expect(parser.parse("Hash[Scalar, Integer]")).to be_the_type(types.hash_of(types.integer))
|
|
67
67
|
end
|
|
68
68
|
|
|
69
|
+
it 'interprets an Integer with one parameter to have unbounded upper range' do
|
|
70
|
+
expect(parser.parse('Integer[0]')).to eq(parser.parse('Integer[0,default]'))
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
it 'interprets a Float with one parameter to have unbounded upper range' do
|
|
74
|
+
expect(parser.parse('Float[0]')).to eq(parser.parse('Float[0,default]'))
|
|
75
|
+
end
|
|
76
|
+
|
|
69
77
|
it "parses a parameterized type into the type object" do
|
|
70
78
|
parameterized_array = types.array_of(types.integer)
|
|
71
79
|
parameterized_hash = types.hash_of(types.integer, types.boolean)
|
|
@@ -75,20 +83,16 @@ describe Puppet::Pops::Types::TypeParser do
|
|
|
75
83
|
end
|
|
76
84
|
|
|
77
85
|
it "parses a size constrained collection using capped range" do
|
|
78
|
-
parameterized_array = types.array_of(types.integer)
|
|
79
|
-
types.
|
|
80
|
-
parameterized_hash = types.hash_of(types.integer, types.boolean)
|
|
81
|
-
types.constrain_size(parameterized_hash, 1,2)
|
|
86
|
+
parameterized_array = types.array_of(types.integer, types.range(1,2))
|
|
87
|
+
parameterized_hash = types.hash_of(types.integer, types.boolean, types.range(1,2))
|
|
82
88
|
|
|
83
89
|
expect(the_type_parsed_from(parameterized_array)).to be_the_type(parameterized_array)
|
|
84
90
|
expect(the_type_parsed_from(parameterized_hash)).to be_the_type(parameterized_hash)
|
|
85
91
|
end
|
|
86
92
|
|
|
87
93
|
it "parses a size constrained collection with open range" do
|
|
88
|
-
parameterized_array = types.array_of(types.integer)
|
|
89
|
-
types.
|
|
90
|
-
parameterized_hash = types.hash_of(types.integer, types.boolean)
|
|
91
|
-
types.constrain_size(parameterized_hash, 1,:default)
|
|
94
|
+
parameterized_array = types.array_of(types.integer, types.range(1, :default))
|
|
95
|
+
parameterized_hash = types.hash_of(types.integer, types.boolean, types.range(1, :default))
|
|
92
96
|
|
|
93
97
|
expect(the_type_parsed_from(parameterized_array)).to be_the_type(parameterized_array)
|
|
94
98
|
expect(the_type_parsed_from(parameterized_hash)).to be_the_type(parameterized_hash)
|
|
@@ -100,13 +104,12 @@ describe Puppet::Pops::Types::TypeParser do
|
|
|
100
104
|
end
|
|
101
105
|
|
|
102
106
|
it "parses tuple type" do
|
|
103
|
-
tuple_t = types.tuple(Integer, String)
|
|
107
|
+
tuple_t = types.tuple([Integer, String])
|
|
104
108
|
expect(the_type_parsed_from(tuple_t)).to be_the_type(tuple_t)
|
|
105
109
|
end
|
|
106
110
|
|
|
107
111
|
it "parses tuple type with occurrence constraint" do
|
|
108
|
-
tuple_t = types.tuple(Integer, String)
|
|
109
|
-
types.constrain_size(tuple_t, 2, 5)
|
|
112
|
+
tuple_t = types.tuple([Integer, String], types.range(2, 5))
|
|
110
113
|
expect(the_type_parsed_from(tuple_t)).to be_the_type(tuple_t)
|
|
111
114
|
end
|
|
112
115
|
|
|
@@ -165,7 +168,7 @@ describe Puppet::Pops::Types::TypeParser do
|
|
|
165
168
|
end
|
|
166
169
|
|
|
167
170
|
it 'parses a collection size range' do
|
|
168
|
-
expect(parser.parse("Collection[1,2]")).to be_the_type(types.
|
|
171
|
+
expect(parser.parse("Collection[1,2]")).to be_the_type(types.collection(types.range(1,2)))
|
|
169
172
|
end
|
|
170
173
|
|
|
171
174
|
it 'parses a type type' do
|
|
@@ -119,6 +119,30 @@ describe "validating 4x" do
|
|
|
119
119
|
end
|
|
120
120
|
end
|
|
121
121
|
|
|
122
|
+
context 'for future reserved words' do
|
|
123
|
+
['application', 'produces', 'consumes'].each do |word|
|
|
124
|
+
it "produces an issue for the word '#{word}'" do
|
|
125
|
+
source = "$a = #{word}"
|
|
126
|
+
expect(validate(parse(source))).to have_issue(Puppet::Pops::Issues::FUTURE_RESERVED_WORD)
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
it 'produces a warning issue when used as a class name' do
|
|
130
|
+
source = "class #{word} {}"
|
|
131
|
+
expect(validate(parse(source))).to have_issue(Puppet::Pops::Issues::FUTURE_RESERVED_WORD)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
it 'produces no warning or error when used as a parameter name' do
|
|
135
|
+
source = "define foo($#{word}) { notice $#{word} }"
|
|
136
|
+
expect(validate(parse(source)).diagnostics.empty?).to eq(true)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
it 'produces no warning or error when used as an attribute name' do
|
|
140
|
+
source = "foo { bar: #{word} => ok }"
|
|
141
|
+
expect(validate(parse(source)).diagnostics.empty?).to eq(true)
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
|
|
122
146
|
context 'for reserved type names' do
|
|
123
147
|
[# type/Type, is a reserved name but results in syntax error because it is a keyword in lower case form
|
|
124
148
|
'any',
|
|
@@ -177,6 +201,25 @@ describe "validating 4x" do
|
|
|
177
201
|
end
|
|
178
202
|
end
|
|
179
203
|
|
|
204
|
+
context 'for badly formed non-numeric parameter names' do
|
|
205
|
+
['Ateam', 'a::team'].each do |word|
|
|
206
|
+
it "produces an error when $#{word} is used as a parameter in a class" do
|
|
207
|
+
source = "class x ($#{word}) {}"
|
|
208
|
+
expect(validate(parse(source))).to have_issue(Puppet::Pops::Issues::ILLEGAL_PARAM_NAME)
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
it "produces an error when $#{word} is used as a parameter in a define" do
|
|
212
|
+
source = "define x ($#{word}) {}"
|
|
213
|
+
expect(validate(parse(source))).to have_issue(Puppet::Pops::Issues::ILLEGAL_PARAM_NAME)
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
it "produces an error when $#{word} is used as a parameter in a lambda" do
|
|
217
|
+
source = "with() |$#{word}| {}"
|
|
218
|
+
expect(validate(parse(source))).to have_issue(Puppet::Pops::Issues::ILLEGAL_PARAM_NAME)
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
end
|
|
222
|
+
|
|
180
223
|
context 'top level constructs in conditionals' do
|
|
181
224
|
['class', 'define', 'node'].each do |word|
|
|
182
225
|
it "produces an error when $#{word} is nested in an if expression" do
|
|
@@ -200,6 +243,31 @@ describe "validating 4x" do
|
|
|
200
243
|
end
|
|
201
244
|
end
|
|
202
245
|
|
|
246
|
+
context "capability annotations" do
|
|
247
|
+
before(:each) do
|
|
248
|
+
with_app_management(true)
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
after(:each) do
|
|
252
|
+
with_app_management(false)
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
['produces', 'consumes'].each do |word|
|
|
256
|
+
it "rejects illegal resource types in #{word} clauses" do
|
|
257
|
+
expect(validate(parse("foo produces Bar {}"))).to have_issue(Puppet::Pops::Issues::ILLEGAL_CLASSREF)
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
it "accepts legal resource and capability types in #{word} clauses" do
|
|
261
|
+
expect(validate(parse("Foo produces Bar {}"))).to_not have_issue(Puppet::Pops::Issues::ILLEGAL_CLASSREF)
|
|
262
|
+
expect(validate(parse("Mod::Foo produces ::Mod2::Bar {}"))).to_not have_issue(Puppet::Pops::Issues::ILLEGAL_CLASSREF)
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
it "rejects illegal capability types in #{word} clauses" do
|
|
266
|
+
expect(validate(parse("Foo produces bar {}"))).to have_issue(Puppet::Pops::Issues::ILLEGAL_CLASSREF)
|
|
267
|
+
end
|
|
268
|
+
end
|
|
269
|
+
end
|
|
270
|
+
|
|
203
271
|
def parse(source)
|
|
204
272
|
Puppet::Pops::Parser::Parser.new().parse_string(source)
|
|
205
273
|
end
|
data/spec/unit/property_spec.rb
CHANGED
|
@@ -230,7 +230,7 @@ describe Puppet::Property do
|
|
|
230
230
|
it "should fail if the value is not a defined value or alias and does not match a regex" do
|
|
231
231
|
subclass.newvalue(:foo)
|
|
232
232
|
|
|
233
|
-
expect { property.should = "bar" }.to raise_error
|
|
233
|
+
expect { property.should = "bar" }.to raise_error(Puppet::Error, /Invalid value "bar"./)
|
|
234
234
|
end
|
|
235
235
|
|
|
236
236
|
it "should succeeed if the value is one of the defined values" do
|
|
@@ -195,6 +195,56 @@ describe provider_class do
|
|
|
195
195
|
end
|
|
196
196
|
end
|
|
197
197
|
|
|
198
|
+
describe "values filters" do
|
|
199
|
+
before do
|
|
200
|
+
augeas = stub("augeas", :match => ["set", "of", "values"])
|
|
201
|
+
augeas.stubs(:get).returns('set').then.returns('of').then.returns('values')
|
|
202
|
+
augeas.stubs("close")
|
|
203
|
+
@provider = provider_class.new(@resource)
|
|
204
|
+
@provider.aug = augeas
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
it "should return true for includes match" do
|
|
208
|
+
command = ["values", "fake value", "include values"]
|
|
209
|
+
expect(@provider.process_values(command)).to eq(true)
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
it "should return false for includes non match" do
|
|
213
|
+
command = ["values", "fake value", "include JarJar"]
|
|
214
|
+
expect(@provider.process_values(command)).to eq(false)
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
it "should return true for includes match" do
|
|
218
|
+
command = ["values", "fake value", "not_include JarJar"]
|
|
219
|
+
expect(@provider.process_values(command)).to eq(true)
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
it "should return false for includes non match" do
|
|
223
|
+
command = ["values", "fake value", "not_include values"]
|
|
224
|
+
expect(@provider.process_values(command)).to eq(false)
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
it "should return true for an array match" do
|
|
228
|
+
command = ["values", "fake value", "== ['set', 'of', 'values']"]
|
|
229
|
+
expect(@provider.process_values(command)).to eq(true)
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
it "should return false for an array non match" do
|
|
233
|
+
command = ["values", "fake value", "== ['this', 'should', 'not', 'match']"]
|
|
234
|
+
expect(@provider.process_values(command)).to eq(false)
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
it "should return false for an array match with noteq" do
|
|
238
|
+
command = ["values", "fake value", "!= ['set', 'of', 'values']"]
|
|
239
|
+
expect(@provider.process_values(command)).to eq(false)
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
it "should return true for an array non match with noteq" do
|
|
243
|
+
command = ["values", "fake value", "!= ['this', 'should', 'not', 'match']"]
|
|
244
|
+
expect(@provider.process_values(command)).to eq(true)
|
|
245
|
+
end
|
|
246
|
+
end
|
|
247
|
+
|
|
198
248
|
describe "match filters" do
|
|
199
249
|
before do
|
|
200
250
|
augeas = stub("augeas", :match => ["set", "of", "values"])
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Puppet::Type.type(:group).provider(:directoryservice) do
|
|
4
|
+
let :resource do
|
|
5
|
+
Puppet::Type.type(:group).new(
|
|
6
|
+
:title => 'testgroup',
|
|
7
|
+
:provider => :directoryservice,
|
|
8
|
+
)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
let(:provider) { resource.provider }
|
|
12
|
+
|
|
13
|
+
it 'should return true for same lists of unordered members' do
|
|
14
|
+
expect(provider.members_insync?(['user1', 'user2'], ['user2', 'user1'])).to be_truthy
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it 'should return false when the group currently has no members' do
|
|
18
|
+
expect(provider.members_insync?([], ['user2', 'user1'])).to be_falsey
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it 'should return true for the same lists of members irrespective of duplicates' do
|
|
22
|
+
expect(provider.members_insync?(['user1', 'user2', 'user2'], ['user1', 'user2'])).to be_truthy
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "should return true when current and should members are empty lists" do
|
|
26
|
+
expect(provider.members_insync?([], [])).to be_truthy
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it "should return true when current is :absent and should members is empty list" do
|
|
30
|
+
expect(provider.members_insync?(:absent, [])).to be_truthy
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
@@ -162,6 +162,9 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
|
|
|
162
162
|
it "should return the username when it cannot be resolved to a SID (for the sake of resource_harness error messages)" do
|
|
163
163
|
expect(provider.members_to_s([invalid_user])).to eq("#{invalid_user}")
|
|
164
164
|
end
|
|
165
|
+
it "should return the username when it cannot be resolved to a SID (for the sake of resource_harness error messages)" do
|
|
166
|
+
expect(provider.members_to_s([invalid_user])).to eq("#{invalid_user}")
|
|
167
|
+
end
|
|
165
168
|
end
|
|
166
169
|
end
|
|
167
170
|
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
# Note that much of the functionality of the dnf provider is already tested with yum provider tests,
|
|
4
|
+
# as yum is the parent provider.
|
|
5
|
+
|
|
6
|
+
provider_class = Puppet::Type.type(:package).provider(:dnf)
|
|
7
|
+
|
|
8
|
+
describe provider_class do
|
|
9
|
+
let(:name) { 'mypackage' }
|
|
10
|
+
let(:resource) do
|
|
11
|
+
Puppet::Type.type(:package).new(
|
|
12
|
+
:name => name,
|
|
13
|
+
:ensure => :installed,
|
|
14
|
+
:provider => 'dnf'
|
|
15
|
+
)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
let(:provider) do
|
|
19
|
+
provider = provider_class.new
|
|
20
|
+
provider.resource = resource
|
|
21
|
+
provider
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
before do
|
|
25
|
+
provider_class.stubs(:command).with(:cmd).returns('/usr/bin/dnf')
|
|
26
|
+
provider.stubs(:rpm).returns 'rpm'
|
|
27
|
+
provider.stubs(:get).with(:version).returns '1'
|
|
28
|
+
provider.stubs(:get).with(:release).returns '1'
|
|
29
|
+
provider.stubs(:get).with(:arch).returns 'i386'
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
describe 'provider features' do
|
|
33
|
+
it { is_expected.to be_versionable }
|
|
34
|
+
it { is_expected.to be_install_options }
|
|
35
|
+
it { is_expected.to be_virtual_packages }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# provider should repond to the following methods
|
|
39
|
+
[:install, :latest, :update, :purge, :install_options].each do |method|
|
|
40
|
+
it "should have a(n) #{method}" do
|
|
41
|
+
expect(provider).to respond_to(method)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
describe 'when installing' do
|
|
46
|
+
before(:each) do
|
|
47
|
+
Puppet::Util.stubs(:which).with("rpm").returns("/bin/rpm")
|
|
48
|
+
provider.stubs(:which).with("rpm").returns("/bin/rpm")
|
|
49
|
+
Puppet::Util::Execution.expects(:execute).with(["/bin/rpm", "--version"], {:combine => true, :custom_environment => {}, :failonfail => true}).returns("4.10.1\n").at_most_once
|
|
50
|
+
Facter.stubs(:value).with(:operatingsystemmajrelease).returns('22')
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
it 'should call dnf install for :installed' do
|
|
54
|
+
resource.stubs(:should).with(:ensure).returns :installed
|
|
55
|
+
Puppet::Util::Execution.expects(:execute).with(['/usr/bin/dnf', '-d', '0', '-e', '1', '-y', :install, 'mypackage'])
|
|
56
|
+
provider.install
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
it 'should be able to downgrade' do
|
|
60
|
+
current_version = '1.2'
|
|
61
|
+
version = '1.0'
|
|
62
|
+
resource[:ensure] = '1.0'
|
|
63
|
+
Puppet::Util::Execution.expects(:execute).with(['/usr/bin/dnf', '-d', '0', '-e', '1', '-y', :downgrade, "#{name}-#{version}"])
|
|
64
|
+
provider.stubs(:query).returns(:ensure => current_version).then.returns(:ensure => version)
|
|
65
|
+
provider.install
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
it 'should accept install options' do
|
|
69
|
+
resource[:ensure] = :installed
|
|
70
|
+
resource[:install_options] = ['-t', {'-x' => 'expackage'}]
|
|
71
|
+
|
|
72
|
+
Puppet::Util::Execution.expects(:execute).with(['/usr/bin/dnf', '-d', '0', '-e', '1', '-y', ['-t', '-x=expackage'], :install, name])
|
|
73
|
+
provider.install
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
describe 'when uninstalling' do
|
|
78
|
+
it 'should use erase to purge' do
|
|
79
|
+
Puppet::Util::Execution.expects(:execute).with(['/usr/bin/dnf', '-y', :erase, name])
|
|
80
|
+
provider.purge
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
describe "executing yum check-update" do
|
|
85
|
+
it "passes repos to enable to 'yum check-update'" do
|
|
86
|
+
Puppet::Util::Execution.expects(:execute).with do |args, *rest|
|
|
87
|
+
expect(args).to eq %w[/usr/bin/dnf check-update --enablerepo=updates --enablerepo=fedoraplus]
|
|
88
|
+
end.returns(stub(:exitstatus => 0))
|
|
89
|
+
described_class.check_updates(%w[updates fedoraplus], [], [])
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
@@ -88,6 +88,13 @@ context 'installing myresource' do
|
|
|
88
88
|
provider.install
|
|
89
89
|
end
|
|
90
90
|
end
|
|
91
|
+
describe "as a windows path on windows", :if => Puppet.features.microsoft_windows? do
|
|
92
|
+
it "should treat the source as a local path" do
|
|
93
|
+
resource[:source] = "c:/this/is/a/path/to/a/gem.gem"
|
|
94
|
+
provider.expects(:execute).with { |args| args[2] == "c:/this/is/a/path/to/a/gem.gem" }.returns ""
|
|
95
|
+
provider.install
|
|
96
|
+
end
|
|
97
|
+
end
|
|
91
98
|
describe "with an invalid uri" do
|
|
92
99
|
it "should fail" do
|
|
93
100
|
URI.expects(:parse).raises(ArgumentError)
|
|
@@ -50,7 +50,7 @@ END
|
|
|
50
50
|
it "should install a package" do
|
|
51
51
|
|
|
52
52
|
@resource.stubs(:should).with(:ensure).returns(:installed)
|
|
53
|
-
Puppet::Util.expects(:execute).with("/usr/sbin/nimclient -o showres -a resource=mysource |/usr/bin/grep -p -E 'mypackage\\.foo'").returns(bff_showres_output)
|
|
53
|
+
Puppet::Util::Execution.expects(:execute).with("/usr/sbin/nimclient -o showres -a resource=mysource |/usr/bin/grep -p -E 'mypackage\\.foo'").returns(bff_showres_output)
|
|
54
54
|
@provider.expects(:nimclient).with("-o", "cust", "-a", "installp_flags=acgwXY", "-a", "lpp_source=mysource", "-a", "filesets=mypackage.foo 1.2.3.8")
|
|
55
55
|
@provider.install
|
|
56
56
|
end
|
|
@@ -61,7 +61,7 @@ END
|
|
|
61
61
|
nimclient_showres_output = ""
|
|
62
62
|
|
|
63
63
|
@resource.stubs(:should).with(:ensure).returns("1.2.3.4")
|
|
64
|
-
Puppet::Util.expects(:execute).with("/usr/sbin/nimclient -o showres -a resource=mysource |/usr/bin/grep -p -E 'mypackage\\.foo( |-)1\\.2\\.3\\.4'").returns(nimclient_showres_output)
|
|
64
|
+
Puppet::Util::Execution.expects(:execute).with("/usr/sbin/nimclient -o showres -a resource=mysource |/usr/bin/grep -p -E 'mypackage\\.foo( |-)1\\.2\\.3\\.4'").returns(nimclient_showres_output)
|
|
65
65
|
expect {
|
|
66
66
|
@provider.install
|
|
67
67
|
}.to raise_error(Puppet::Error, "Unable to find package 'mypackage.foo' with version '1.2.3.4' on lpp_source 'mysource'")
|
|
@@ -71,7 +71,7 @@ END
|
|
|
71
71
|
nimclient_sequence = sequence('nimclient')
|
|
72
72
|
|
|
73
73
|
@resource.stubs(:should).with(:ensure).returns("1.2.3.4")
|
|
74
|
-
Puppet::Util.expects(:execute).with("/usr/sbin/nimclient -o showres -a resource=mysource |/usr/bin/grep -p -E 'mypackage\\.foo( |-)1\\.2\\.3\\.4'").returns(bff_showres_output).in_sequence(nimclient_sequence)
|
|
74
|
+
Puppet::Util::Execution.expects(:execute).with("/usr/sbin/nimclient -o showres -a resource=mysource |/usr/bin/grep -p -E 'mypackage\\.foo( |-)1\\.2\\.3\\.4'").returns(bff_showres_output).in_sequence(nimclient_sequence)
|
|
75
75
|
@provider.expects(:nimclient).with("-o", "cust", "-a", "installp_flags=acgwXY", "-a", "lpp_source=mysource", "-a", "filesets=mypackage.foo 1.2.3.4").in_sequence(nimclient_sequence)
|
|
76
76
|
@provider.install
|
|
77
77
|
end
|
|
@@ -125,7 +125,7 @@ mypackage.foo 1.2.3.1 Already superseded by 1.2.3.4
|
|
|
125
125
|
OUTPUT
|
|
126
126
|
|
|
127
127
|
@resource.stubs(:should).with(:ensure).returns("1.2.3.1")
|
|
128
|
-
Puppet::Util.expects(:execute).with("/usr/sbin/nimclient -o showres -a resource=mysource |/usr/bin/grep -p -E 'mypackage\\.foo( |-)1\\.2\\.3\\.1'").returns(bff_showres_output).in_sequence(nimclient_sequence)
|
|
128
|
+
Puppet::Util::Execution.expects(:execute).with("/usr/sbin/nimclient -o showres -a resource=mysource |/usr/bin/grep -p -E 'mypackage\\.foo( |-)1\\.2\\.3\\.1'").returns(bff_showres_output).in_sequence(nimclient_sequence)
|
|
129
129
|
@provider.expects(:nimclient).with("-o", "cust", "-a", "installp_flags=acgwXY", "-a", "lpp_source=mysource", "-a", "filesets=mypackage.foo 1.2.3.1").in_sequence(nimclient_sequence).returns(install_output)
|
|
130
130
|
|
|
131
131
|
expect { @provider.install }.to raise_error(Puppet::Error, "NIM package provider is unable to downgrade packages")
|
|
@@ -136,7 +136,7 @@ OUTPUT
|
|
|
136
136
|
nimclient_sequence = sequence('nimclient')
|
|
137
137
|
|
|
138
138
|
@resource.stubs(:should).with(:ensure).returns("1.2.3-4")
|
|
139
|
-
Puppet::Util.expects(:execute).with("/usr/sbin/nimclient -o showres -a resource=mysource |/usr/bin/grep -p -E 'mypackage\\.foo( |-)1\\.2\\.3\\-4'").returns(rpm_showres_output).in_sequence(nimclient_sequence)
|
|
139
|
+
Puppet::Util::Execution.expects(:execute).with("/usr/sbin/nimclient -o showres -a resource=mysource |/usr/bin/grep -p -E 'mypackage\\.foo( |-)1\\.2\\.3\\-4'").returns(rpm_showres_output).in_sequence(nimclient_sequence)
|
|
140
140
|
@provider.expects(:nimclient).with("-o", "cust", "-a", "installp_flags=acgwXY", "-a", "lpp_source=mysource", "-a", "filesets=mypackage.foo-1.2.3-4").in_sequence(nimclient_sequence)
|
|
141
141
|
@provider.install
|
|
142
142
|
end
|
|
@@ -163,7 +163,7 @@ mypackage.foo-1.2.3-1 is superseded by mypackage.foo-1.2.3-4
|
|
|
163
163
|
OUTPUT
|
|
164
164
|
|
|
165
165
|
@resource.stubs(:should).with(:ensure).returns("1.2.3-1")
|
|
166
|
-
Puppet::Util.expects(:execute).with("/usr/sbin/nimclient -o showres -a resource=mysource |/usr/bin/grep -p -E 'mypackage\\.foo( |-)1\\.2\\.3\\-1'").returns(rpm_showres_output).in_sequence(nimclient_sequence)
|
|
166
|
+
Puppet::Util::Execution.expects(:execute).with("/usr/sbin/nimclient -o showres -a resource=mysource |/usr/bin/grep -p -E 'mypackage\\.foo( |-)1\\.2\\.3\\-1'").returns(rpm_showres_output).in_sequence(nimclient_sequence)
|
|
167
167
|
@provider.expects(:nimclient).with("-o", "cust", "-a", "installp_flags=acgwXY", "-a", "lpp_source=mysource", "-a", "filesets=mypackage.foo-1.2.3-1").in_sequence(nimclient_sequence).returns(install_output)
|
|
168
168
|
|
|
169
169
|
expect { @provider.install }.to raise_error(Puppet::Error, "NIM package provider is unable to downgrade packages")
|
|
@@ -12,6 +12,7 @@ describe provider_class do
|
|
|
12
12
|
chkconfig 0 1.3.30.2 2.el5 x86_64
|
|
13
13
|
myresource 0 1.2.3.4 5.el4 noarch
|
|
14
14
|
mysummaryless 0 1.2.3.4 5.el4 noarch
|
|
15
|
+
tomcat 1 1.2.3.4 5.fc22 noarch
|
|
15
16
|
RPM_OUTPUT
|
|
16
17
|
end
|
|
17
18
|
|
|
@@ -116,7 +117,18 @@ describe provider_class do
|
|
|
116
117
|
:ensure => "1.3.30.2-2.el5",
|
|
117
118
|
}
|
|
118
119
|
)
|
|
119
|
-
expect(installed_packages.
|
|
120
|
+
expect(installed_packages[3].properties).to eq(
|
|
121
|
+
{
|
|
122
|
+
:provider => :rpm,
|
|
123
|
+
:name => "myresource",
|
|
124
|
+
:epoch => "0",
|
|
125
|
+
:version => "1.2.3.4",
|
|
126
|
+
:release => "5.el4",
|
|
127
|
+
:arch => "noarch",
|
|
128
|
+
:ensure => "1.2.3.4-5.el4",
|
|
129
|
+
}
|
|
130
|
+
)
|
|
131
|
+
expect(installed_packages[4].properties).to eq(
|
|
120
132
|
{
|
|
121
133
|
:provider => :rpm,
|
|
122
134
|
:name => "mysummaryless",
|
|
@@ -127,6 +139,17 @@ describe provider_class do
|
|
|
127
139
|
:ensure => "1.2.3.4-5.el4",
|
|
128
140
|
}
|
|
129
141
|
)
|
|
142
|
+
expect(installed_packages[5].properties).to eq(
|
|
143
|
+
{
|
|
144
|
+
:provider => :rpm,
|
|
145
|
+
:name => "tomcat",
|
|
146
|
+
:epoch => "1",
|
|
147
|
+
:version => "1.2.3.4",
|
|
148
|
+
:release => "5.fc22",
|
|
149
|
+
:arch => "noarch",
|
|
150
|
+
:ensure => "1:1.2.3.4-5.fc22",
|
|
151
|
+
}
|
|
152
|
+
)
|
|
130
153
|
end
|
|
131
154
|
end
|
|
132
155
|
|
|
@@ -269,7 +292,7 @@ describe provider_class do
|
|
|
269
292
|
line.gsub(field, delimiter),
|
|
270
293
|
package_hash.merge(
|
|
271
294
|
field.to_sym => delimiter,
|
|
272
|
-
:ensure => 'version-release'.gsub(field, delimiter)
|
|
295
|
+
:ensure => 'epoch:version-release'.gsub(field, delimiter)
|
|
273
296
|
)
|
|
274
297
|
)
|
|
275
298
|
end
|
|
@@ -132,6 +132,47 @@ describe Puppet::Provider::Package::Windows::Package do
|
|
|
132
132
|
end
|
|
133
133
|
end
|
|
134
134
|
|
|
135
|
+
context '::get_display_name' do
|
|
136
|
+
it 'should return nil if values is nil' do
|
|
137
|
+
expect(subject.get_display_name(nil)).to be_nil
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
it 'should return empty if values is empty' do
|
|
141
|
+
reg_values = {}
|
|
142
|
+
expect(subject.get_display_name(reg_values)).to eq('')
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
it 'should return DisplayName when available' do
|
|
146
|
+
reg_values = { 'DisplayName' => 'Google' }
|
|
147
|
+
expect(subject.get_display_name(reg_values)).to eq('Google')
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
it 'should return DisplayName when available, even when QuietDisplayName is also available' do
|
|
151
|
+
reg_values = { 'DisplayName' => 'Google', 'QuietDisplayName' => 'Google Quiet' }
|
|
152
|
+
expect(subject.get_display_name(reg_values)).to eq('Google')
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
it 'should return QuietDisplayName when available if DisplayName is empty' do
|
|
156
|
+
reg_values = { 'DisplayName' => '', 'QuietDisplayName' =>'Google Quiet' }
|
|
157
|
+
expect(subject.get_display_name(reg_values)).to eq('Google Quiet')
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
it 'should return QuietDisplayName when DisplayName is not available' do
|
|
161
|
+
reg_values = { 'QuietDisplayName' =>'Google Quiet' }
|
|
162
|
+
expect(subject.get_display_name(reg_values)).to eq('Google Quiet')
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
it 'should return empty when DisplayName is empty and QuietDisplay name is not available' do
|
|
166
|
+
reg_values = { 'DisplayName' => '' }
|
|
167
|
+
expect(subject.get_display_name(reg_values)).to eq('')
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
it 'should return empty when DisplayName is empty and QuietDisplay name is empty' do
|
|
171
|
+
reg_values = { 'DisplayName' => '', 'QuietDisplayName' =>'' }
|
|
172
|
+
expect(subject.get_display_name(reg_values)).to eq('')
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
|
|
135
176
|
it 'should implement instance methods' do
|
|
136
177
|
pkg = subject.new('orca', '5.0')
|
|
137
178
|
|