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
@@ -0,0 +1,25 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe "the 'tagged' function" do
|
5
|
+
before :all do
|
6
|
+
Puppet::Parser::Functions.autoloader.loadall
|
7
|
+
end
|
8
|
+
|
9
|
+
before :each do
|
10
|
+
node = Puppet::Node.new('localhost')
|
11
|
+
compiler = Puppet::Parser::Compiler.new(node)
|
12
|
+
@scope = Puppet::Parser::Scope.new(compiler)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should exist" do
|
16
|
+
expect(Puppet::Parser::Functions.function(:tagged)).to eq("function_tagged")
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'is not available when --tasks is on' do
|
20
|
+
Puppet[:tasks] = true
|
21
|
+
expect do
|
22
|
+
@scope.function_tagged(['one', 'two'])
|
23
|
+
end.to raise_error(Puppet::ParseError, /is only available when compiling a catalog/)
|
24
|
+
end
|
25
|
+
end
|
@@ -81,6 +81,14 @@ describe "the template function" do
|
|
81
81
|
}.to raise_error(Puppet::ParseError, /undefined method `lookupvar'/)
|
82
82
|
end
|
83
83
|
|
84
|
+
it 'is not available when --tasks is on' do
|
85
|
+
Puppet[:tasks] = true
|
86
|
+
expect {
|
87
|
+
eval_template("<%= lookupvar('myvar') %>")
|
88
|
+
}.to raise_error(Puppet::ParseError, /is only available when compiling a catalog/)
|
89
|
+
|
90
|
+
end
|
91
|
+
|
84
92
|
def eval_template(content)
|
85
93
|
Puppet::FileSystem.stubs(:read_preserve_line_endings).with("template").returns(content)
|
86
94
|
Puppet::Parser::Files.stubs(:find_template).returns("template")
|
@@ -42,6 +42,25 @@ describe Puppet::Parser::Scope do
|
|
42
42
|
expect(@scope.inspect).to eq("Scope(foo::bar)")
|
43
43
|
end
|
44
44
|
|
45
|
+
it "should generate a path if there is one on the puppet stack" do
|
46
|
+
result = Puppet::Pops::PuppetStack.stack('/tmp/kansas.pp', 42, @scope, 'inspect', [])
|
47
|
+
expect(result).to eq("Scope(/tmp/kansas.pp, 42)")
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should generate an <env> shortened path if path points into the environment" do
|
51
|
+
env_path = @scope.environment.configuration.path_to_env
|
52
|
+
mocked_path = File.join(env_path, 'oz.pp')
|
53
|
+
result = Puppet::Pops::PuppetStack.stack(mocked_path, 42, @scope, 'inspect', [])
|
54
|
+
|
55
|
+
expect(result).to eq("Scope(<env>/oz.pp, 42)")
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should generate a <module> shortened path if path points into a module" do
|
59
|
+
mocked_path = File.join(@scope.environment.full_modulepath[0], 'mymodule', 'oz.pp')
|
60
|
+
result = Puppet::Pops::PuppetStack.stack(mocked_path, 42, @scope, 'inspect', [])
|
61
|
+
expect(result).to eq("Scope(<module>/mymodule/oz.pp, 42)")
|
62
|
+
end
|
63
|
+
|
45
64
|
it "should return a scope for use in a test harness" do
|
46
65
|
expect(create_test_scope_for_node("node_name_foo")).to be_a_kind_of(Puppet::Parser::Scope)
|
47
66
|
end
|
@@ -171,7 +171,7 @@ describe 'Puppet::Pops::Evaluator::EvaluatorImpl' do
|
|
171
171
|
))).to eq('w00t')
|
172
172
|
end
|
173
173
|
|
174
|
-
it "3 ? {1 => 'wat', default => 'w00t',
|
174
|
+
it "3 ? {1 => 'wat', default => 'w00t', 2 => 'wat'} == 'w00t'" do
|
175
175
|
expect(evaluate(literal(3).select(
|
176
176
|
MAP(literal(1), literal('wat')),
|
177
177
|
MAP(literal(:default), literal('w00t')),
|
@@ -0,0 +1,516 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'puppet_spec/files'
|
3
|
+
require 'puppet_spec/compiler'
|
4
|
+
|
5
|
+
require 'puppet/pops'
|
6
|
+
require 'puppet/loaders'
|
7
|
+
|
8
|
+
module Puppet::Pops
|
9
|
+
module Loader
|
10
|
+
describe 'The Loader' do
|
11
|
+
include PuppetSpec::Compiler
|
12
|
+
include PuppetSpec::Files
|
13
|
+
|
14
|
+
before(:each) do
|
15
|
+
Puppet[:tasks] = true
|
16
|
+
end
|
17
|
+
|
18
|
+
let(:testing_env) do
|
19
|
+
{
|
20
|
+
'testing' => {
|
21
|
+
'functions' => functions,
|
22
|
+
'lib' => { 'puppet' => lib_puppet },
|
23
|
+
'manifests' => manifests,
|
24
|
+
'modules' => modules,
|
25
|
+
'plans' => plans,
|
26
|
+
'tasks' => tasks,
|
27
|
+
'types' => types,
|
28
|
+
}
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
let(:functions) { {} }
|
33
|
+
let(:manifests) { {} }
|
34
|
+
let(:modules) { {} }
|
35
|
+
let(:plans) { {} }
|
36
|
+
let(:lib_puppet) { {} }
|
37
|
+
let(:tasks) { {} }
|
38
|
+
let(:types) { {} }
|
39
|
+
|
40
|
+
let(:environments_dir) { Puppet[:environmentpath] }
|
41
|
+
|
42
|
+
let(:testing_env_dir) do
|
43
|
+
dir_contained_in(environments_dir, testing_env)
|
44
|
+
env_dir = File.join(environments_dir, 'testing')
|
45
|
+
PuppetSpec::Files.record_tmp(env_dir)
|
46
|
+
env_dir
|
47
|
+
end
|
48
|
+
|
49
|
+
let(:modules_dir) { File.join(testing_env_dir, 'modules') }
|
50
|
+
let(:env) { Puppet::Node::Environment.create(:testing, [modules_dir]) }
|
51
|
+
let(:node) { Puppet::Node.new('test', :environment => env) }
|
52
|
+
let(:loader) { Loaders.find_loader(nil) }
|
53
|
+
let(:tasks_feature) { false }
|
54
|
+
|
55
|
+
before(:each) do
|
56
|
+
Puppet[:tasks] = tasks_feature
|
57
|
+
loaders = Loaders.new(env)
|
58
|
+
Puppet.push_context(:loaders => loaders)
|
59
|
+
loaders.pre_load
|
60
|
+
end
|
61
|
+
|
62
|
+
after(:each) { Puppet.pop_context }
|
63
|
+
|
64
|
+
context 'when doing discovery' do
|
65
|
+
context 'of things' do
|
66
|
+
it 'finds statically basic types' do
|
67
|
+
expect(loader.discover(:type)).to include(tn(:type, 'integer'))
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'finds statically loaded types' do
|
71
|
+
expect(loader.discover(:type)).to include(tn(:type, 'file'))
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'finds statically loaded Object types' do
|
75
|
+
expect(loader.discover(:type)).to include(tn(:type, 'puppet::ast::accessexpression'))
|
76
|
+
end
|
77
|
+
|
78
|
+
context 'in environment' do
|
79
|
+
let(:types) {
|
80
|
+
{
|
81
|
+
'global.pp' => <<-PUPPET.unindent,
|
82
|
+
type Global = Integer
|
83
|
+
PUPPET
|
84
|
+
'environment' => {
|
85
|
+
'env.pp' => <<-PUPPET.unindent,
|
86
|
+
type Environment::Env = String
|
87
|
+
PUPPET
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
let(:tasks) {
|
93
|
+
{
|
94
|
+
'globtask' => '',
|
95
|
+
'environment' => {
|
96
|
+
'envtask' => ''
|
97
|
+
}
|
98
|
+
}
|
99
|
+
}
|
100
|
+
|
101
|
+
let(:functions) {
|
102
|
+
{
|
103
|
+
'globfunc.pp' => 'function globfunc() {}',
|
104
|
+
'environment' => {
|
105
|
+
'envfunc.pp' => 'function environment::envfunc() {}'
|
106
|
+
}
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
let(:lib_puppet) {
|
111
|
+
{
|
112
|
+
'functions' => {
|
113
|
+
'globrubyfunc.rb' => 'Puppet::Functions.create_function(:globrubyfunc) { def globrubyfunc; end }',
|
114
|
+
'environment' => {
|
115
|
+
'envrubyfunc.rb' => "Puppet::Functions.create_function(:'environment::envrubyfunc') { def envrubyfunc; end }",
|
116
|
+
}
|
117
|
+
}
|
118
|
+
}
|
119
|
+
}
|
120
|
+
|
121
|
+
it 'finds global types in environment' do
|
122
|
+
expect(loader.discover(:type)).to include(tn(:type, 'global'))
|
123
|
+
end
|
124
|
+
|
125
|
+
it 'finds global functions in environment' do
|
126
|
+
expect(loader.discover(:function)).to include(tn(:function, 'lookup'))
|
127
|
+
end
|
128
|
+
|
129
|
+
it 'finds types prefixed with Environment in environment' do
|
130
|
+
expect(loader.discover(:type)).to include(tn(:type, 'environment::env'))
|
131
|
+
end
|
132
|
+
|
133
|
+
it 'finds global functions in environment' do
|
134
|
+
expect(loader.discover(:function)).to include(tn(:function, 'globfunc'))
|
135
|
+
end
|
136
|
+
|
137
|
+
it 'finds functions prefixed with Environment in environment' do
|
138
|
+
expect(loader.discover(:function)).to include(tn(:function, 'environment::envfunc'))
|
139
|
+
end
|
140
|
+
|
141
|
+
it 'finds global ruby functions in environment' do
|
142
|
+
expect(loader.discover(:function)).to include(tn(:function, 'globrubyfunc'))
|
143
|
+
end
|
144
|
+
|
145
|
+
it 'finds ruby functions prefixed with Environment in environment' do
|
146
|
+
expect(loader.discover(:function)).to include(tn(:function, 'environment::envrubyfunc'))
|
147
|
+
end
|
148
|
+
|
149
|
+
it 'can filter the list of discovered entries using a block' do
|
150
|
+
expect(loader.discover(:function) { |t| t.name =~ /rubyfunc\z/ }).to contain_exactly(
|
151
|
+
tn(:function, 'environment::envrubyfunc'),
|
152
|
+
tn(:function, 'globrubyfunc')
|
153
|
+
)
|
154
|
+
end
|
155
|
+
|
156
|
+
context 'with tasks feature enabled' do
|
157
|
+
let(:tasks_feature) { true }
|
158
|
+
|
159
|
+
it 'finds global tasks in environment' do
|
160
|
+
expect(loader.discover(:task)).to include(tn(:task, 'globtask'))
|
161
|
+
end
|
162
|
+
|
163
|
+
it 'finds tasks prefixed with Environment in environment' do
|
164
|
+
expect(loader.discover(:task)).to include(tn(:task, 'environment::envtask'))
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
context 'with multiple modules' do
|
169
|
+
let(:metadata_json_a) {
|
170
|
+
{
|
171
|
+
'name' => 'example/a',
|
172
|
+
'version' => '0.1.0',
|
173
|
+
'source' => 'git@github.com/example/example-a.git',
|
174
|
+
'dependencies' => [{'name' => 'c', 'version_range' => '>=0.1.0'}],
|
175
|
+
'author' => 'Bob the Builder',
|
176
|
+
'license' => 'Apache-2.0'
|
177
|
+
}
|
178
|
+
}
|
179
|
+
|
180
|
+
let(:metadata_json_b) {
|
181
|
+
{
|
182
|
+
'name' => 'example/b',
|
183
|
+
'version' => '0.1.0',
|
184
|
+
'source' => 'git@github.com/example/example-b.git',
|
185
|
+
'dependencies' => [{'name' => 'c', 'version_range' => '>=0.1.0'}],
|
186
|
+
'author' => 'Bob the Builder',
|
187
|
+
'license' => 'Apache-2.0'
|
188
|
+
}
|
189
|
+
}
|
190
|
+
|
191
|
+
let(:metadata_json_c) {
|
192
|
+
{
|
193
|
+
'name' => 'example/c',
|
194
|
+
'version' => '0.1.0',
|
195
|
+
'source' => 'git@github.com/example/example-c.git',
|
196
|
+
'dependencies' => [],
|
197
|
+
'author' => 'Bob the Builder',
|
198
|
+
'license' => 'Apache-2.0'
|
199
|
+
}
|
200
|
+
}
|
201
|
+
|
202
|
+
let(:modules) {
|
203
|
+
{
|
204
|
+
'a' => {
|
205
|
+
'functions' => a_functions,
|
206
|
+
'lib' => { 'puppet' => a_lib_puppet },
|
207
|
+
'plans' => a_plans,
|
208
|
+
'tasks' => a_tasks,
|
209
|
+
'types' => a_types,
|
210
|
+
'metadata.json' => metadata_json_a.to_json
|
211
|
+
},
|
212
|
+
'b' => {
|
213
|
+
'functions' => b_functions,
|
214
|
+
'lib' => { 'puppet' => b_lib_puppet },
|
215
|
+
'plans' => b_plans,
|
216
|
+
'tasks' => b_tasks,
|
217
|
+
'types' => b_types,
|
218
|
+
'metadata.json' => metadata_json_b.to_json
|
219
|
+
},
|
220
|
+
'c' => {
|
221
|
+
'types' => c_types,
|
222
|
+
'tasks' => c_tasks,
|
223
|
+
'metadata.json' => metadata_json_c.to_json
|
224
|
+
},
|
225
|
+
}
|
226
|
+
}
|
227
|
+
|
228
|
+
let(:a_plans) {
|
229
|
+
{
|
230
|
+
'aplan.pp' => <<-PUPPET.unindent,
|
231
|
+
plan a::aplan() {}
|
232
|
+
PUPPET
|
233
|
+
}
|
234
|
+
}
|
235
|
+
|
236
|
+
let(:a_types) {
|
237
|
+
{
|
238
|
+
'atype.pp' => <<-PUPPET.unindent,
|
239
|
+
type A::Atype = Integer
|
240
|
+
PUPPET
|
241
|
+
}
|
242
|
+
}
|
243
|
+
|
244
|
+
let(:a_tasks) {
|
245
|
+
{
|
246
|
+
'atask' => '',
|
247
|
+
}
|
248
|
+
}
|
249
|
+
|
250
|
+
let(:a_functions) {
|
251
|
+
{
|
252
|
+
'afunc.pp' => 'function a::afunc() {}',
|
253
|
+
}
|
254
|
+
}
|
255
|
+
|
256
|
+
let(:a_lib_puppet) {
|
257
|
+
{
|
258
|
+
'functions' => {
|
259
|
+
'a' => {
|
260
|
+
'arubyfunc.rb' => "Puppet::Functions.create_function(:'a::arubyfunc') { def arubyfunc; end }",
|
261
|
+
}
|
262
|
+
}
|
263
|
+
}
|
264
|
+
}
|
265
|
+
|
266
|
+
let(:b_plans) {
|
267
|
+
{
|
268
|
+
'init.pp' => <<-PUPPET.unindent,
|
269
|
+
plan b() {}
|
270
|
+
PUPPET
|
271
|
+
'aplan.pp' => <<-PUPPET.unindent,
|
272
|
+
plan b::aplan() {}
|
273
|
+
PUPPET
|
274
|
+
}
|
275
|
+
}
|
276
|
+
|
277
|
+
let(:b_types) {
|
278
|
+
{
|
279
|
+
'atype.pp' => <<-PUPPET.unindent,
|
280
|
+
type B::Atype = Integer
|
281
|
+
PUPPET
|
282
|
+
}
|
283
|
+
}
|
284
|
+
|
285
|
+
let(:b_tasks) {
|
286
|
+
{
|
287
|
+
'init.json' => <<-JSON.unindent,
|
288
|
+
{
|
289
|
+
"description": "test task b",
|
290
|
+
"parameters": {}
|
291
|
+
}
|
292
|
+
JSON
|
293
|
+
'init.sh' => "# doing exactly nothing\n",
|
294
|
+
'atask' => "# doing exactly nothing\n",
|
295
|
+
'atask.json' => <<-JSON.unindent,
|
296
|
+
{
|
297
|
+
"description": "test task b::atask",
|
298
|
+
"input_method": "stdin",
|
299
|
+
"parameters": {
|
300
|
+
"string_param": {
|
301
|
+
"description": "A string parameter",
|
302
|
+
"type": "String[1]"
|
303
|
+
},
|
304
|
+
"int_param": {
|
305
|
+
"description": "An integer parameter",
|
306
|
+
"type": "Integer"
|
307
|
+
}
|
308
|
+
}
|
309
|
+
}
|
310
|
+
JSON
|
311
|
+
}
|
312
|
+
}
|
313
|
+
|
314
|
+
let(:b_functions) {
|
315
|
+
{
|
316
|
+
'afunc.pp' => 'function b::afunc() {}',
|
317
|
+
}
|
318
|
+
}
|
319
|
+
|
320
|
+
let(:b_lib_puppet) {
|
321
|
+
{
|
322
|
+
'functions' => {
|
323
|
+
'b' => {
|
324
|
+
'arubyfunc.rb' => "Puppet::Functions.create_function(:'b::arubyfunc') { def arubyfunc; end }",
|
325
|
+
}
|
326
|
+
}
|
327
|
+
}
|
328
|
+
}
|
329
|
+
|
330
|
+
let(:c_types) {
|
331
|
+
{
|
332
|
+
'atype.pp' => <<-PUPPET.unindent,
|
333
|
+
type C::Atype = Integer
|
334
|
+
PUPPET
|
335
|
+
}
|
336
|
+
}
|
337
|
+
|
338
|
+
let(:c_tasks) {
|
339
|
+
{
|
340
|
+
'foo.sh' => <<-SH.unindent,
|
341
|
+
# This is a task that does nothing
|
342
|
+
SH
|
343
|
+
'fee.md' => <<-MD.unindent,
|
344
|
+
This is not a task because it has .md extension
|
345
|
+
MD
|
346
|
+
'fum.conf' => <<-CONF.unindent,
|
347
|
+
text=This is not a task because it has .conf extension
|
348
|
+
CONF
|
349
|
+
'bad_syntax.sh' => '',
|
350
|
+
'bad_syntax.json' => <<-TXT.unindent,
|
351
|
+
text => This is not a task because JSON is unparsable
|
352
|
+
TXT
|
353
|
+
'bad_content.sh' => '',
|
354
|
+
'bad_content.json' => <<-JSON.unindent,
|
355
|
+
{
|
356
|
+
"description": "This is not a task because parameters is misspelled",
|
357
|
+
"paramters": { "string_param": { "type": "String[1]" } }
|
358
|
+
}
|
359
|
+
JSON
|
360
|
+
'missing_adjacent.json' => <<-JSON.unindent,
|
361
|
+
{
|
362
|
+
"description": "This is not a task because there is no adjacent file with the same base name",
|
363
|
+
"parameters": { "string_param": { "type": "String[1]" } }
|
364
|
+
}
|
365
|
+
JSON
|
366
|
+
}
|
367
|
+
}
|
368
|
+
|
369
|
+
it 'private loader finds types in all modules' do
|
370
|
+
expect(loader.private_loader.discover(:type) { |t| t.name =~ /^.::.*\z/ }).to(
|
371
|
+
contain_exactly(tn(:type, 'a::atype'), tn(:type, 'b::atype'), tn(:type, 'c::atype')))
|
372
|
+
end
|
373
|
+
|
374
|
+
it 'module loader finds types only in itself' do
|
375
|
+
expect(Loaders.find_loader('a').discover(:type) { |t| t.name =~ /^.::.*\z/ }).to(
|
376
|
+
contain_exactly(tn(:type, 'a::atype')))
|
377
|
+
end
|
378
|
+
|
379
|
+
it 'private loader finds functions in all modules' do
|
380
|
+
expect(loader.private_loader.discover(:function) { |t| t.name =~ /^.::.*\z/ }).to(
|
381
|
+
contain_exactly(tn(:function, 'a::afunc'), tn(:function, 'b::afunc'), tn(:function, 'a::arubyfunc'), tn(:function, 'b::arubyfunc')))
|
382
|
+
end
|
383
|
+
|
384
|
+
it 'module loader finds functions only in itself' do
|
385
|
+
expect(Loaders.find_loader('a').discover(:function) { |t| t.name =~ /^.::.*\z/ }).to(
|
386
|
+
contain_exactly(tn(:function, 'a::afunc'), tn(:function, 'a::arubyfunc')))
|
387
|
+
end
|
388
|
+
|
389
|
+
it 'discover is only called once on dependent loader' do
|
390
|
+
ModuleLoaders::FileBased.any_instance.expects(:discover).times(4).with(:type, nil, Pcore::RUNTIME_NAME_AUTHORITY).returns([])
|
391
|
+
expect(loader.private_loader.discover(:type) { |t| t.name =~ /^.::.*\z/ }).to(contain_exactly())
|
392
|
+
end
|
393
|
+
|
394
|
+
context 'with tasks enabled' do
|
395
|
+
let(:tasks_feature) { true }
|
396
|
+
|
397
|
+
it 'private loader finds plans in all modules' do
|
398
|
+
expect(loader.private_loader.discover(:plan) { |t| t.name =~ /^.(?:::.*)?\z/ }).to(
|
399
|
+
contain_exactly(tn(:plan, 'b'), tn(:plan, 'a::aplan'), tn(:plan, 'b::aplan')))
|
400
|
+
end
|
401
|
+
|
402
|
+
it 'module loader finds plans only in itself' do
|
403
|
+
expect(Loaders.find_loader('a').discover(:plan)).to(
|
404
|
+
contain_exactly(tn(:plan, 'a::aplan')))
|
405
|
+
end
|
406
|
+
|
407
|
+
it 'private loader finds types in all modules' do
|
408
|
+
expect(loader.private_loader.discover(:type) { |t| t.name =~ /^.::.*\z/ }).to(
|
409
|
+
contain_exactly(tn(:type, 'a::atype'), tn(:type, 'b::atype'), tn(:type, 'c::atype')))
|
410
|
+
end
|
411
|
+
|
412
|
+
it 'private loader finds tasks in all modules' do
|
413
|
+
expect(loader.private_loader.discover(:task) { |t| t.name =~ /^.(?:::.*)?\z/ }).to(
|
414
|
+
contain_exactly(tn(:task, 'a::atask'), tn(:task, 'b::atask'), tn(:task, 'b'), tn(:task, 'c::foo')))
|
415
|
+
end
|
416
|
+
|
417
|
+
it 'module loader finds types only in itself' do
|
418
|
+
expect(Loaders.find_loader('a').discover(:type) { |t| t.name =~ /^.::.*\z/ }).to(
|
419
|
+
contain_exactly(tn(:type, 'a::atype')))
|
420
|
+
end
|
421
|
+
|
422
|
+
it 'module loader finds tasks only in itself' do
|
423
|
+
expect(Loaders.find_loader('a').discover(:task) { |t| t.name =~ /^.::.*\z/ }).to(
|
424
|
+
contain_exactly(tn(:task, 'a::atask')))
|
425
|
+
end
|
426
|
+
|
427
|
+
it 'module loader does not consider files with .md and .conf extension to be tasks' do
|
428
|
+
expect(Loaders.find_loader('c').discover(:task) { |t| t.name =~ /(?:foo|fee|fum)\z/ }).to(
|
429
|
+
contain_exactly(tn(:task, 'c::foo')))
|
430
|
+
end
|
431
|
+
|
432
|
+
it 'without error_collector, invalid task metadata results in warnings' do
|
433
|
+
logs = []
|
434
|
+
Puppet::Util::Log.with_destination(Puppet::Test::LogCollector.new(logs)) do
|
435
|
+
expect(Loaders.find_loader('c').discover(:task)).to(
|
436
|
+
contain_exactly(tn(:task, 'environment::envtask'), tn(:task, 'globtask'), tn(:task, 'c::foo')))
|
437
|
+
end
|
438
|
+
expect(logs.select { |log| log.level == :warning }.map { |log| log.message }).to(
|
439
|
+
contain_exactly(/unexpected token/, /unrecognized key/, /No source besides task metadata was found/)
|
440
|
+
)
|
441
|
+
end
|
442
|
+
|
443
|
+
it 'with error_collector, errors are collected and no warnings are logged' do
|
444
|
+
logs = []
|
445
|
+
error_collector = []
|
446
|
+
Puppet::Util::Log.with_destination(Puppet::Test::LogCollector.new(logs)) do
|
447
|
+
expect(Loaders.find_loader('c').discover(:task, error_collector)).to(
|
448
|
+
contain_exactly(tn(:task, 'environment::envtask'), tn(:task, 'globtask'), tn(:task, 'c::foo')))
|
449
|
+
end
|
450
|
+
expect(logs.select { |log| log.level == :warning }.map { |log| log.message }).to be_empty
|
451
|
+
expect(error_collector.size).to eql(3)
|
452
|
+
expect(error_collector.all? { |e| e.is_a?(Puppet::DataTypes::Error) })
|
453
|
+
expect(error_collector.all? { |e| e.issue_code == Puppet::Pops::Issues::LOADER_FAILURE.issue_code })
|
454
|
+
expect(error_collector.map { |e| e.details['original_error'] }).to(
|
455
|
+
contain_exactly(/unexpected token/, /unrecognized key/, /No source besides task metadata was found/)
|
456
|
+
)
|
457
|
+
end
|
458
|
+
|
459
|
+
context 'and an environment without directory' do
|
460
|
+
let(:environments_dir) { tmpdir('loader_spec') }
|
461
|
+
let(:env) { Puppet::Node::Environment.create(:none_such, [modules_dir]) }
|
462
|
+
|
463
|
+
it 'an EmptyLoader is used and module loader finds types' do
|
464
|
+
Puppet::Pops::Loader::ModuleLoaders::EmptyLoader.any_instance.expects(:find).at_least_once.returns(nil)
|
465
|
+
expect(Loaders.find_loader('a').discover(:type) { |t| t.name =~ /^.::.*\z/ }).to(
|
466
|
+
contain_exactly(tn(:type, 'a::atype')))
|
467
|
+
end
|
468
|
+
|
469
|
+
it 'an EmptyLoader is used and module loader finds tasks' do
|
470
|
+
Puppet::Pops::Loader::ModuleLoaders::EmptyLoader.any_instance.expects(:find).at_least_once.returns(nil)
|
471
|
+
expect(Loaders.find_loader('a').discover(:task) { |t| t.name =~ /^.::.*\z/ }).to(
|
472
|
+
contain_exactly(tn(:task, 'a::atask')))
|
473
|
+
end
|
474
|
+
end
|
475
|
+
end
|
476
|
+
|
477
|
+
context 'with no explicit dependencies' do
|
478
|
+
|
479
|
+
let(:modules) {
|
480
|
+
{
|
481
|
+
'a' => {
|
482
|
+
'functions' => a_functions,
|
483
|
+
'lib' => { 'puppet' => a_lib_puppet },
|
484
|
+
'plans' => a_plans,
|
485
|
+
'tasks' => a_tasks,
|
486
|
+
'types' => a_types,
|
487
|
+
},
|
488
|
+
'b' => {
|
489
|
+
'functions' => b_functions,
|
490
|
+
'lib' => { 'puppet' => b_lib_puppet },
|
491
|
+
'plans' => b_plans,
|
492
|
+
'tasks' => b_tasks,
|
493
|
+
'types' => b_types,
|
494
|
+
},
|
495
|
+
'c' => {
|
496
|
+
'types' => c_types,
|
497
|
+
},
|
498
|
+
}
|
499
|
+
|
500
|
+
it 'discover is only called once on dependent loader' do
|
501
|
+
ModuleLoaders::FileBased.any_instance.expects(:discover).times(4).with(:type, Pcore::RUNTIME_NAME_AUTHORITY).returns([])
|
502
|
+
expect(loader.private_loader.discover(:type) { |t| t.name =~ /^.::.*\z/ }).to(contain_exactly())
|
503
|
+
end
|
504
|
+
}
|
505
|
+
end
|
506
|
+
end
|
507
|
+
end
|
508
|
+
end
|
509
|
+
end
|
510
|
+
|
511
|
+
def tn(type, name)
|
512
|
+
TypedName.new(type, name)
|
513
|
+
end
|
514
|
+
end
|
515
|
+
end
|
516
|
+
end
|