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
@@ -230,6 +230,17 @@ describe 'loaders' do
|
|
230
230
|
expect(function.call({})).to eql("usee2::callee() was told 'passed value' + I am user::caller2()")
|
231
231
|
end
|
232
232
|
|
233
|
+
it 'all other modules are visible when tasks are enabled' do
|
234
|
+
Puppet[:tasks] = true
|
235
|
+
|
236
|
+
env = environment_for(File.join(dependent_modules_with_metadata, 'modules'))
|
237
|
+
loaders = Puppet::Pops::Loaders.new(env)
|
238
|
+
|
239
|
+
moduleb_loader = loaders.private_loader_for_module('user')
|
240
|
+
function = moduleb_loader.load_typed(typed_name(:function, 'user::caller')).value
|
241
|
+
expect(function.call({})).to eql("usee::callee() was told 'passed value' + I am user::caller()")
|
242
|
+
end
|
243
|
+
|
233
244
|
[ 'outside a function', 'a puppet function declared under functions', 'a puppet function declared in init.pp', 'a ruby function'].each_with_index do |from, from_idx|
|
234
245
|
[ {:from => from, :called => 'a puppet function declared under functions', :expects => "I'm the function usee::usee_puppet()"},
|
235
246
|
{:from => from, :called => 'a puppet function declared in init.pp', :expects => "I'm the function usee::usee_puppet_init()"},
|
@@ -90,6 +90,49 @@ describe 'FileBased module loader' do
|
|
90
90
|
expect(function.is_a?(Puppet::Functions::Function)).to eq(true)
|
91
91
|
end
|
92
92
|
|
93
|
+
context 'loading tasks' do
|
94
|
+
before(:each) do
|
95
|
+
Puppet[:tasks] = true
|
96
|
+
Puppet.push_context(:loaders => loaders)
|
97
|
+
end
|
98
|
+
after(:each) { Puppet.pop_context }
|
99
|
+
|
100
|
+
it 'can load tasks with multiple files' do
|
101
|
+
module_dir = dir_containing('testmodule', 'tasks' => {'foo.py' => '', 'foo.json' => '{}'})
|
102
|
+
|
103
|
+
module_loader = Puppet::Pops::Loader::ModuleLoaders.module_loader_from(static_loader, loaders, 'testmodule', module_dir)
|
104
|
+
|
105
|
+
task = module_loader.load_typed(typed_name(:task, 'testmodule::foo')).value
|
106
|
+
expect(task.name).to eq('testmodule::foo')
|
107
|
+
expect(File.basename(task.executable)).to eq('foo.py')
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'can load multiple tasks with multiple files' do
|
111
|
+
module_dir = dir_containing('testmodule', 'tasks' => {'foo.py' => '', 'foo.json' => '{}', 'foobar.py' => '', 'foobar.json' => '{}'})
|
112
|
+
|
113
|
+
module_loader = Puppet::Pops::Loader::ModuleLoaders.module_loader_from(static_loader, loaders, 'testmodule', module_dir)
|
114
|
+
|
115
|
+
foo_task = module_loader.load_typed(typed_name(:task, 'testmodule::foo')).value
|
116
|
+
foobar_task = module_loader.load_typed(typed_name(:task, 'testmodule::foobar')).value
|
117
|
+
|
118
|
+
expect(foo_task.name).to eq('testmodule::foo')
|
119
|
+
expect(File.basename(foo_task.executable)).to eq('foo.py')
|
120
|
+
expect(foobar_task.name).to eq('testmodule::foobar')
|
121
|
+
expect(File.basename(foobar_task.executable)).to eq('foobar.py')
|
122
|
+
end
|
123
|
+
|
124
|
+
it "won't load tasks with invalid names" do
|
125
|
+
module_dir = dir_containing('testmodule', 'tasks' => {'a-b.py' => '', 'foo.tar.gz' => ''})
|
126
|
+
|
127
|
+
module_loader = Puppet::Pops::Loader::ModuleLoaders.module_loader_from(static_loader, loaders, 'testmodule', module_dir)
|
128
|
+
|
129
|
+
tasks = module_loader.discover(:task)
|
130
|
+
expect(tasks).to be_empty
|
131
|
+
|
132
|
+
expect(module_loader.load_typed(typed_name(:task, 'testmodule::foo'))).to be_nil
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
93
136
|
def typed_name(type, name)
|
94
137
|
Puppet::Pops::Loader::TypedName.new(type, name)
|
95
138
|
end
|
@@ -3,17 +3,22 @@ require 'puppet/pops'
|
|
3
3
|
require 'puppet/loaders'
|
4
4
|
|
5
5
|
describe 'the static loader' do
|
6
|
+
let(:loader) do
|
7
|
+
loader = Puppet::Pops::Loader::StaticLoader.new()
|
8
|
+
loader.runtime_3_init
|
9
|
+
loader
|
10
|
+
end
|
11
|
+
|
6
12
|
it 'has no parent' do
|
7
|
-
expect(
|
13
|
+
expect(loader.parent).to be(nil)
|
8
14
|
end
|
9
15
|
|
10
16
|
it 'identifies itself in string form' do
|
11
|
-
expect(
|
17
|
+
expect(loader.to_s).to be_eql('(StaticLoader)')
|
12
18
|
end
|
13
19
|
|
14
20
|
it 'support the Loader API' do
|
15
21
|
# it may produce things later, this is just to test that calls work as they should - now all lookups are nil.
|
16
|
-
loader = Puppet::Pops::Loader::StaticLoader.new()
|
17
22
|
a_typed_name = typed_name(:function, 'foo')
|
18
23
|
expect(loader[a_typed_name]).to be(nil)
|
19
24
|
expect(loader.load_typed(a_typed_name)).to be(nil)
|
@@ -21,8 +26,6 @@ describe 'the static loader' do
|
|
21
26
|
end
|
22
27
|
|
23
28
|
context 'provides access to resource types built into puppet' do
|
24
|
-
let(:loader) { loader = Puppet::Pops::Loader::StaticLoader.new() }
|
25
|
-
|
26
29
|
%w{
|
27
30
|
Augeas
|
28
31
|
Component
|
@@ -82,11 +85,16 @@ describe 'the static loader' do
|
|
82
85
|
end
|
83
86
|
|
84
87
|
context 'provides access to app-management specific resource types built into puppet' do
|
88
|
+
it "such that Node is available" do
|
89
|
+
expect(loader.load(:type, 'node')).to be_the_type(resource_type('Node'))
|
90
|
+
end
|
91
|
+
end
|
85
92
|
|
93
|
+
context 'without init_runtime3 initialization' do
|
86
94
|
let(:loader) { loader = Puppet::Pops::Loader::StaticLoader.new() }
|
87
95
|
|
88
|
-
it
|
89
|
-
expect(loader.load(:type, '
|
96
|
+
it 'does not provide access to resource types built into puppet' do
|
97
|
+
expect(loader.load(:type, 'file')).to be_nil
|
90
98
|
end
|
91
99
|
end
|
92
100
|
|
@@ -34,4 +34,9 @@ describe Puppet::Pops::Model::Factory do
|
|
34
34
|
x = Factory.literal(2) * Factory.literal(10) + Factory.literal(20)
|
35
35
|
expect(Puppet::Pops::Model::ModelTreeDumper.new.dump(x.model)).to eq("(+ (* 2 10) 20)")
|
36
36
|
end
|
37
|
+
|
38
|
+
describe "should be describable with labels"
|
39
|
+
it 'describes a PlanDefinition as "Plan Definition"' do
|
40
|
+
expect(Puppet::Pops::Model::ModelLabelProvider.new.label(Factory.PLAN('test', [], nil))).to eq("Plan Definition")
|
41
|
+
end
|
37
42
|
end
|
@@ -104,6 +104,21 @@ describe 'Lexer2' do
|
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
107
|
+
context 'when --no-tasks (the default)' do
|
108
|
+
it "should lex a NAME from 'plan'" do
|
109
|
+
expect(tokens_scanned_from('plan')).to match_tokens2(:NAME)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
context 'when --tasks' do
|
114
|
+
before(:each) { Puppet[:tasks] = true }
|
115
|
+
after(:each) { Puppet[:tasks] = false }
|
116
|
+
|
117
|
+
it "should lex a keyword from 'plan'" do
|
118
|
+
expect(tokens_scanned_from('plan')).to match_tokens2(:PLAN)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
107
122
|
# TODO: Complete with all edge cases
|
108
123
|
[ 'A', 'A::B', '::A', '::A::B',].each do |string|
|
109
124
|
it "should lex a CLASSREF on the form '#{string}'" do
|
@@ -21,4 +21,24 @@ describe Puppet::Pops::Parser::Locator do
|
|
21
21
|
expect(model.body.locator.extract_tree_text(model.body)).to eq('1 + 2')
|
22
22
|
end
|
23
23
|
|
24
|
+
it 'Locator caches last offset / line' do
|
25
|
+
#Puppet::Pops::Parser::Locator::AbstractLocator.expects(:ary_bsearch_i).once
|
26
|
+
parser = Puppet::Pops::Parser::Parser.new()
|
27
|
+
model = parser.parse_string("$a\n = 1\n + 1\n").model
|
28
|
+
model.body.locator.expects(:ary_bsearch_i).with(anything, 2).once.returns(:special_value)
|
29
|
+
expect(model.body.locator.line_for_offset(2)).to eq(:special_value)
|
30
|
+
expect(model.body.locator.line_for_offset(2)).to eq(:special_value)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'Locator invalidates last offset / line cache if asked for different offset' do
|
34
|
+
#Puppet::Pops::Parser::Locator::AbstractLocator.expects(:ary_bsearch_i).once
|
35
|
+
parser = Puppet::Pops::Parser::Parser.new()
|
36
|
+
model = parser.parse_string("$a\n = 1\n + 1\n").model
|
37
|
+
model.body.locator.expects(:ary_bsearch_i).with(anything, 2).twice.returns(:first_value, :third_value)
|
38
|
+
model.body.locator.expects(:ary_bsearch_i).with(anything, 3).once.returns(:second_value)
|
39
|
+
expect(model.body.locator.line_for_offset(2)).to eq(:first_value)
|
40
|
+
expect(model.body.locator.line_for_offset(3)).to eq(:second_value) # invalidates cache as side effect
|
41
|
+
expect(model.body.locator.line_for_offset(2)).to eq(:third_value)
|
42
|
+
end
|
43
|
+
|
24
44
|
end
|
@@ -137,6 +137,7 @@ describe "egrammar parsing basic expressions" do
|
|
137
137
|
context "When parsing unfold" do
|
138
138
|
it "$a = *[1,2]" do; expect(dump(parse("$a = *[1,2]"))).to eq("(= $a (unfold ([] 1 2)))") ; end
|
139
139
|
it "$a = *1" do; expect(dump(parse("$a = *1"))).to eq("(= $a (unfold 1))") ; end
|
140
|
+
it "$a = *[1,a => 2]" do; expect(dump(parse("$a = *[1,a => 2]"))).to eq("(= $a (unfold ([] 1 ({} (a 2)))))") ; end
|
140
141
|
end
|
141
142
|
|
142
143
|
context "When parsing Lists" do
|
@@ -152,6 +153,26 @@ describe "egrammar parsing basic expressions" do
|
|
152
153
|
expect(dump(parse("$a = [1,2,3]"))).to eq("(= $a ([] 1 2 3))")
|
153
154
|
end
|
154
155
|
|
156
|
+
it "$a = [1,a => 2]" do
|
157
|
+
expect(dump(parse("$a = [1,a => 2]"))).to eq('(= $a ([] 1 ({} (a 2))))')
|
158
|
+
end
|
159
|
+
|
160
|
+
it "$a = [1,a => 2, 3]" do
|
161
|
+
expect(dump(parse("$a = [1,a => 2, 3]"))).to eq('(= $a ([] 1 ({} (a 2)) 3))')
|
162
|
+
end
|
163
|
+
|
164
|
+
it "$a = [1,a => 2, b => 3]" do
|
165
|
+
expect(dump(parse("$a = [1,a => 2, b => 3]"))).to eq('(= $a ([] 1 ({} (a 2) (b 3))))')
|
166
|
+
end
|
167
|
+
|
168
|
+
it "$a = [1,a => 2, b => 3, 4]" do
|
169
|
+
expect(dump(parse("$a = [1,a => 2, b => 3, 4]"))).to eq('(= $a ([] 1 ({} (a 2) (b 3)) 4))')
|
170
|
+
end
|
171
|
+
|
172
|
+
it "$a = [{ x => y }, a => 2, b => 3, { z => p }]" do
|
173
|
+
expect(dump(parse("$a = [{ x => y }, a => 2, b => 3, { z => p }]"))).to eq('(= $a ([] ({} (x y)) ({} (a 2) (b 3)) ({} (z p))))')
|
174
|
+
end
|
175
|
+
|
155
176
|
it "[...[...[]]] should create nested arrays without trouble" do
|
156
177
|
expect(dump(parse("$a = [1,[2.0, 2.1, [2.2]],[3.0, 3.1]]"))).to eq("(= $a ([] 1 ([] 2.0 2.1 ([] 2.2)) ([] 3.0 3.1)))")
|
157
178
|
end
|
@@ -202,6 +223,10 @@ describe "egrammar parsing basic expressions" do
|
|
202
223
|
expect(dump(parse("$a = [1,2,3][2]"))).to eq("(= $a (slice ([] 1 2 3) 2))")
|
203
224
|
end
|
204
225
|
|
226
|
+
it '$a = [1, 2, 3][a => 2]' do
|
227
|
+
expect(dump(parse('$a = [1,2,3][a => 2]'))).to eq('(= $a (slice ([] 1 2 3) ({} (a 2))))')
|
228
|
+
end
|
229
|
+
|
205
230
|
it "$a = {'a' => 1, 'b' => 2}['b']" do
|
206
231
|
expect(dump(parse("$a = {'a'=>1,'b' =>2}[b]"))).to eq("(= $a (slice ({} ('a' 1) ('b' 2)) b))")
|
207
232
|
end
|
@@ -280,6 +305,14 @@ describe "egrammar parsing basic expressions" do
|
|
280
305
|
expect(dump(parse("$a = {'a'=>1,'b'=>2} != {'a'=>1,'b'=>2}"))).to eq("(= $a (!= ({} ('a' 1) ('b' 2)) ({} ('a' 1) ('b' 2))))")
|
281
306
|
end
|
282
307
|
|
308
|
+
it "$a = 'a' => 1" do
|
309
|
+
expect{parse("$a = 'a' => 1")}.to raise_error(/Syntax error at '=>'/)
|
310
|
+
end
|
311
|
+
|
312
|
+
it "$a = { 'a' => 'b' => 1 }" do
|
313
|
+
expect{parse("$a = { 'a' => 'b' => 1 }")}.to raise_error(/Syntax error at '=>'/)
|
314
|
+
end
|
315
|
+
|
283
316
|
it "calculates the text length of an empty hash" do
|
284
317
|
expect(parse("{}").model.body.length).to eq(2)
|
285
318
|
expect(parse("{ }").model.body.length).to eq(3)
|
@@ -30,6 +30,10 @@ describe "egrammar parsing function calls" do
|
|
30
30
|
expect(dump(parse("notice {a => 2}"))).to eq("(invoke notice ({} ('a' 2)))")
|
31
31
|
end
|
32
32
|
|
33
|
+
it 'notice a=>2' do
|
34
|
+
expect{parse('notice a => 2')}.to raise_error(/Syntax error at '=>'/)
|
35
|
+
end
|
36
|
+
|
33
37
|
it "foo(bar,)" do
|
34
38
|
expect(dump(parse("foo(bar,)"))).to eq("(invoke foo bar)")
|
35
39
|
end
|
@@ -38,6 +42,26 @@ describe "egrammar parsing function calls" do
|
|
38
42
|
expect(dump(parse("foo(bar,fum,)"))).to eq("(invoke foo bar fum)")
|
39
43
|
end
|
40
44
|
|
45
|
+
it 'foo(a=>1)' do
|
46
|
+
expect(dump(parse('foo(a=>1)'))).to eq('(invoke foo ({} (a 1)))')
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'foo(a=>1, b=>2)' do
|
50
|
+
expect(dump(parse('foo(a=>1, b=>2)'))).to eq('(invoke foo ({} (a 1) (b 2)))')
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'foo({a=>1, b=>2})' do
|
54
|
+
expect(dump(parse('foo({a=>1, b=>2})'))).to eq('(invoke foo ({} (a 1) (b 2)))')
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'foo({a=>1}, b=>2)' do
|
58
|
+
expect(dump(parse('foo({a=>1}, b=>2)'))).to eq('(invoke foo ({} (a 1)) ({} (b 2)))')
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'foo(a=>1, {b=>2})' do
|
62
|
+
expect(dump(parse('foo(a=>1, {b=>2})'))).to eq('(invoke foo ({} (a 1)) ({} (b 2)))')
|
63
|
+
end
|
64
|
+
|
41
65
|
it "notice fqdn_rand(30)" do
|
42
66
|
expect(dump(parse("notice fqdn_rand(30)"))).to eq('(invoke notice (call fqdn_rand 30))')
|
43
67
|
end
|
@@ -113,6 +137,10 @@ describe "egrammar parsing function calls" do
|
|
113
137
|
expect(dump(parse("notice 42.type()"))).to eq('(invoke notice (call-method (. 42 type)))')
|
114
138
|
end
|
115
139
|
|
140
|
+
it 'notice Hash.assert_type(a => 42)' do
|
141
|
+
expect(dump(parse('notice Hash.assert_type(a => 42)'))).to eq('(invoke notice (call-method (. hash assert_type) ({} (a 42))))')
|
142
|
+
end
|
143
|
+
|
116
144
|
it "notice 42.type(detailed)" do
|
117
145
|
expect(dump(parse("notice 42.type(detailed)"))).to eq('(invoke notice (call-method (. 42 type) detailed))')
|
118
146
|
end
|
@@ -114,6 +114,18 @@ describe "egrammar parsing conditionals" do
|
|
114
114
|
"(= $a (? $b (:default => wat) (banana => fruit) (grape => berry)))"
|
115
115
|
)
|
116
116
|
end
|
117
|
+
|
118
|
+
it '1+2 ? 3 => yes' do
|
119
|
+
expect(dump(parse("1+2 ? 3 => yes"))).to eq(
|
120
|
+
"(? (+ 1 2) (3 => yes))"
|
121
|
+
)
|
122
|
+
end
|
123
|
+
|
124
|
+
it 'true and 1+2 ? 3 => yes' do
|
125
|
+
expect(dump(parse("true and 1+2 ? 3 => yes"))).to eq(
|
126
|
+
"(&& true (? (+ 1 2) (3 => yes)))"
|
127
|
+
)
|
128
|
+
end
|
117
129
|
end
|
118
130
|
|
119
131
|
context "When parsing case statements" do
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'puppet/pops'
|
4
|
+
require_relative 'parser_rspec_helper'
|
5
|
+
|
6
|
+
describe "egrammar parsing of 'plan'" do
|
7
|
+
include ParserRspecHelper
|
8
|
+
|
9
|
+
context 'with --tasks' do
|
10
|
+
before(:each) do
|
11
|
+
Puppet[:tasks] = true
|
12
|
+
end
|
13
|
+
|
14
|
+
it "an empty body" do
|
15
|
+
expect(dump(parse("plan foo { }"))).to eq("(plan foo ())")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "a non empty body" do
|
19
|
+
prog = <<-EPROG
|
20
|
+
plan foo {
|
21
|
+
$a = 10
|
22
|
+
$b = 20
|
23
|
+
}
|
24
|
+
EPROG
|
25
|
+
expect(dump(parse(prog))).to eq( [
|
26
|
+
"(plan foo (block",
|
27
|
+
" (= $a 10)",
|
28
|
+
" (= $b 20)",
|
29
|
+
"))",
|
30
|
+
].join("\n"))
|
31
|
+
end
|
32
|
+
|
33
|
+
it "accepts parameters" do
|
34
|
+
s = "plan foo($p1 = 'yo', $p2) { }"
|
35
|
+
expect(dump(parse(s))).to eq("(plan foo (parameters (= p1 'yo') p2) ())")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'with --no-tasks' do
|
40
|
+
before(:each) do
|
41
|
+
Puppet[:tasks] = false
|
42
|
+
end
|
43
|
+
|
44
|
+
it "the keyword 'plan' is a name" do
|
45
|
+
expect(dump(parse("$a = plan"))).to eq("(= $a plan)")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -126,6 +126,14 @@ describe "the Puppet::Pops::Serialization when using #{packer_module.name}" do
|
|
126
126
|
expect(val2).to be_a(Types::PBinaryType::Binary)
|
127
127
|
expect(val2).to eql(val)
|
128
128
|
end
|
129
|
+
|
130
|
+
it 'URI' do
|
131
|
+
val = URI('http://bob:ewing@dallas.example.com:8080/oil/baron?crude=cash#leftovers')
|
132
|
+
write(val)
|
133
|
+
val2 = read
|
134
|
+
expect(val2).to be_a(URI)
|
135
|
+
expect(val2).to eql(val)
|
136
|
+
end
|
129
137
|
end
|
130
138
|
|
131
139
|
context 'will fail on attempts to write' do
|
@@ -145,6 +145,14 @@ module Serialization
|
|
145
145
|
expect(val2).to eql(val)
|
146
146
|
end
|
147
147
|
|
148
|
+
it 'URI' do
|
149
|
+
val = URI('http://bob:ewing@dallas.example.com:8080/oil/baron?crude=cash#leftovers')
|
150
|
+
write(val)
|
151
|
+
val2 = read
|
152
|
+
expect(val2).to be_a(URI)
|
153
|
+
expect(val2).to eql(val)
|
154
|
+
end
|
155
|
+
|
148
156
|
it 'Sensitive with rich data' do
|
149
157
|
sval = Time::Timestamp.now
|
150
158
|
val = Types::PSensitiveType::Sensitive.new(sval)
|
@@ -225,6 +233,28 @@ module Serialization
|
|
225
233
|
expect(val2).to be_a(Types::PObjectType)
|
226
234
|
expect(val2).to eql(val)
|
227
235
|
end
|
236
|
+
|
237
|
+
context 'ObjectType' do
|
238
|
+
let(:type) do
|
239
|
+
Types::PObjectType.new({
|
240
|
+
'name' => 'MyType',
|
241
|
+
'type_parameters' => {
|
242
|
+
'x' => Types::PIntegerType::DEFAULT
|
243
|
+
},
|
244
|
+
'attributes' => {
|
245
|
+
'x' => Types::PIntegerType::DEFAULT
|
246
|
+
}
|
247
|
+
})
|
248
|
+
end
|
249
|
+
|
250
|
+
it 'with preserved parameters' do
|
251
|
+
val = type.create(34)._pcore_type
|
252
|
+
write(val)
|
253
|
+
val2 = read
|
254
|
+
expect(val2).to be_a(Types::PObjectTypeExtension)
|
255
|
+
expect(val2).to eql(val)
|
256
|
+
end
|
257
|
+
end
|
228
258
|
end
|
229
259
|
|
230
260
|
it 'Array of rich data' do
|
@@ -146,6 +146,14 @@ module Serialization
|
|
146
146
|
expect(val2).to eql(val)
|
147
147
|
end
|
148
148
|
|
149
|
+
it 'URI' do
|
150
|
+
val = URI('http://bob:ewing@dallas.example.com:8080/oil/baron?crude=cash#leftovers')
|
151
|
+
write(val)
|
152
|
+
val2 = read
|
153
|
+
expect(val2).to be_a(URI)
|
154
|
+
expect(val2).to eql(val)
|
155
|
+
end
|
156
|
+
|
149
157
|
it 'Sensitive with rich data' do
|
150
158
|
sval = Time::Timestamp.now
|
151
159
|
val = Types::PSensitiveType::Sensitive.new(sval)
|
@@ -251,8 +259,31 @@ module Serialization
|
|
251
259
|
expect(val2).to be_a(Types::PObjectType)
|
252
260
|
expect(val2).to eql(val)
|
253
261
|
end
|
262
|
+
|
263
|
+
context 'ObjectType' do
|
264
|
+
let(:type) do
|
265
|
+
Types::PObjectType.new({
|
266
|
+
'name' => 'MyType',
|
267
|
+
'type_parameters' => {
|
268
|
+
'x' => Types::PIntegerType::DEFAULT
|
269
|
+
},
|
270
|
+
'attributes' => {
|
271
|
+
'x' => Types::PIntegerType::DEFAULT
|
272
|
+
}
|
273
|
+
})
|
274
|
+
end
|
275
|
+
|
276
|
+
it 'with preserved parameters' do
|
277
|
+
val = type.create(34)._pcore_type
|
278
|
+
write(val)
|
279
|
+
val2 = read
|
280
|
+
expect(val2).to be_a(Types::PObjectTypeExtension)
|
281
|
+
expect(val2).to eql(val)
|
282
|
+
end
|
283
|
+
end
|
254
284
|
end
|
255
285
|
|
286
|
+
|
256
287
|
it 'Array of rich data' do
|
257
288
|
# Sensitive omitted because it doesn't respond to ==
|
258
289
|
val = [
|