puppet 5.3.7-universal-darwin → 5.4.0-universal-darwin
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +42 -29
- data/README.md +8 -6
- data/ext/cert_inspector +2 -2
- data/ext/envpuppet +1 -1
- data/ext/gentoo/init.d/puppetmaster +4 -4
- data/ext/ips/puppet-agent +11 -11
- data/ext/ips/puppet-master +11 -11
- data/ext/puppet-test +1 -2
- data/ext/redhat/client.init +2 -2
- data/ext/redhat/logrotate +1 -1
- data/ext/solaris/smf/puppet +11 -11
- data/ext/solaris/smf/svc-puppetd +5 -5
- data/ext/solaris/smf/svc-puppetmasterd +5 -5
- data/ext/windows/service/daemon.rb +1 -1
- data/install.rb +2 -3
- data/lib/puppet/agent.rb +1 -1
- data/lib/puppet/application/cert.rb +1 -3
- data/lib/puppet/application/describe.rb +0 -1
- data/lib/puppet/application/device.rb +12 -99
- data/lib/puppet/application/filebucket.rb +32 -11
- data/lib/puppet/application/lookup.rb +1 -11
- data/lib/puppet/application/script.rb +261 -0
- data/lib/puppet/configurer.rb +3 -4
- data/lib/puppet/configurer/plugin_handler.rb +26 -9
- data/lib/puppet/context.rb +1 -1
- data/lib/puppet/datatypes.rb +213 -0
- data/lib/puppet/datatypes/error.rb +21 -0
- data/lib/puppet/datatypes/impl/error.rb +40 -0
- data/lib/puppet/defaults.rb +51 -20
- data/lib/puppet/environments.rb +17 -0
- data/lib/puppet/error.rb +17 -0
- data/lib/puppet/etc.rb +2 -2
- data/lib/puppet/external/pson/pure/generator.rb +1 -1
- data/lib/puppet/external/pson/pure/parser.rb +1 -1
- data/lib/puppet/face/config.rb +45 -0
- data/lib/puppet/face/epp.rb +3 -3
- data/lib/puppet/face/help/action.erb +3 -0
- data/lib/puppet/face/module/build.rb +1 -0
- data/lib/puppet/face/module/generate.rb +5 -0
- data/lib/puppet/face/module/install.rb +1 -0
- data/lib/puppet/face/module/search.rb +6 -2
- data/lib/puppet/face/module/uninstall.rb +1 -0
- data/lib/puppet/face/module/upgrade.rb +1 -0
- data/lib/puppet/face/parser.rb +0 -1
- data/lib/puppet/face/plugin.rb +1 -3
- data/lib/puppet/feature/base.rb +1 -1
- data/lib/puppet/feature/bolt.rb +3 -0
- data/lib/puppet/file_bucket/dipper.rb +1 -2
- data/lib/puppet/file_serving/http_metadata.rb +1 -1
- data/lib/puppet/file_system/uniquefile.rb +2 -2
- data/lib/puppet/forge.rb +6 -0
- data/lib/puppet/functions.rb +70 -88
- data/lib/puppet/functions/all.rb +6 -2
- data/lib/puppet/functions/annotate.rb +1 -1
- data/lib/puppet/functions/any.rb +7 -3
- data/lib/puppet/functions/contain.rb +6 -0
- data/lib/puppet/functions/convert_to.rb +32 -0
- data/lib/puppet/functions/defined.rb +0 -3
- data/lib/puppet/functions/each.rb +10 -6
- data/lib/puppet/functions/filter.rb +16 -10
- data/lib/puppet/functions/find_file.rb +0 -1
- data/lib/puppet/functions/include.rb +6 -0
- data/lib/puppet/functions/map.rb +12 -9
- data/lib/puppet/functions/module_directory.rb +41 -0
- data/lib/puppet/functions/new.rb +1 -4
- data/lib/puppet/functions/regsubst.rb +1 -1
- data/lib/puppet/functions/require.rb +6 -0
- data/lib/puppet/generate/type.rb +1 -1
- data/lib/puppet/gettext/config.rb +2 -2
- data/lib/puppet/gettext/stubs.rb +1 -1
- data/lib/puppet/indirector/catalog/compiler.rb +0 -1
- data/lib/puppet/indirector/file_bucket_file/file.rb +6 -2
- data/lib/puppet/indirector/file_server.rb +1 -1
- data/lib/puppet/indirector/node/ldap.rb +19 -3
- data/lib/puppet/indirector/request.rb +10 -6
- data/lib/puppet/indirector/rest.rb +11 -12
- data/lib/puppet/info_service/class_information_service.rb +1 -1
- data/lib/puppet/interface/action.rb +11 -0
- data/lib/puppet/interface/action_builder.rb +8 -0
- data/lib/puppet/interface/option_manager.rb +1 -1
- data/lib/puppet/loaders.rb +2 -0
- data/lib/puppet/module.rb +6 -2
- data/lib/puppet/module_tool/applications/builder.rb +4 -0
- data/lib/puppet/module_tool/applications/installer.rb +3 -0
- data/lib/puppet/module_tool/applications/uninstaller.rb +3 -0
- data/lib/puppet/module_tool/applications/unpacker.rb +1 -1
- data/lib/puppet/module_tool/applications/upgrader.rb +3 -0
- data/lib/puppet/module_tool/installed_modules.rb +1 -1
- data/lib/puppet/module_tool/metadata.rb +0 -1
- data/lib/puppet/network/authstore.rb +1 -1
- data/lib/puppet/network/http/api/indirected_routes.rb +1 -1
- data/lib/puppet/network/http/connection.rb +1 -9
- data/lib/puppet/network/http/factory.rb +0 -3
- data/lib/puppet/network/http/webrick.rb +1 -0
- data/lib/puppet/network/rights.rb +1 -1
- data/lib/puppet/node.rb +53 -0
- data/lib/puppet/node/environment.rb +1 -1
- data/lib/puppet/parameter/boolean.rb +1 -1
- data/lib/puppet/parser.rb +1 -0
- data/lib/puppet/parser/abstract_compiler.rb +36 -0
- data/lib/puppet/parser/ast/branch.rb +1 -1
- data/lib/puppet/parser/ast/pops_bridge.rb +8 -52
- data/lib/puppet/parser/compiler.rb +4 -54
- data/lib/puppet/parser/functions.rb +0 -1
- data/lib/puppet/parser/functions/create_resources.rb +6 -0
- data/lib/puppet/parser/functions/fqdn_rand.rb +6 -2
- data/lib/puppet/parser/functions/inline_template.rb +6 -0
- data/lib/puppet/parser/functions/new.rb +47 -32
- data/lib/puppet/parser/functions/realize.rb +6 -0
- data/lib/puppet/parser/functions/return.rb +1 -22
- data/lib/puppet/parser/functions/reverse_each.rb +1 -1
- data/lib/puppet/parser/functions/scanf.rb +1 -1
- data/lib/puppet/parser/functions/sha256.rb +5 -0
- data/lib/puppet/parser/functions/tag.rb +6 -0
- data/lib/puppet/parser/functions/tagged.rb +6 -0
- data/lib/puppet/parser/functions/template.rb +5 -0
- data/lib/puppet/parser/scope.rb +28 -4
- data/lib/puppet/parser/script_compiler.rb +118 -0
- data/lib/puppet/parser/type_loader.rb +1 -1
- data/lib/puppet/pops.rb +1 -1
- data/lib/puppet/pops/evaluator/access_operator.rb +38 -4
- data/lib/puppet/pops/evaluator/closure.rb +12 -4
- data/lib/puppet/pops/evaluator/compare_operator.rb +4 -4
- data/lib/puppet/pops/evaluator/epp_evaluator.rb +13 -0
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +38 -10
- data/lib/puppet/pops/evaluator/literal_evaluator.rb +1 -1
- data/lib/puppet/pops/evaluator/runtime3_converter.rb +1 -1
- data/lib/puppet/pops/evaluator/runtime3_support.rb +2 -3
- data/lib/puppet/pops/functions/dispatch.rb +6 -5
- data/lib/puppet/pops/functions/function.rb +2 -2
- data/lib/puppet/pops/issues.rb +34 -2
- data/lib/puppet/pops/loader/base_loader.rb +10 -0
- data/lib/puppet/pops/loader/dependency_loader.rb +7 -0
- data/lib/puppet/pops/loader/loader.rb +21 -2
- data/lib/puppet/pops/loader/loader_paths.rb +180 -30
- data/lib/puppet/pops/loader/module_loaders.rb +202 -33
- data/lib/puppet/pops/loader/puppet_plan_instantiator.rb +84 -0
- data/lib/puppet/pops/loader/puppet_resource_type_impl_instantiator.rb +9 -9
- data/lib/puppet/pops/loader/ruby_data_type_instantiator.rb +40 -0
- data/lib/puppet/pops/loader/runtime3_type_loader.rb +6 -1
- data/lib/puppet/pops/loader/static_loader.rb +23 -8
- data/lib/puppet/pops/loader/task_instantiator.rb +69 -0
- data/lib/puppet/pops/loader/type_definition_instantiator.rb +4 -0
- data/lib/puppet/pops/loaders.rb +122 -11
- data/lib/puppet/pops/lookup/data_dig_function_provider.rb +1 -1
- data/lib/puppet/pops/lookup/interpolation.rb +1 -1
- data/lib/puppet/pops/lookup/lookup_adapter.rb +0 -1
- data/lib/puppet/pops/model/ast.pp +3 -0
- data/lib/puppet/pops/model/ast.rb +34 -1
- data/lib/puppet/pops/model/factory.rb +30 -3
- data/lib/puppet/pops/model/model_label_provider.rb +1 -0
- data/lib/puppet/pops/model/model_tree_dumper.rb +12 -1
- data/lib/puppet/pops/model/tree_dumper.rb +1 -1
- data/lib/puppet/pops/parser/code_merger.rb +2 -2
- data/lib/puppet/pops/parser/egrammar.ra +44 -15
- data/lib/puppet/pops/parser/eparser.rb +1687 -1571
- data/lib/puppet/pops/parser/epp_support.rb +1 -3
- data/lib/puppet/pops/parser/evaluating_parser.rb +1 -1
- data/lib/puppet/pops/parser/interpolation_support.rb +2 -2
- data/lib/puppet/pops/parser/lexer2.rb +4 -4
- data/lib/puppet/pops/parser/lexer_support.rb +2 -2
- data/lib/puppet/pops/parser/locatable.rb +1 -1
- data/lib/puppet/pops/parser/locator.rb +7 -13
- data/lib/puppet/pops/parser/parser_support.rb +3 -3
- data/lib/puppet/pops/parser/slurp_support.rb +0 -3
- data/lib/puppet/pops/pcore.rb +45 -0
- data/lib/puppet/pops/resource/param.rb +1 -1
- data/lib/puppet/pops/resource/resource_type_impl.rb +1 -1
- data/lib/puppet/pops/serialization/abstract_reader.rb +4 -0
- data/lib/puppet/pops/serialization/abstract_writer.rb +6 -0
- data/lib/puppet/pops/serialization/extension.rb +1 -0
- data/lib/puppet/pops/serialization/from_data_converter.rb +64 -10
- data/lib/puppet/pops/serialization/json_path.rb +2 -1
- data/lib/puppet/pops/serialization/object.rb +3 -4
- data/lib/puppet/pops/serialization/serializer.rb +2 -1
- data/lib/puppet/pops/serialization/to_data_converter.rb +7 -3
- data/lib/puppet/pops/time/timespan.rb +1 -1
- data/lib/puppet/pops/types/iterable.rb +38 -9
- data/lib/puppet/pops/types/p_init_type.rb +1 -1
- data/lib/puppet/pops/types/p_meta_type.rb +4 -0
- data/lib/puppet/pops/types/p_object_type.rb +146 -14
- data/lib/puppet/pops/types/p_object_type_extension.rb +218 -0
- data/lib/puppet/pops/types/p_sem_ver_range_type.rb +0 -1
- data/lib/puppet/pops/types/p_sem_ver_type.rb +10 -2
- data/lib/puppet/pops/types/p_type_set_type.rb +0 -1
- data/lib/puppet/pops/types/p_uri_type.rb +190 -0
- data/lib/puppet/pops/types/puppet_object.rb +15 -1
- data/lib/puppet/pops/types/ruby_generator.rb +46 -54
- data/lib/puppet/pops/types/string_converter.rb +22 -1
- data/lib/puppet/pops/types/type_acceptor.rb +1 -1
- data/lib/puppet/pops/types/type_calculator.rb +13 -4
- data/lib/puppet/pops/types/type_factory.rb +29 -5
- data/lib/puppet/pops/types/type_formatter.rb +67 -4
- data/lib/puppet/pops/types/type_parser.rb +92 -4
- data/lib/puppet/pops/types/type_with_members.rb +43 -0
- data/lib/puppet/pops/types/types.rb +212 -80
- data/lib/puppet/pops/validation/checker4_0.rb +10 -6
- data/lib/puppet/pops/validation/tasks_checker.rb +60 -0
- data/lib/puppet/pops/validation/validator_factory_4_0.rb +6 -1
- data/lib/puppet/property.rb +1 -1
- data/lib/puppet/provider.rb +18 -8
- data/lib/puppet/provider/augeas/augeas.rb +3 -4
- data/lib/puppet/provider/exec.rb +0 -2
- data/lib/puppet/provider/group/groupadd.rb +25 -1
- data/lib/puppet/provider/group/windows_adsi.rb +7 -4
- data/lib/puppet/provider/mount.rb +25 -8
- data/lib/puppet/provider/nameservice.rb +9 -4
- data/lib/puppet/provider/nameservice/directoryservice.rb +3 -3
- data/lib/puppet/provider/nameservice/objectadd.rb +13 -24
- data/lib/puppet/provider/nameservice/pw.rb +14 -14
- data/lib/puppet/provider/package/appdmg.rb +0 -1
- data/lib/puppet/provider/package/apple.rb +0 -1
- data/lib/puppet/provider/package/gem.rb +2 -2
- data/lib/puppet/provider/package/macports.rb +2 -2
- data/lib/puppet/provider/package/pkg.rb +3 -0
- data/lib/puppet/provider/package/pkgdmg.rb +0 -1
- data/lib/puppet/provider/package/portage.rb +0 -1
- data/lib/puppet/provider/package/yum.rb +23 -8
- data/lib/puppet/provider/package/zypper.rb +2 -2
- data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +2 -2
- data/lib/puppet/provider/service/init.rb +1 -0
- data/lib/puppet/provider/service/launchd.rb +6 -7
- data/lib/puppet/provider/service/redhat.rb +3 -2
- data/lib/puppet/provider/service/systemd.rb +2 -2
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +1 -1
- data/lib/puppet/provider/user/aix.rb +3 -2
- data/lib/puppet/provider/user/openbsd.rb +1 -1
- data/lib/puppet/provider/user/pw.rb +1 -1
- data/lib/puppet/provider/user/user_role_add.rb +7 -1
- data/lib/puppet/provider/user/useradd.rb +36 -6
- data/lib/puppet/provider/user/windows_adsi.rb +1 -1
- data/lib/puppet/provider/yumrepo/inifile.rb +2 -4
- data/lib/puppet/provider/zfs/zfs.rb +23 -3
- data/lib/puppet/provider/zpool/zpool.rb +1 -1
- data/lib/puppet/reference/configuration.rb +0 -2
- data/lib/puppet/reference/type.rb +0 -1
- data/lib/puppet/resource.rb +1 -2
- data/lib/puppet/resource/catalog.rb +1 -1
- data/lib/puppet/resource/status.rb +0 -1
- data/lib/puppet/resource/type.rb +4 -4
- data/lib/puppet/resource/type_collection.rb +1 -1
- data/lib/puppet/settings/base_setting.rb +1 -1
- data/lib/puppet/settings/environment_conf.rb +0 -1
- data/lib/puppet/settings/ini_file.rb +66 -12
- data/lib/puppet/ssl/certificate_authority.rb +1 -1
- data/lib/puppet/ssl/certificate_request.rb +2 -2
- data/lib/puppet/ssl/certificate_revocation_list.rb +2 -1
- data/lib/puppet/ssl/certificate_signer.rb +11 -0
- data/lib/puppet/ssl/host.rb +2 -2
- data/lib/puppet/syntax_checkers/base64.rb +1 -1
- data/lib/puppet/transaction.rb +37 -14
- data/lib/puppet/transaction/report.rb +3 -1
- data/lib/puppet/type.rb +17 -4
- data/lib/puppet/type/cron.rb +1 -1
- data/lib/puppet/type/exec.rb +5 -4
- data/lib/puppet/type/file.rb +3 -3
- data/lib/puppet/type/file/checksum.rb +7 -1
- data/lib/puppet/type/file/checksum_value.rb +4 -3
- data/lib/puppet/type/group.rb +3 -0
- data/lib/puppet/type/k5login.rb +101 -0
- data/lib/puppet/type/macauthorization.rb +1 -1
- data/lib/puppet/type/mount.rb +6 -2
- data/lib/puppet/type/tidy.rb +6 -4
- data/lib/puppet/type/user.rb +26 -39
- data/lib/puppet/type/yumrepo.rb +9 -0
- data/lib/puppet/type/zfs.rb +4 -0
- data/lib/puppet/util.rb +8 -15
- data/lib/puppet/util/character_encoding.rb +2 -2
- data/lib/puppet/util/checksums.rb +82 -1
- data/lib/puppet/util/errors.rb +0 -2
- data/lib/puppet/util/filetype.rb +2 -2
- data/lib/puppet/util/json_lockfile.rb +1 -1
- data/lib/puppet/util/log.rb +1 -1
- data/lib/puppet/util/log/destinations.rb +10 -1
- data/lib/puppet/util/monkey_patches.rb +1 -1
- data/lib/puppet/util/network_device/cisco/device.rb +5 -5
- data/lib/puppet/util/network_device/config.rb +2 -3
- data/lib/puppet/util/platform.rb +13 -0
- data/lib/puppet/util/plist.rb +4 -4
- data/lib/puppet/util/rdoc/generators/puppet_generator.rb +2 -2
- data/lib/puppet/util/rdoc/parser/puppet_parser_rdoc2.rb +1 -1
- data/lib/puppet/util/reference.rb +8 -1
- data/lib/puppet/util/windows/adsi.rb +18 -15
- data/lib/puppet/util/windows/principal.rb +6 -7
- data/lib/puppet/util/windows/process.rb +1 -1
- data/lib/puppet/util/windows/registry.rb +2 -2
- data/lib/puppet/util/windows/sid.rb +7 -62
- data/lib/puppet/vendor/deep_merge/README.md +2 -2
- data/lib/puppet/vendor/pathspec/lib/pathspec/gitignorespec.rb +18 -18
- data/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version.rb +2 -2
- data/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version_range.rb +5 -5
- data/lib/puppet/vendor/semantic_puppet/locales/config.yaml +1 -1
- data/lib/puppet/version.rb +1 -1
- data/lib/puppet_pal.rb +874 -0
- data/locales/ja/puppet.po +140 -163
- data/locales/puppet.pot +940 -597
- data/man/man5/puppet.conf.5 +16 -91
- data/man/man8/puppet-agent.8 +2 -6
- data/man/man8/puppet-apply.8 +2 -2
- data/man/man8/puppet-ca.8 +1 -1
- data/man/man8/puppet-catalog.8 +1 -1
- data/man/man8/puppet-cert.8 +1 -1
- data/man/man8/puppet-certificate.8 +1 -1
- data/man/man8/puppet-certificate_request.8 +1 -1
- data/man/man8/puppet-certificate_revocation_list.8 +1 -1
- data/man/man8/puppet-config.8 +1 -1
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +11 -33
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +1 -1
- data/man/man8/puppet-facts.8 +1 -1
- data/man/man8/puppet-filebucket.8 +4 -22
- data/man/man8/puppet-generate.8 +1 -1
- data/man/man8/puppet-help.8 +1 -1
- data/man/man8/puppet-key.8 +1 -1
- data/man/man8/puppet-lookup.8 +1 -1
- data/man/man8/puppet-man.8 +1 -1
- data/man/man8/puppet-master.8 +1 -1
- data/man/man8/puppet-module.8 +2 -11
- data/man/man8/puppet-node.8 +1 -1
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +1 -1
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-status.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/integration/application/lookup_spec.rb +0 -21
- data/spec/integration/parser/compiler_spec.rb +18 -0
- data/spec/integration/parser/script_compiler_spec.rb +113 -0
- data/spec/integration/provider/mount_spec.rb +2 -0
- data/spec/integration/type/file_spec.rb +11 -3
- data/spec/integration/util/windows/adsi_spec.rb +1 -86
- data/spec/integration/util/windows/principal_spec.rb +1 -10
- data/spec/shared_contexts/checksum.rb +4 -1
- data/spec/shared_contexts/digests.rb +46 -1
- data/spec/shared_contexts/types_setup.rb +8 -3
- data/spec/unit/agent_spec.rb +2 -2
- data/spec/unit/application/cert_spec.rb +5 -17
- data/spec/unit/application/device_spec.rb +2 -96
- data/spec/unit/application/filebucket_spec.rb +18 -4
- data/spec/unit/configurer/plugin_handler_spec.rb +5 -32
- data/spec/unit/configurer_spec.rb +3 -3
- data/spec/unit/datatypes_spec.rb +304 -0
- data/spec/unit/defaults_spec.rb +41 -20
- data/spec/unit/face/config_spec.rb +46 -1
- data/spec/unit/face/epp_face_spec.rb +7 -3
- data/spec/unit/face/module/search_spec.rb +11 -0
- data/spec/unit/face/parser_spec.rb +2 -2
- data/spec/unit/file_bucket/dipper_spec.rb +12 -1
- data/spec/unit/forge/module_release_spec.rb +70 -0
- data/spec/unit/functions/break_spec.rb +34 -2
- data/spec/unit/functions/contain_spec.rb +1 -0
- data/spec/unit/functions/convert_to_spec.rb +22 -0
- data/spec/unit/functions/epp_spec.rb +5 -0
- data/spec/unit/functions/include_spec.rb +15 -0
- data/spec/unit/functions/module_directory_spec.rb +43 -0
- data/spec/unit/functions/new_spec.rb +14 -14
- data/spec/unit/functions/require_spec.rb +2 -0
- data/spec/unit/functions/shared.rb +12 -0
- data/spec/unit/functions/step_spec.rb +1 -1
- data/spec/unit/functions4_spec.rb +49 -4
- data/spec/unit/indirector/catalog/compiler_spec.rb +3 -3
- data/spec/unit/indirector/file_bucket_file/file_spec.rb +148 -94
- data/spec/unit/indirector/node/ldap_spec.rb +15 -12
- data/spec/unit/indirector/rest_spec.rb +0 -43
- data/spec/unit/interface/action_spec.rb +33 -0
- data/spec/unit/module_tool/applications/builder_spec.rb +7 -0
- data/spec/unit/module_tool/applications/installer_spec.rb +8 -0
- data/spec/unit/module_tool/applications/uninstaller_spec.rb +8 -0
- data/spec/unit/module_tool/applications/upgrader_spec.rb +6 -0
- data/spec/unit/network/http/connection_spec.rb +1 -1
- data/spec/unit/network/http/factory_spec.rb +28 -35
- data/spec/unit/parser/compiler_spec.rb +0 -8
- data/spec/unit/parser/environment_compiler_spec.rb +36 -0
- data/spec/unit/parser/functions/create_resources_spec.rb +9 -0
- data/spec/unit/parser/functions/inline_template_spec.rb +7 -0
- data/spec/unit/parser/functions/realize_spec.rb +9 -0
- data/spec/unit/parser/functions/tag_spec.rb +7 -0
- data/spec/unit/parser/functions/tagged_spec.rb +25 -0
- data/spec/unit/parser/functions/template_spec.rb +8 -0
- data/spec/unit/parser/scope_spec.rb +19 -0
- data/spec/unit/pops/evaluator/conditionals_spec.rb +1 -1
- data/spec/unit/pops/loaders/loader_spec.rb +516 -0
- data/spec/unit/pops/loaders/loaders_spec.rb +11 -0
- data/spec/unit/pops/loaders/module_loaders_spec.rb +43 -0
- data/spec/unit/pops/loaders/static_loader_spec.rb +15 -7
- data/spec/unit/pops/model/model_spec.rb +5 -0
- data/spec/unit/pops/parser/lexer2_spec.rb +15 -0
- data/spec/unit/pops/parser/locator_spec.rb +20 -0
- data/spec/unit/pops/parser/parse_basic_expressions_spec.rb +33 -0
- data/spec/unit/pops/parser/parse_calls_spec.rb +28 -0
- data/spec/unit/pops/parser/parse_conditionals_spec.rb +12 -0
- data/spec/unit/pops/parser/parse_plan_spec.rb +48 -0
- data/spec/unit/pops/serialization/packer_spec.rb +8 -0
- data/spec/unit/pops/serialization/serialization_spec.rb +30 -0
- data/spec/unit/pops/serialization/to_from_hr_spec.rb +31 -0
- data/spec/unit/pops/types/error_spec.rb +207 -0
- data/spec/unit/pops/types/p_init_type_spec.rb +98 -0
- data/spec/unit/pops/types/p_object_type_spec.rb +275 -10
- data/spec/unit/pops/types/p_uri_type_spec.rb +191 -0
- data/spec/unit/pops/types/ruby_generator_spec.rb +82 -44
- data/spec/unit/pops/types/task_spec.rb +353 -0
- data/spec/unit/pops/types/type_calculator_spec.rb +76 -5
- data/spec/unit/pops/types/type_formatter_spec.rb +31 -13
- data/spec/unit/pops/types/type_parser_spec.rb +13 -1
- data/spec/unit/pops/types/types_spec.rb +60 -0
- data/spec/unit/pops/validator/validator_spec.rb +76 -0
- data/spec/unit/provider/group/groupadd_spec.rb +77 -1
- data/spec/unit/provider/group/pw_spec.rb +4 -4
- data/spec/unit/provider/group/windows_adsi_spec.rb +22 -79
- data/spec/unit/provider/mount_spec.rb +18 -5
- data/spec/unit/provider/nameservice_spec.rb +5 -5
- data/spec/unit/provider/package/dnf_spec.rb +2 -2
- data/spec/unit/provider/package/gem_spec.rb +1 -1
- data/spec/unit/provider/package/pkg_spec.rb +3 -0
- data/spec/unit/provider/package/yum_spec.rb +40 -0
- data/spec/unit/provider/service/launchd_spec.rb +2 -1
- data/spec/unit/provider/service/redhat_spec.rb +5 -0
- data/spec/unit/provider/service/systemd_spec.rb +1 -1
- data/spec/unit/provider/user/hpux_spec.rb +2 -2
- data/spec/unit/provider/user/openbsd_spec.rb +2 -2
- data/spec/unit/provider/user/pw_spec.rb +14 -14
- data/spec/unit/provider/user/user_role_add_spec.rb +19 -2
- data/spec/unit/provider/user/useradd_spec.rb +188 -22
- data/spec/unit/provider/user/windows_adsi_spec.rb +4 -4
- data/spec/unit/provider/zfs/zfs_spec.rb +55 -1
- data/spec/unit/provider_spec.rb +48 -0
- data/spec/unit/puppet_pal_2pec.rb +1005 -0
- data/spec/unit/puppet_pal_spec.rb +11 -0
- data/spec/unit/settings/ini_file_spec.rb +313 -2
- data/spec/unit/ssl/certificate_request_spec.rb +42 -1
- data/spec/unit/ssl/certificate_revocation_list_spec.rb +2 -1
- data/spec/unit/transaction/report_spec.rb +1 -0
- data/spec/unit/transaction_spec.rb +112 -21
- data/spec/unit/type/file/checksum_spec.rb +20 -0
- data/spec/unit/type/file_spec.rb +8 -0
- data/spec/unit/type/group_spec.rb +8 -0
- data/spec/unit/type/k5login_spec.rb +22 -1
- data/spec/unit/type/scheduled_task_spec.rb +15 -0
- data/spec/unit/type/user_spec.rb +11 -1
- data/spec/unit/type/yumrepo_spec.rb +5 -0
- data/spec/unit/util/checksums_spec.rb +3 -3
- data/spec/unit/util/log/destinations_spec.rb +14 -0
- data/spec/unit/util/network_device/cisco/device_spec.rb +1 -1
- data/spec/unit/util/plist_spec.rb +3 -3
- data/spec/unit/util/windows/adsi_spec.rb +27 -31
- data/spec/unit/util/windows/sid_spec.rb +15 -86
- data/spec/unit/util_spec.rb +17 -3
- data/tasks/manpages.rake +1 -1
- metadata +218 -180
- data/lib/puppet/bindings.rb +0 -148
- data/lib/puppet/configurer/downloader_factory.rb +0 -44
- data/spec/unit/configurer/downloader_factory_spec.rb +0 -129
@@ -42,6 +42,13 @@ describe 'The type calculator' do
|
|
42
42
|
TypeFactory.variant(*types)
|
43
43
|
end
|
44
44
|
|
45
|
+
def empty_variant_t()
|
46
|
+
t = TypeFactory.variant()
|
47
|
+
# assert this to ensure we did get an empty variant (or tests may pass when not being empty)
|
48
|
+
raise 'typefactory did not return empty variant' unless t.types.empty?
|
49
|
+
t
|
50
|
+
end
|
51
|
+
|
45
52
|
def type_alias_t(name, type_string)
|
46
53
|
type_expr = Parser::EvaluatingParser.new.parse_string(type_string)
|
47
54
|
TypeFactory.type_alias(name, type_expr)
|
@@ -156,12 +163,12 @@ describe 'The type calculator' do
|
|
156
163
|
expect(t.value).to eq('foo')
|
157
164
|
end
|
158
165
|
|
159
|
-
it 'boolean true translates to PBooleanType' do
|
160
|
-
expect(calculator.infer(true)
|
166
|
+
it 'boolean true translates to PBooleanType::TRUE' do
|
167
|
+
expect(calculator.infer(true)).to eq(PBooleanType::TRUE)
|
161
168
|
end
|
162
169
|
|
163
|
-
it 'boolean false translates to PBooleanType' do
|
164
|
-
expect(calculator.infer(false)
|
170
|
+
it 'boolean false translates to PBooleanType::FALSE' do
|
171
|
+
expect(calculator.infer(false)).to eq(PBooleanType::FALSE)
|
165
172
|
end
|
166
173
|
|
167
174
|
it 'regexp translates to PRegexpType' do
|
@@ -851,7 +858,6 @@ describe 'The type calculator' do
|
|
851
858
|
t = PTypeReferenceType::DEFAULT
|
852
859
|
all_instances = (all_types - [
|
853
860
|
PTypeReferenceType, # Avoid comparison with t
|
854
|
-
PVariantType, # DEFAULT contains no variants, so assignability is never tested and always true
|
855
861
|
PTypeAliasType # DEFAULT resolves to PTypeReferenceType::DEFAULT, i.e. t
|
856
862
|
]).map {|c| c::DEFAULT }
|
857
863
|
|
@@ -942,6 +948,45 @@ describe 'The type calculator' do
|
|
942
948
|
expect(v).not_to be_assignable_to(range_t(0, 4))
|
943
949
|
expect(v).not_to be_assignable_to(string_t)
|
944
950
|
end
|
951
|
+
|
952
|
+
it 'an empty Variant is assignable to another empty Variant' do
|
953
|
+
expect(empty_variant_t).to be_assignable_to(empty_variant_t)
|
954
|
+
end
|
955
|
+
|
956
|
+
it 'an empty Variant is assignable to Any' do
|
957
|
+
expect(empty_variant_t).to be_assignable_to(PAnyType::DEFAULT)
|
958
|
+
end
|
959
|
+
|
960
|
+
it 'an empty Variant is assignable to Unit' do
|
961
|
+
expect(empty_variant_t).to be_assignable_to(PUnitType::DEFAULT)
|
962
|
+
end
|
963
|
+
|
964
|
+
it 'an empty Variant is not assignable to any type except empty Variant, Any, NotUndef, and Unit' do
|
965
|
+
assignables = [PUnitType, PAnyType, PNotUndefType]
|
966
|
+
unassignables = all_types - assignables
|
967
|
+
unassignables.each {|t2| expect(empty_variant_t).not_to be_assignable_to(t2::DEFAULT) }
|
968
|
+
assignables.each {|t2| expect(empty_variant_t).to be_assignable_to(t2::DEFAULT) }
|
969
|
+
end
|
970
|
+
|
971
|
+
it 'an empty Variant is not assignable to Optional[Any] since it is not assignable to Undef' do
|
972
|
+
opt_any = optional_t(any_t)
|
973
|
+
expect(empty_variant_t).not_to be_assignable_to(opt_any)
|
974
|
+
end
|
975
|
+
|
976
|
+
it 'an Optional[Any] is not assignable to empty Variant' do
|
977
|
+
opt_any = optional_t(any_t)
|
978
|
+
expect(opt_any).not_to be_assignable_to(empty_variant_t)
|
979
|
+
end
|
980
|
+
|
981
|
+
it 'an empty Variant is assignable to NotUndef[Variant] since Variant is not Undef' do
|
982
|
+
not_undef_variant = not_undef_t(empty_variant_t)
|
983
|
+
expect(empty_variant_t).to be_assignable_to(not_undef_variant)
|
984
|
+
end
|
985
|
+
|
986
|
+
it 'a NotUndef[Variant] is assignable to empty Variant' do
|
987
|
+
not_undef_variant = not_undef_t(empty_variant_t)
|
988
|
+
expect(not_undef_variant).to be_assignable_to(empty_variant_t)
|
989
|
+
end
|
945
990
|
end
|
946
991
|
|
947
992
|
context 'for Scalar, such that' do
|
@@ -1056,6 +1101,32 @@ describe 'The type calculator' do
|
|
1056
1101
|
end
|
1057
1102
|
end
|
1058
1103
|
|
1104
|
+
context 'for Enum, such that' do
|
1105
|
+
it 'Enum is assignable to an Enum with all contained options' do
|
1106
|
+
expect(enum_t('a', 'b')).to be_assignable_to(enum_t('a', 'b', 'c'))
|
1107
|
+
end
|
1108
|
+
|
1109
|
+
it 'Enum is not assignable to an Enum with fewer contained options' do
|
1110
|
+
expect(enum_t('a', 'b')).not_to be_assignable_to(enum_t('a'))
|
1111
|
+
end
|
1112
|
+
|
1113
|
+
it 'case insensitive Enum is not assignable to case sensitive Enum' do
|
1114
|
+
expect(enum_t('a', 'b', true)).not_to be_assignable_to(enum_t('a', 'b'))
|
1115
|
+
end
|
1116
|
+
|
1117
|
+
it 'case sensitive Enum is assignable to case insensitive Enum' do
|
1118
|
+
expect(enum_t('a', 'b')).to be_assignable_to(enum_t('a', 'b', true))
|
1119
|
+
end
|
1120
|
+
|
1121
|
+
it 'case sensitive Enum is not assignable to case sensitive Enum using different case' do
|
1122
|
+
expect(enum_t('a', 'b')).not_to be_assignable_to(enum_t('A', 'B'))
|
1123
|
+
end
|
1124
|
+
|
1125
|
+
it 'case sensitive Enum is assignable to case insensitive Enum using different case' do
|
1126
|
+
expect(enum_t('a', 'b')).to be_assignable_to(enum_t('A', 'B', true))
|
1127
|
+
end
|
1128
|
+
end
|
1129
|
+
|
1059
1130
|
context 'for Hash, such that' do
|
1060
1131
|
it 'Hash is not assignable to any other Collection type' do
|
1061
1132
|
t = PHashType::DEFAULT
|
@@ -19,7 +19,7 @@ describe 'The type formatter' do
|
|
19
19
|
{
|
20
20
|
'true' => true,
|
21
21
|
'false' => false,
|
22
|
-
'
|
22
|
+
'undef' => nil,
|
23
23
|
'23.4' => 23.4,
|
24
24
|
'145' => 145,
|
25
25
|
"'string'" => 'string',
|
@@ -99,6 +99,14 @@ FORMATTED
|
|
99
99
|
expect(s.string(f.boolean)).to eq('Boolean')
|
100
100
|
end
|
101
101
|
|
102
|
+
it "should yield 'Boolean[true]' for PBooleanType parameterized with true" do
|
103
|
+
expect(s.string(f.boolean(true))).to eq('Boolean[true]')
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should yield 'Boolean[false]' for PBooleanType parameterized with false" do
|
107
|
+
expect(s.string(f.boolean(false))).to eq('Boolean[false]')
|
108
|
+
end
|
109
|
+
|
102
110
|
it "should yield 'Data' for the Data type" do
|
103
111
|
expect(s.string(f.data)).to eq('Data')
|
104
112
|
end
|
@@ -112,7 +120,7 @@ FORMATTED
|
|
112
120
|
expect(s.string(f.range(1,1))).to eq('Integer[1, 1]')
|
113
121
|
expect(s.string(f.range(1,2))).to eq('Integer[1, 2]')
|
114
122
|
expect(s.string(f.range(:default, 2))).to eq('Integer[default, 2]')
|
115
|
-
expect(s.string(f.range(2, :default))).to eq('Integer[2
|
123
|
+
expect(s.string(f.range(2, :default))).to eq('Integer[2]')
|
116
124
|
end
|
117
125
|
|
118
126
|
it "should yield 'Float' for PFloatType" do
|
@@ -142,8 +150,8 @@ FORMATTED
|
|
142
150
|
it "should yield 'String' and from/to for PStringType" do
|
143
151
|
expect(s.string(f.string(f.range(1,1)))).to eq('String[1, 1]')
|
144
152
|
expect(s.string(f.string(f.range(1,2)))).to eq('String[1, 2]')
|
145
|
-
expect(s.string(f.string(f.range(:default, 2)))).to eq('String[
|
146
|
-
expect(s.string(f.string(f.range(2, :default)))).to eq('String[2
|
153
|
+
expect(s.string(f.string(f.range(:default, 2)))).to eq('String[0, 2]')
|
154
|
+
expect(s.string(f.string(f.range(2, :default)))).to eq('String[2]')
|
147
155
|
end
|
148
156
|
|
149
157
|
it "should yield 'Array[Integer]' for PArrayType[PIntegerType]" do
|
@@ -167,15 +175,15 @@ FORMATTED
|
|
167
175
|
it "should yield 'Collection' and from/to for PCollectionType" do
|
168
176
|
expect(s.string(f.collection(f.range(1,1)))).to eq('Collection[1, 1]')
|
169
177
|
expect(s.string(f.collection(f.range(1,2)))).to eq('Collection[1, 2]')
|
170
|
-
expect(s.string(f.collection(f.range(:default, 2)))).to eq('Collection[
|
171
|
-
expect(s.string(f.collection(f.range(2, :default)))).to eq('Collection[2
|
178
|
+
expect(s.string(f.collection(f.range(:default, 2)))).to eq('Collection[0, 2]')
|
179
|
+
expect(s.string(f.collection(f.range(2, :default)))).to eq('Collection[2]')
|
172
180
|
end
|
173
181
|
|
174
182
|
it "should yield 'Array' and from/to for PArrayType" do
|
175
183
|
expect(s.string(f.array_of(f.string, f.range(1,1)))).to eq('Array[String, 1, 1]')
|
176
184
|
expect(s.string(f.array_of(f.string, f.range(1,2)))).to eq('Array[String, 1, 2]')
|
177
|
-
expect(s.string(f.array_of(f.string, f.range(:default, 2)))).to eq('Array[String,
|
178
|
-
expect(s.string(f.array_of(f.string, f.range(2, :default)))).to eq('Array[String, 2
|
185
|
+
expect(s.string(f.array_of(f.string, f.range(:default, 2)))).to eq('Array[String, 0, 2]')
|
186
|
+
expect(s.string(f.array_of(f.string, f.range(2, :default)))).to eq('Array[String, 2]')
|
179
187
|
end
|
180
188
|
|
181
189
|
it "should yield 'Iterable' for PIterableType" do
|
@@ -240,7 +248,7 @@ FORMATTED
|
|
240
248
|
expect(s.string(f.tuple(types, f.range(1,1)))).to eq('Tuple[String, 1, 1]')
|
241
249
|
expect(s.string(f.tuple(types, f.range(1,2)))).to eq('Tuple[String, 1, 2]')
|
242
250
|
expect(s.string(f.tuple(types, f.range(:default, 2)))).to eq('Tuple[String, 0, 2]')
|
243
|
-
expect(s.string(f.tuple(types, f.range(2, :default)))).to eq('Tuple[String, 2
|
251
|
+
expect(s.string(f.tuple(types, f.range(2, :default)))).to eq('Tuple[String, 2]')
|
244
252
|
end
|
245
253
|
|
246
254
|
it "should yield 'Struct' and details for PStructType" do
|
@@ -257,8 +265,8 @@ FORMATTED
|
|
257
265
|
it "should yield 'Hash' and from/to for PHashType" do
|
258
266
|
expect(s.string(f.hash_of(f.string, f.string, f.range(1,1)))).to eq('Hash[String, String, 1, 1]')
|
259
267
|
expect(s.string(f.hash_of(f.string, f.string, f.range(1,2)))).to eq('Hash[String, String, 1, 2]')
|
260
|
-
expect(s.string(f.hash_of(f.string, f.string, f.range(:default, 2)))).to eq('Hash[String, String,
|
261
|
-
expect(s.string(f.hash_of(f.string, f.string, f.range(2, :default)))).to eq('Hash[String, String, 2
|
268
|
+
expect(s.string(f.hash_of(f.string, f.string, f.range(:default, 2)))).to eq('Hash[String, String, 0, 2]')
|
269
|
+
expect(s.string(f.hash_of(f.string, f.string, f.range(2, :default)))).to eq('Hash[String, String, 2]')
|
262
270
|
end
|
263
271
|
|
264
272
|
it "should yield 'Hash' for PHashType::DEFAULT" do
|
@@ -290,6 +298,16 @@ FORMATTED
|
|
290
298
|
expect(s.string(t)).to eq("Enum['a', 'b', 'c']")
|
291
299
|
end
|
292
300
|
|
301
|
+
it "should yield 'Enum[s,...]' for a PEnumType[s,...,false]" do
|
302
|
+
t = f.enum('a', 'b', 'c', false)
|
303
|
+
expect(s.string(t)).to eq("Enum['a', 'b', 'c']")
|
304
|
+
end
|
305
|
+
|
306
|
+
it "should yield 'Enum[s,...,true]' for a PEnumType[s,...,true]" do
|
307
|
+
t = f.enum('a', 'b', 'c', true)
|
308
|
+
expect(s.string(t)).to eq("Enum['a', 'b', 'c', true]")
|
309
|
+
end
|
310
|
+
|
293
311
|
it "should yield 'Pattern[/pat/,...]' for a PPatternType['pat',...]" do
|
294
312
|
t = f.pattern('a')
|
295
313
|
t2 = f.pattern('a', 'b', 'c')
|
@@ -331,7 +349,7 @@ FORMATTED
|
|
331
349
|
end
|
332
350
|
|
333
351
|
it "should yield 'Callable[t,min,max]' for callable with size constraint (infinite max)" do
|
334
|
-
expect(s.string(f.callable(String, 0))).to eql('Callable[String, 0
|
352
|
+
expect(s.string(f.callable(String, 0))).to eql('Callable[String, 0]')
|
335
353
|
end
|
336
354
|
|
337
355
|
it "should yield 'Callable[t,min,max]' for callable with size constraint (capped max)" do
|
@@ -341,7 +359,7 @@ FORMATTED
|
|
341
359
|
it "should yield 'Callable[min,max]' callable with size > 0" do
|
342
360
|
expect(s.string(f.callable(0, 0))).to eql('Callable[0, 0]')
|
343
361
|
expect(s.string(f.callable(0, 1))).to eql('Callable[0, 1]')
|
344
|
-
expect(s.string(f.callable(0, :default))).to eql('Callable[0
|
362
|
+
expect(s.string(f.callable(0, :default))).to eql('Callable[0]')
|
345
363
|
end
|
346
364
|
|
347
365
|
it "should yield 'Callable[Callable]' for callable with block" do
|
@@ -36,7 +36,7 @@ describe TypeParser do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
[
|
39
|
-
'Any', 'Data', 'CatalogEntry', '
|
39
|
+
'Any', 'Data', 'CatalogEntry', 'Scalar', 'Undef', 'Numeric', 'Default'
|
40
40
|
].each do |name|
|
41
41
|
it "does not support parameterizing unparameterized type <#{name}>" do
|
42
42
|
expect { parser.parse("#{name}[Integer]") }.to raise_unparameterized_error_for(name)
|
@@ -79,6 +79,18 @@ describe TypeParser do
|
|
79
79
|
expect(parser.parse("Hash[Scalar, Integer]")).to be_the_type(types.hash_of(types.integer))
|
80
80
|
end
|
81
81
|
|
82
|
+
it 'interprets an Boolean with a true parameter to represent boolean true' do
|
83
|
+
expect(parser.parse('Boolean[true]')).to be_the_type(types.boolean(true))
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'interprets an Boolean with a false parameter to represent boolean false' do
|
87
|
+
expect(parser.parse('Boolean[false]')).to be_the_type(types.boolean(false))
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'does not accept non-boolean parameters' do
|
91
|
+
expect{parser.parse('Boolean["false"]')}.to raise_error(/Boolean parameter must be true or false/)
|
92
|
+
end
|
93
|
+
|
82
94
|
it 'interprets an Integer with one parameter to have unbounded upper range' do
|
83
95
|
expect(parser.parse('Integer[0]')).to eq(parser.parse('Integer[0,default]'))
|
84
96
|
end
|
@@ -153,6 +153,40 @@ describe 'Puppet Type System' do
|
|
153
153
|
end
|
154
154
|
end
|
155
155
|
|
156
|
+
context 'Boolean type' do
|
157
|
+
it 'parameterized type is assignable to base type' do
|
158
|
+
code = <<-CODE
|
159
|
+
notice(Boolean[true] < Boolean)
|
160
|
+
notice(Boolean[false] < Boolean)
|
161
|
+
CODE
|
162
|
+
expect(eval_and_collect_notices(code)).to eq(['true', 'true'])
|
163
|
+
end
|
164
|
+
|
165
|
+
it 'boolean literals are instances of the base type' do
|
166
|
+
code = <<-CODE
|
167
|
+
notice(true =~ Boolean)
|
168
|
+
notice(false =~ Boolean)
|
169
|
+
CODE
|
170
|
+
expect(eval_and_collect_notices(code)).to eq(['true', 'true'])
|
171
|
+
end
|
172
|
+
|
173
|
+
it 'boolean literals are instances of type parameterized with the same literal' do
|
174
|
+
code = <<-CODE
|
175
|
+
notice(true =~ Boolean[true])
|
176
|
+
notice(false =~ Boolean[false])
|
177
|
+
CODE
|
178
|
+
expect(eval_and_collect_notices(code)).to eq(['true', 'true'])
|
179
|
+
end
|
180
|
+
|
181
|
+
it 'boolean literals are not instances of type parameterized with a different literal' do
|
182
|
+
code = <<-CODE
|
183
|
+
notice(true =~ Boolean[false])
|
184
|
+
notice(false =~ Boolean[true])
|
185
|
+
CODE
|
186
|
+
expect(eval_and_collect_notices(code)).to eq(['false', 'false'])
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
156
190
|
context 'Enum type' do
|
157
191
|
it 'sorts its entries' do
|
158
192
|
code = <<-CODE
|
@@ -167,6 +201,22 @@ describe 'Puppet Type System' do
|
|
167
201
|
CODE
|
168
202
|
expect(eval_and_collect_notices(code)).to eq(['a', 'b', 'c'])
|
169
203
|
end
|
204
|
+
|
205
|
+
it 'is case sensitive by default' do
|
206
|
+
code = <<-CODE
|
207
|
+
notice('A' =~ Enum[a,b])
|
208
|
+
notice('a' =~ Enum[a,b])
|
209
|
+
CODE
|
210
|
+
expect(eval_and_collect_notices(code)).to eq(['false', 'true'])
|
211
|
+
end
|
212
|
+
|
213
|
+
it 'is case insensitive when last parameter argument is true' do
|
214
|
+
code = <<-CODE
|
215
|
+
notice('A' =~ Enum[a,b,true])
|
216
|
+
notice('a' =~ Enum[a,b,true])
|
217
|
+
CODE
|
218
|
+
expect(eval_and_collect_notices(code)).to eq(['true', 'true'])
|
219
|
+
end
|
170
220
|
end
|
171
221
|
|
172
222
|
context 'Iterable type' do
|
@@ -291,6 +341,8 @@ describe 'Puppet Type System' do
|
|
291
341
|
let!(:mix_ints) { tf.variant(overlapping_ints, adjacent_ints) }
|
292
342
|
let!(:overlapping_floats) { tf.variant(tf.float_range(10.0, 20.0), tf.float_range(18.0, 28.0)) }
|
293
343
|
let!(:enums) { tf.variant(tf.enum('a', 'b'), tf.enum('b', 'c')) }
|
344
|
+
let!(:enums_s_is) { tf.variant(tf.enum('a', 'b'), tf.enum('b', 'c', true)) }
|
345
|
+
let!(:enums_is_is) { tf.variant(tf.enum('A', 'b', true), tf.enum('B', 'c', true)) }
|
294
346
|
let!(:patterns) { tf.variant(tf.pattern('a', 'b'), tf.pattern('b', 'c')) }
|
295
347
|
let!(:with_undef) { tf.variant(tf.undef, tf.range(1,10)) }
|
296
348
|
let!(:all_optional) { tf.variant(tf.optional(tf.range(1,10)), tf.optional(tf.range(11,20))) }
|
@@ -317,6 +369,14 @@ describe 'Puppet Type System' do
|
|
317
369
|
expect(enums.normalize).to eq(tf.enum('a', 'b', 'c'))
|
318
370
|
end
|
319
371
|
|
372
|
+
it 'are case sensitive versus case insensitive enums, does not merge the enums' do
|
373
|
+
expect(enums_s_is.normalize).to eq(enums_s_is)
|
374
|
+
end
|
375
|
+
|
376
|
+
it 'are case insensitive enums, result is case insensitive and unique irrespective of case' do
|
377
|
+
expect(enums_is_is.normalize).to eq(tf.enum('a', 'b', 'c', true))
|
378
|
+
end
|
379
|
+
|
320
380
|
it 'are patterns, the result is a pattern' do
|
321
381
|
expect(patterns.normalize).to eq(tf.pattern('a', 'b', 'c'))
|
322
382
|
end
|
@@ -153,6 +153,82 @@ describe "validating 4x" do
|
|
153
153
|
end
|
154
154
|
end
|
155
155
|
|
156
|
+
context 'with --tasks set' do
|
157
|
+
before(:each) { Puppet[:tasks] = true }
|
158
|
+
|
159
|
+
it 'produces an error for application' do
|
160
|
+
acceptor = validate(parse('application test {}'))
|
161
|
+
expect(acceptor.error_count).to eql(1)
|
162
|
+
expect(acceptor).to have_issue(Puppet::Pops::Issues::CATALOG_OPERATION_NOT_SUPPORTED_WHEN_SCRIPTING)
|
163
|
+
end
|
164
|
+
|
165
|
+
it 'produces an error for capability mapping' do
|
166
|
+
acceptor = validate(parse('Foo produces Sql {}'))
|
167
|
+
expect(acceptor.error_count).to eql(1)
|
168
|
+
expect(acceptor).to have_issue(Puppet::Pops::Issues::CATALOG_OPERATION_NOT_SUPPORTED_WHEN_SCRIPTING)
|
169
|
+
end
|
170
|
+
|
171
|
+
it 'produces an error for collect expressions with virtual query' do
|
172
|
+
acceptor = validate(parse("User <| title == 'admin' |>"))
|
173
|
+
expect(acceptor.error_count).to eql(1)
|
174
|
+
expect(acceptor).to have_issue(Puppet::Pops::Issues::CATALOG_OPERATION_NOT_SUPPORTED_WHEN_SCRIPTING)
|
175
|
+
end
|
176
|
+
|
177
|
+
it 'produces an error for collect expressions with exported query' do
|
178
|
+
acceptor = validate(parse("User <<| title == 'admin' |>>"))
|
179
|
+
expect(acceptor.error_count).to eql(1)
|
180
|
+
expect(acceptor).to have_issue(Puppet::Pops::Issues::CATALOG_OPERATION_NOT_SUPPORTED_WHEN_SCRIPTING)
|
181
|
+
end
|
182
|
+
|
183
|
+
it 'produces an error for class expressions' do
|
184
|
+
acceptor = validate(parse('class test {}'))
|
185
|
+
expect(acceptor.error_count).to eql(1)
|
186
|
+
expect(acceptor).to have_issue(Puppet::Pops::Issues::CATALOG_OPERATION_NOT_SUPPORTED_WHEN_SCRIPTING)
|
187
|
+
end
|
188
|
+
|
189
|
+
it 'produces an error for node expressions' do
|
190
|
+
acceptor = validate(parse('node default {}'))
|
191
|
+
expect(acceptor.error_count).to eql(1)
|
192
|
+
expect(acceptor).to have_issue(Puppet::Pops::Issues::CATALOG_OPERATION_NOT_SUPPORTED_WHEN_SCRIPTING)
|
193
|
+
end
|
194
|
+
|
195
|
+
it 'produces an error for relationship expressions' do
|
196
|
+
acceptor = validate(parse('$x -> $y'))
|
197
|
+
expect(acceptor.error_count).to eql(1)
|
198
|
+
expect(acceptor).to have_issue(Puppet::Pops::Issues::CATALOG_OPERATION_NOT_SUPPORTED_WHEN_SCRIPTING)
|
199
|
+
end
|
200
|
+
|
201
|
+
it 'produces an error for resource expressions' do
|
202
|
+
acceptor = validate(parse('notify { nope: }'))
|
203
|
+
expect(acceptor.error_count).to eql(1)
|
204
|
+
expect(acceptor).to have_issue(Puppet::Pops::Issues::CATALOG_OPERATION_NOT_SUPPORTED_WHEN_SCRIPTING)
|
205
|
+
end
|
206
|
+
|
207
|
+
it 'produces an error for resource default expressions' do
|
208
|
+
acceptor = validate(parse("File { mode => '0644' }"))
|
209
|
+
expect(acceptor.error_count).to eql(1)
|
210
|
+
expect(acceptor).to have_issue(Puppet::Pops::Issues::CATALOG_OPERATION_NOT_SUPPORTED_WHEN_SCRIPTING)
|
211
|
+
end
|
212
|
+
|
213
|
+
it 'produces an error for resource override expressions' do
|
214
|
+
acceptor = validate(parse("File['/tmp/foo'] { mode => '0644' }"))
|
215
|
+
expect(acceptor.error_count).to eql(1)
|
216
|
+
expect(acceptor).to have_issue(Puppet::Pops::Issues::CATALOG_OPERATION_NOT_SUPPORTED_WHEN_SCRIPTING)
|
217
|
+
end
|
218
|
+
|
219
|
+
it 'produces an error for resource definitions' do
|
220
|
+
acceptor = validate(parse('define foo($a) {}'))
|
221
|
+
expect(acceptor.error_count).to eql(1)
|
222
|
+
expect(acceptor).to have_issue(Puppet::Pops::Issues::CATALOG_OPERATION_NOT_SUPPORTED_WHEN_SCRIPTING)
|
223
|
+
end
|
224
|
+
|
225
|
+
it 'produces an error for site definitions' do
|
226
|
+
acceptor = validate(parse('site {}'))
|
227
|
+
expect(acceptor.error_count).to eql(1)
|
228
|
+
expect(acceptor).to have_issue(Puppet::Pops::Issues::CATALOG_OPERATION_NOT_SUPPORTED_WHEN_SCRIPTING)
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
156
232
|
context 'for non productive expressions' do
|
157
233
|
[ '1',
|
158
234
|
'3.14',
|
@@ -7,6 +7,8 @@ describe Puppet::Type.type(:group).provider(:groupadd) do
|
|
7
7
|
described_class.stubs(:command).with(:delete).returns '/usr/sbin/groupdel'
|
8
8
|
described_class.stubs(:command).with(:modify).returns '/usr/sbin/groupmod'
|
9
9
|
described_class.stubs(:command).with(:localadd).returns '/usr/sbin/lgroupadd'
|
10
|
+
described_class.stubs(:command).with(:localdelete).returns '/usr/sbin/lgroupdel'
|
11
|
+
described_class.stubs(:command).with(:localmodify).returns '/usr/sbin/lgroupmod'
|
10
12
|
end
|
11
13
|
|
12
14
|
let(:resource) { Puppet::Type.type(:group).new(:name => 'mygroup', :provider => provider) }
|
@@ -65,12 +67,86 @@ describe Puppet::Type.type(:group).provider(:groupadd) do
|
|
65
67
|
|
66
68
|
end
|
67
69
|
|
70
|
+
describe "#modify" do
|
71
|
+
before do
|
72
|
+
provider.stubs(:exists?).returns(true)
|
73
|
+
end
|
74
|
+
describe "on systems with the libuser and forcelocal=false" do
|
75
|
+
before do
|
76
|
+
described_class.has_feature(:libuser)
|
77
|
+
resource[:forcelocal] = :false
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should use groupmod" do
|
81
|
+
provider.expects(:execute).with(['/usr/sbin/groupmod', '-g', 150, 'mygroup'], has_entry(:custom_environment, {}))
|
82
|
+
provider.gid = 150
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should pass -o to groupmod" do
|
86
|
+
resource[:allowdupe] = :true
|
87
|
+
provider.expects(:execute).with(['/usr/sbin/groupmod', '-g', 150, '-o', 'mygroup'], has_entry(:custom_environment, {}))
|
88
|
+
provider.gid = 150
|
89
|
+
end
|
90
|
+
end
|
91
|
+
describe "on systems with the libuser and forcelocal=true" do
|
92
|
+
before do
|
93
|
+
described_class.has_feature(:libuser)
|
94
|
+
resource[:forcelocal] = :true
|
95
|
+
end
|
96
|
+
|
97
|
+
it "should use lgroupmod instead of groupmod" do
|
98
|
+
provider.expects(:execute).with(['/usr/sbin/lgroupmod', '-g', 150, 'mygroup'], has_entry(:custom_environment, has_key('LIBUSER_CONF')))
|
99
|
+
provider.gid = 150
|
100
|
+
end
|
101
|
+
|
102
|
+
it "should NOT pass -o to lgroupmod" do
|
103
|
+
resource[:allowdupe] = :true
|
104
|
+
provider.expects(:execute).with(['/usr/sbin/lgroupmod', '-g', 150, 'mygroup'], has_entry(:custom_environment, has_key('LIBUSER_CONF')))
|
105
|
+
provider.gid = 150
|
106
|
+
end
|
107
|
+
it "should raise an exception for duplicate GID if allowdupe is not set and duplicate GIDs exist" do
|
108
|
+
resource[:gid] = 150
|
109
|
+
resource[:allowdupe] = :false
|
110
|
+
provider.stubs(:findgroup).returns(true)
|
111
|
+
expect { provider.gid = 150 }.to raise_error(Puppet::Error, "GID 150 already exists, use allowdupe to force group creation")
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
68
116
|
describe "#gid=" do
|
69
117
|
it "should add -o when allowdupe is enabled and the gid is being modified" do
|
70
118
|
resource[:allowdupe] = :true
|
71
|
-
provider.expects(:execute).with(['/usr/sbin/groupmod', '-g', 150, '-o', 'mygroup'])
|
119
|
+
provider.expects(:execute).with(['/usr/sbin/groupmod', '-g', 150, '-o', 'mygroup'], has_entry(:custom_environment, {}))
|
72
120
|
provider.gid = 150
|
73
121
|
end
|
74
122
|
end
|
123
|
+
|
124
|
+
describe "#delete" do
|
125
|
+
before do
|
126
|
+
provider.stubs(:exists?).returns(true)
|
127
|
+
end
|
128
|
+
describe "on systems with the libuser and forcelocal=false" do
|
129
|
+
before do
|
130
|
+
described_class.has_feature(:libuser)
|
131
|
+
resource[:forcelocal] = :false
|
132
|
+
end
|
133
|
+
|
134
|
+
it "should use groupdel" do
|
135
|
+
provider.expects(:execute).with(['/usr/sbin/groupdel', 'mygroup'], has_entry(:custom_environment, {}))
|
136
|
+
provider.delete
|
137
|
+
end
|
138
|
+
end
|
139
|
+
describe "on systems with the libuser and forcelocal=true" do
|
140
|
+
before do
|
141
|
+
described_class.has_feature(:libuser)
|
142
|
+
resource[:forcelocal] = :true
|
143
|
+
end
|
144
|
+
|
145
|
+
it "should use lgroupdel instead of groupdel" do
|
146
|
+
provider.expects(:execute).with(['/usr/sbin/lgroupdel', 'mygroup'], has_entry(:custom_environment, has_key('LIBUSER_CONF')))
|
147
|
+
provider.delete
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
75
151
|
end
|
76
152
|
|