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,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'puppet_spec/compiler'
|
3
|
+
require 'matchers/resource'
|
4
|
+
require 'puppet_spec/files'
|
5
|
+
|
6
|
+
describe 'the module_directory function' do
|
7
|
+
include PuppetSpec::Compiler
|
8
|
+
include Matchers::Resource
|
9
|
+
include PuppetSpec::Files
|
10
|
+
|
11
|
+
it 'returns first found module from one or more given names' do
|
12
|
+
mod = mock 'module'
|
13
|
+
mod.stubs(:path).returns('expected_path')
|
14
|
+
Puppet[:code] = "notify { module_directory('one', 'two'):}"
|
15
|
+
node = Puppet::Node.new('localhost')
|
16
|
+
compiler = Puppet::Parser::Compiler.new(node)
|
17
|
+
compiler.environment.stubs(:module).with('one').returns(nil)
|
18
|
+
compiler.environment.stubs(:module).with('two').returns(mod)
|
19
|
+
expect(compiler.compile()).to have_resource("Notify[expected_path]")
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'returns first found module from one or more given names in an array' do
|
23
|
+
mod = mock 'module'
|
24
|
+
mod.stubs(:path).returns('expected_path')
|
25
|
+
Puppet[:code] = "notify { module_directory(['one', 'two']):}"
|
26
|
+
node = Puppet::Node.new('localhost')
|
27
|
+
compiler = Puppet::Parser::Compiler.new(node)
|
28
|
+
compiler.environment.stubs(:module).with('one').returns(nil)
|
29
|
+
compiler.environment.stubs(:module).with('two').returns(mod)
|
30
|
+
expect(compiler.compile()).to have_resource("Notify[expected_path]")
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'returns undef when none of the modules were found' do
|
34
|
+
mod = mock 'module'
|
35
|
+
mod.stubs(:path).returns('expected_path')
|
36
|
+
Puppet[:code] = "notify { String(type(module_directory('one', 'two'))):}"
|
37
|
+
node = Puppet::Node.new('localhost')
|
38
|
+
compiler = Puppet::Parser::Compiler.new(node)
|
39
|
+
compiler.environment.stubs(:module).with('one').returns(nil)
|
40
|
+
compiler.environment.stubs(:module).with('two').returns(nil)
|
41
|
+
expect(compiler.compile()).to have_resource("Notify[Undef]")
|
42
|
+
end
|
43
|
+
end
|
@@ -28,7 +28,7 @@ describe 'the new function' do
|
|
28
28
|
$x = Integer.new(undef)
|
29
29
|
notify { "one${x}word": }
|
30
30
|
MANIFEST
|
31
|
-
)}.to raise_error(Puppet::Error, /
|
31
|
+
)}.to raise_error(Puppet::Error, /of type Undef cannot be converted to Integer/)
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'errors if converted value is not assignable to the type' do
|
@@ -294,11 +294,11 @@ describe 'the new function' do
|
|
294
294
|
'+ 0XGG'=> :error,
|
295
295
|
'- 0XGG'=> :error,
|
296
296
|
}.each do |str, result|
|
297
|
-
it "errors when given the non
|
297
|
+
it "errors when given the non hexadecimal value compliant string '#{str}'" do
|
298
298
|
expect{compile_to_catalog(<<-"MANIFEST"
|
299
299
|
$x = Integer.new("#{str}", 8)
|
300
300
|
MANIFEST
|
301
|
-
)}.to raise_error(Puppet::Error, /
|
301
|
+
)}.to raise_error(Puppet::Error, /The string '#{Regexp.escape(str)}' cannot be converted to Integer/)
|
302
302
|
end
|
303
303
|
end
|
304
304
|
end
|
@@ -321,7 +321,7 @@ describe 'the new function' do
|
|
321
321
|
'0b10' => :error,
|
322
322
|
'0B10' => :error,
|
323
323
|
}.each do |str, result|
|
324
|
-
it "errors when given the non
|
324
|
+
it "errors when given the non binary value compliant string '#{str}'" do
|
325
325
|
expect{compile_to_catalog(<<-"MANIFEST"
|
326
326
|
$x = Integer.new("#{str}", 10)
|
327
327
|
MANIFEST
|
@@ -352,28 +352,28 @@ describe 'the new function' do
|
|
352
352
|
expect{compile_to_catalog(<<-"MANIFEST"
|
353
353
|
$x = Integer.new('10', 3)
|
354
354
|
MANIFEST
|
355
|
-
)}.to raise_error(Puppet::Error, /
|
355
|
+
)}.to raise_error(Puppet::Error, /Illegal radix/)
|
356
356
|
end
|
357
357
|
|
358
358
|
it 'radix is wrong and when given in long form' do
|
359
359
|
expect{compile_to_catalog(<<-"MANIFEST"
|
360
360
|
$x = Integer.new({from =>'10', radix=>3})
|
361
361
|
MANIFEST
|
362
|
-
)}.to raise_error(Puppet::Error, /
|
362
|
+
)}.to raise_error(Puppet::Error, /Illegal radix/)
|
363
363
|
end
|
364
364
|
|
365
365
|
it 'value is not numeric and given directly' do
|
366
366
|
expect{compile_to_catalog(<<-"MANIFEST"
|
367
367
|
$x = Integer.new('eleven', 10)
|
368
368
|
MANIFEST
|
369
|
-
)}.to raise_error(Puppet::Error, /
|
369
|
+
)}.to raise_error(Puppet::Error, /The string 'eleven' cannot be converted to Integer/)
|
370
370
|
end
|
371
371
|
|
372
372
|
it 'value is not numeric and given in long form' do
|
373
373
|
expect{compile_to_catalog(<<-"MANIFEST"
|
374
374
|
$x = Integer.new({from => 'eleven', radix => 10})
|
375
375
|
MANIFEST
|
376
|
-
)}.to raise_error(Puppet::Error, /
|
376
|
+
)}.to raise_error(Puppet::Error, /The string 'eleven' cannot be converted to Integer/)
|
377
377
|
end
|
378
378
|
end
|
379
379
|
end
|
@@ -538,14 +538,14 @@ describe 'the new function' do
|
|
538
538
|
expect{compile_to_catalog(<<-"MANIFEST"
|
539
539
|
$x = Boolean.new('hello')
|
540
540
|
MANIFEST
|
541
|
-
)}.to raise_error(Puppet::Error, /cannot be converted to Boolean/)
|
541
|
+
)}.to raise_error(Puppet::Error, /The string 'hello' cannot be converted to Boolean/)
|
542
542
|
end
|
543
543
|
|
544
544
|
it "does not convert an undef (as may be expected, but is handled as every other undef)" do
|
545
545
|
expect{compile_to_catalog(<<-"MANIFEST"
|
546
546
|
$x = Boolean.new(undef)
|
547
547
|
MANIFEST
|
548
|
-
)}.to raise_error(Puppet::Error, /
|
548
|
+
)}.to raise_error(Puppet::Error, /of type Undef cannot be converted to Boolean/)
|
549
549
|
end
|
550
550
|
end
|
551
551
|
|
@@ -566,8 +566,8 @@ describe 'the new function' do
|
|
566
566
|
end
|
567
567
|
|
568
568
|
{
|
569
|
-
true => /cannot be converted to Array/,
|
570
|
-
42.3 => /cannot be converted to Array/,
|
569
|
+
true => /of type Boolean cannot be converted to Array/,
|
570
|
+
42.3 => /of type Float cannot be converted to Array/,
|
571
571
|
}.each do |input, error_match|
|
572
572
|
it "errors when given an non convertible #{input.inspect} when wrap is not given" do
|
573
573
|
expect{compile_to_catalog(<<-"MANIFEST"
|
@@ -650,7 +650,7 @@ describe 'the new function' do
|
|
650
650
|
end
|
651
651
|
end
|
652
652
|
|
653
|
-
{ true => /cannot be converted to Hash/,
|
653
|
+
{ true => /Value of type Boolean cannot be converted to Hash/,
|
654
654
|
[1,2,3] => /odd number of arguments for Hash/,
|
655
655
|
}.each do |input, error_match|
|
656
656
|
it "errors when given an non convertible #{input.inspect}" do
|
@@ -714,7 +714,7 @@ describe 'the new function' do
|
|
714
714
|
expect{compile_to_catalog(<<-"MANIFEST"
|
715
715
|
$x = Struct[{a => Integer[2]}].new({a => 0})
|
716
716
|
MANIFEST
|
717
|
-
)}.to raise_error(Puppet::Error, /entry 'a' expects an Integer\[2
|
717
|
+
)}.to raise_error(Puppet::Error, /entry 'a' expects an Integer\[2\]/)
|
718
718
|
end
|
719
719
|
end
|
720
720
|
|
@@ -80,4 +80,6 @@ describe 'The "require" function' do
|
|
80
80
|
|
81
81
|
it_should_behave_like 'all functions transforming relative to absolute names', :require
|
82
82
|
it_should_behave_like 'an inclusion function, regardless of the type of class reference,', :require
|
83
|
+
it_should_behave_like 'an inclusion function, when --tasks is on,', :require
|
84
|
+
|
83
85
|
end
|
@@ -83,3 +83,15 @@ shared_examples_for 'an inclusion function, regardless of the type of class refe
|
|
83
83
|
end
|
84
84
|
|
85
85
|
end
|
86
|
+
|
87
|
+
shared_examples_for 'an inclusion function, when --tasks is on,' do |function|
|
88
|
+
it "is not available when --tasks is on" do
|
89
|
+
Puppet[:tasks] = true
|
90
|
+
expect do
|
91
|
+
catalog = compile_to_catalog(<<-MANIFEST)
|
92
|
+
#{function}(bar)
|
93
|
+
MANIFEST
|
94
|
+
end.to raise_error(Puppet::ParseError, /is only available when compiling a catalog/)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
@@ -52,7 +52,7 @@ describe 'the step method' do
|
|
52
52
|
compile_to_catalog(<<-MANIFEST)
|
53
53
|
[1].step(0) |$x| { }
|
54
54
|
MANIFEST
|
55
|
-
end.to raise_error(Puppet::Error, /'step' expects an Integer\[1
|
55
|
+
end.to raise_error(Puppet::Error, /'step' expects an Integer\[1\] value, got Integer\[0, 0\]/)
|
56
56
|
end
|
57
57
|
|
58
58
|
it 'raises an error when step is not an integer' do
|
@@ -56,7 +56,7 @@ describe 'the 4x function api' do
|
|
56
56
|
it 'refuses to create functions that are not based on the Function class' do
|
57
57
|
expect do
|
58
58
|
Puppet::Functions.create_function('testing', Object) {}
|
59
|
-
end.to raise_error(ArgumentError, 'Functions must be based on Puppet::Pops::Functions::Function. Got Object
|
59
|
+
end.to raise_error(ArgumentError, /function 'testing'.*Functions must be based on Puppet::Pops::Functions::Function. Got Object/)
|
60
60
|
end
|
61
61
|
|
62
62
|
it 'refuses to create functions with parameters that are not named with a symbol' do
|
@@ -212,15 +212,18 @@ describe 'the 4x function api' do
|
|
212
212
|
end
|
213
213
|
|
214
214
|
it 'a function can not be created with parameters declared after a repeated parameter' do
|
215
|
-
expect { create_function_with_param_after_repeated }.to raise_error(ArgumentError,
|
215
|
+
expect { create_function_with_param_after_repeated }.to raise_error(ArgumentError,
|
216
|
+
/function 't1'.*Parameters cannot be added after a repeated parameter/)
|
216
217
|
end
|
217
218
|
|
218
219
|
it 'a function can not be created with required parameters declared after optional ones' do
|
219
|
-
expect { create_function_with_rq_after_opt }.to raise_error(ArgumentError,
|
220
|
+
expect { create_function_with_rq_after_opt }.to raise_error(ArgumentError,
|
221
|
+
/function 't1'.*A required parameter cannot be added after an optional parameter/)
|
220
222
|
end
|
221
223
|
|
222
224
|
it 'a function can not be created with required repeated parameters declared after optional ones' do
|
223
|
-
expect { create_function_with_rq_repeated_after_opt }.to raise_error(ArgumentError,
|
225
|
+
expect { create_function_with_rq_repeated_after_opt }.to raise_error(ArgumentError,
|
226
|
+
/function 't1'.*A required repeated parameter cannot be added after an optional parameter/)
|
224
227
|
end
|
225
228
|
|
226
229
|
it 'an error is raised with reference to multiple methods when called with mis-matched arguments' do
|
@@ -467,6 +470,48 @@ describe 'the 4x function api' do
|
|
467
470
|
end
|
468
471
|
end
|
469
472
|
|
473
|
+
context 'reports meaningful errors' do
|
474
|
+
let(:parser) { Puppet::Pops::Parser::EvaluatingParser.new }
|
475
|
+
|
476
|
+
it 'syntax error in local type is reported with puppet source, puppet location, and ruby file containing function' do
|
477
|
+
the_loader = loader()
|
478
|
+
here = get_binding(the_loader)
|
479
|
+
expect do
|
480
|
+
fc = eval(<<-CODE, here)
|
481
|
+
Puppet::Functions.create_function('testing::test') do
|
482
|
+
local_types do
|
483
|
+
type 'MyType += Array[Integer]'
|
484
|
+
end
|
485
|
+
dispatch :test do
|
486
|
+
param 'MyType', :x
|
487
|
+
end
|
488
|
+
def test(x)
|
489
|
+
x
|
490
|
+
end
|
491
|
+
end
|
492
|
+
CODE
|
493
|
+
end.to raise_error(/MyType \+\= Array.*<Syntax error at '\+\=' \(line: 1, column: [0-9]+\)>.*functions4_spec\.rb.*/m)
|
494
|
+
# Note that raised error reports this spec file as the function source since the function is defined here
|
495
|
+
end
|
496
|
+
|
497
|
+
it 'syntax error in param type is reported with puppet source, puppet location, and ruby file containing function' do
|
498
|
+
the_loader = loader()
|
499
|
+
here = get_binding(the_loader)
|
500
|
+
expect do
|
501
|
+
fc = eval(<<-CODE, here)
|
502
|
+
Puppet::Functions.create_function('testing::test') do
|
503
|
+
dispatch :test do
|
504
|
+
param 'Array[1+=1]', :x
|
505
|
+
end
|
506
|
+
def test(x)
|
507
|
+
x
|
508
|
+
end
|
509
|
+
end
|
510
|
+
CODE
|
511
|
+
end.to raise_error(/Parsing of type string '"Array\[1\+=1\]"' failed with message: <Syntax error at '\]' \(line: 1, column: [0-9]+\)>/m)
|
512
|
+
end
|
513
|
+
|
514
|
+
end
|
470
515
|
context 'can use a loader when parsing types in function dispatch, and' do
|
471
516
|
let(:parser) { Puppet::Pops::Parser::EvaluatingParser.new }
|
472
517
|
|
@@ -226,12 +226,12 @@ describe Puppet::Resource::Catalog::Compiler do
|
|
226
226
|
it "errors if checksum_type contains no shared checksum types" do
|
227
227
|
Puppet::Node.indirection.stubs(:find).returns(node)
|
228
228
|
@request.options[:static_catalog] = true
|
229
|
-
@request.options[:checksum_type] = 'atime.
|
229
|
+
@request.options[:checksum_type] = 'atime.md2'
|
230
230
|
@request.options[:code_id] = 'some_code_id'
|
231
231
|
node.environment.stubs(:static_catalogs?).returns true
|
232
232
|
|
233
233
|
expect { compiler.find(@request) }.to raise_error Puppet::Error,
|
234
|
-
"Unable to find a common checksum type between agent 'atime.
|
234
|
+
"Unable to find a common checksum type between agent 'atime.md2' and master '[:sha256, :sha256lite, :md5, :md5lite, :sha1, :sha1lite, :sha512, :sha384, :sha224, :mtime, :ctime, :none]'."
|
235
235
|
end
|
236
236
|
|
237
237
|
it "errors if checksum_type contains no shared checksum types" do
|
@@ -242,7 +242,7 @@ describe Puppet::Resource::Catalog::Compiler do
|
|
242
242
|
node.environment.stubs(:static_catalogs?).returns true
|
243
243
|
|
244
244
|
expect { compiler.find(@request) }.to raise_error Puppet::Error,
|
245
|
-
"Unable to find a common checksum type between agent '' and master '[:sha256, :sha256lite, :md5, :md5lite, :sha1, :sha1lite, :mtime, :ctime, :none]'."
|
245
|
+
"Unable to find a common checksum type between agent '' and master '[:sha256, :sha256lite, :md5, :md5lite, :sha1, :sha1lite, :sha512, :sha384, :sha224, :mtime, :ctime, :none]'."
|
246
246
|
end
|
247
247
|
end
|
248
248
|
|
@@ -92,44 +92,59 @@ describe Puppet::FileBucketFile::File, :uses_checksums => true do
|
|
92
92
|
|
93
93
|
describe "when supplying a path" do
|
94
94
|
with_digest_algorithms do
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
95
|
+
it "should store the path if not already stored" do
|
96
|
+
if Puppet::Util::Platform.windows? && (['sha512', 'sha384'].include? digest_algorithm)
|
97
|
+
skip "PUP-8257: Skip file bucket test on windows for #{digest_algorithm} due to long path names"
|
98
|
+
else
|
99
|
+
checksum = save_bucket_file(plaintext, "/foo/bar")
|
100
|
+
|
101
|
+
dir_path = "#{Puppet[:bucketdir]}/#{bucket_dir}"
|
102
|
+
contents_file = "#{dir_path}/contents"
|
103
|
+
paths_file = "#{dir_path}/paths"
|
104
|
+
expect(Puppet::FileSystem.binread(contents_file)).to eq(plaintext)
|
105
|
+
expect(Puppet::FileSystem.read(paths_file)).to eq("foo/bar\n")
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should leave the paths file alone if the path is already stored" do
|
110
|
+
if Puppet::Util::Platform.windows? && (['sha512', 'sha384'].include? digest_algorithm)
|
111
|
+
skip "PUP-8257: Skip file bucket test on windows for #{digest_algorithm} due to long path names"
|
112
|
+
else
|
113
|
+
checksum = save_bucket_file(plaintext, "/foo/bar")
|
114
|
+
checksum = save_bucket_file(plaintext, "/foo/bar")
|
115
|
+
dir_path = "#{Puppet[:bucketdir]}/#{bucket_dir}"
|
116
|
+
expect(Puppet::FileSystem.binread("#{dir_path}/contents")).to eq(plaintext)
|
117
|
+
expect(File.read("#{dir_path}/paths")).to eq("foo/bar\n")
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
it "should store an additional path if the new path differs from those already stored" do
|
122
|
+
if Puppet::Util::Platform.windows? && (['sha512', 'sha384'].include? digest_algorithm)
|
123
|
+
skip "PUP-8257: Skip file bucket test on windows for #{digest_algorithm} due to long path names"
|
124
|
+
else
|
125
|
+
checksum = save_bucket_file(plaintext, "/foo/bar")
|
126
|
+
checksum = save_bucket_file(plaintext, "/foo/baz")
|
127
|
+
dir_path = "#{Puppet[:bucketdir]}/#{bucket_dir}"
|
128
|
+
expect(Puppet::FileSystem.binread("#{dir_path}/contents")).to eq(plaintext)
|
129
|
+
expect(File.read("#{dir_path}/paths")).to eq("foo/bar\nfoo/baz\n")
|
130
|
+
end
|
131
|
+
end
|
132
|
+
# end
|
122
133
|
end
|
123
134
|
end
|
124
135
|
|
125
136
|
describe "when not supplying a path" do
|
126
137
|
with_digest_algorithms do
|
127
138
|
it "should save the file and create an empty paths file" do
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
139
|
+
if Puppet::Util::Platform.windows? && (['sha512', 'sha384'].include? digest_algorithm)
|
140
|
+
skip "PUP-8257: Skip file bucket test on windows for #{digest_algorithm} due to long path names"
|
141
|
+
else
|
142
|
+
checksum = save_bucket_file(plaintext, "")
|
143
|
+
|
144
|
+
dir_path = "#{Puppet[:bucketdir]}/#{bucket_dir}"
|
145
|
+
expect(Puppet::FileSystem.binread("#{dir_path}/contents")).to eq(plaintext)
|
146
|
+
expect(File.read("#{dir_path}/paths")).to eq("")
|
147
|
+
end
|
133
148
|
end
|
134
149
|
end
|
135
150
|
end
|
@@ -157,37 +172,45 @@ describe Puppet::FileBucketFile::File, :uses_checksums => true do
|
|
157
172
|
end
|
158
173
|
|
159
174
|
it "should return the list of bucketed files in a human readable way" do
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
175
|
+
if Puppet::Util::Platform.windows? && (['sha512', 'sha384'].include? digest_algorithm)
|
176
|
+
skip "PUP-8257: Skip file bucket test on windows for #{digest_algorithm} due to long path names"
|
177
|
+
else
|
178
|
+
checksum1 = save_bucket_file("I'm the contents of a file", '/foo/bar1')
|
179
|
+
checksum2 = save_bucket_file("I'm the contents of another file", '/foo/bar2')
|
180
|
+
checksum3 = save_bucket_file("I'm the modified content of a existing file", '/foo/bar1')
|
181
|
+
|
182
|
+
# Use the first checksum as we know it's stored in the bucket
|
183
|
+
find_result = Puppet::FileBucket::File.indirection.find("#{digest_algorithm}/#{checksum1}/foo/bar1", :list_all => true)
|
184
|
+
|
185
|
+
# The list is sort order from date and file name, so first and third checksums come before the second
|
186
|
+
date_pattern = '\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}'
|
187
|
+
expect(find_result.to_s).to match(Regexp.new("^(#{checksum1}|#{checksum3}) #{date_pattern} foo/bar1\\n(#{checksum3}|#{checksum1}) #{date_pattern} foo/bar1\\n#{checksum2} #{date_pattern} foo/bar2\\n$"))
|
188
|
+
end
|
170
189
|
end
|
171
190
|
|
172
191
|
it "should fail in an informative way when provided dates are not in the right format" do
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
192
|
+
if Puppet::Util::Platform.windows? && (['sha512', 'sha384'].include? digest_algorithm)
|
193
|
+
skip "PUP-8257: Skip file bucket test on windows for #{digest_algorithm} due to long path names"
|
194
|
+
else
|
195
|
+
contents = "I'm the contents of a file"
|
196
|
+
save_bucket_file(contents, '/foo/bar1')
|
197
|
+
expect {
|
198
|
+
Puppet::FileBucket::File.indirection.find(
|
199
|
+
"#{digest_algorithm}/#{not_bucketed_checksum}/foo/bar",
|
200
|
+
:list_all => true,
|
201
|
+
:todate => "0:0:0 1-1-1970",
|
202
|
+
:fromdate => "WEIRD"
|
203
|
+
)
|
204
|
+
}.to raise_error(Puppet::Error, /fromdate/)
|
205
|
+
expect {
|
206
|
+
Puppet::FileBucket::File.indirection.find(
|
207
|
+
"#{digest_algorithm}/#{not_bucketed_checksum}/foo/bar",
|
208
|
+
:list_all => true,
|
209
|
+
:todate => "WEIRD",
|
210
|
+
:fromdate => Time.now
|
211
|
+
)
|
212
|
+
}.to raise_error(Puppet::Error, /todate/)
|
213
|
+
end
|
191
214
|
end
|
192
215
|
end
|
193
216
|
|
@@ -198,21 +221,30 @@ describe Puppet::FileBucketFile::File, :uses_checksums => true do
|
|
198
221
|
end
|
199
222
|
|
200
223
|
it "should return false/nil if the file is bucketed but with a different path" do
|
201
|
-
checksum = save_bucket_file("I'm the contents of a file", '/foo/bar')
|
202
224
|
|
203
|
-
|
204
|
-
|
225
|
+
if Puppet::Util::Platform.windows? && (['sha512', 'sha384'].include? digest_algorithm)
|
226
|
+
skip "PUP-8257: Skip file bucket test on windows for #{digest_algorithm} due to long path names"
|
227
|
+
else
|
228
|
+
checksum = save_bucket_file("I'm the contents of a file", '/foo/bar')
|
229
|
+
|
230
|
+
expect(Puppet::FileBucket::File.indirection.head("#{digest_algorithm}/#{checksum}/foo/baz")).to eq(false)
|
231
|
+
expect(Puppet::FileBucket::File.indirection.find("#{digest_algorithm}/#{checksum}/foo/baz")).to eq(nil)
|
232
|
+
end
|
205
233
|
end
|
206
234
|
|
207
235
|
it "should return true/file if the file is already bucketed with the given path" do
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
236
|
+
if Puppet::Util::Platform.windows? && (['sha512', 'sha384'].include? digest_algorithm)
|
237
|
+
skip "PUP-8257: Skip file bucket test on windows for #{digest_algorithm} due to long path names"
|
238
|
+
else
|
239
|
+
contents = "I'm the contents of a file"
|
240
|
+
|
241
|
+
checksum = save_bucket_file(contents, '/foo/bar')
|
242
|
+
|
243
|
+
expect(Puppet::FileBucket::File.indirection.head("#{digest_algorithm}/#{checksum}/foo/bar")).to eq(true)
|
244
|
+
find_result = Puppet::FileBucket::File.indirection.find("#{digest_algorithm}/#{checksum}/foo/bar")
|
245
|
+
expect(find_result.checksum).to eq("{#{digest_algorithm}}#{checksum}")
|
246
|
+
expect(find_result.to_s).to eq(contents)
|
247
|
+
end
|
216
248
|
end
|
217
249
|
end
|
218
250
|
|
@@ -227,16 +259,21 @@ describe Puppet::FileBucketFile::File, :uses_checksums => true do
|
|
227
259
|
end
|
228
260
|
|
229
261
|
it "should return true/file if the file is already bucketed" do
|
262
|
+
|
230
263
|
# this one replaces most of the lets in the "when
|
231
264
|
# digest_digest_algorithm is set..." shared context, but it still needs digest_algorithm
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
265
|
+
if Puppet::Util::Platform.windows? && (['sha512', 'sha384'].include? digest_algorithm)
|
266
|
+
skip "PUP-8257: Skip file bucket test on windows for #{digest_algorithm} due to long path names"
|
267
|
+
else
|
268
|
+
contents = "I'm the contents of a file"
|
269
|
+
|
270
|
+
checksum = save_bucket_file(contents, '/foo/bar')
|
271
|
+
|
272
|
+
expect(Puppet::FileBucket::File.indirection.head("#{digest_algorithm}/#{checksum}#{trailing_string}")).to eq(true)
|
273
|
+
find_result = Puppet::FileBucket::File.indirection.find("#{digest_algorithm}/#{checksum}#{trailing_string}")
|
274
|
+
expect(find_result.checksum).to eq("{#{digest_algorithm}}#{checksum}")
|
275
|
+
expect(find_result.to_s).to eq(contents)
|
276
|
+
end
|
240
277
|
end
|
241
278
|
end
|
242
279
|
end
|
@@ -250,30 +287,46 @@ describe Puppet::FileBucketFile::File, :uses_checksums => true do
|
|
250
287
|
let(:not_bucketed_checksum) { digest(not_bucketed_plaintext) }
|
251
288
|
|
252
289
|
it "should generate an empty string if there is no diff" do
|
253
|
-
|
254
|
-
|
290
|
+
if Puppet::Util::Platform.windows? && (['sha512', 'sha384'].include? digest_algorithm)
|
291
|
+
skip "PUP-8257: Skip file bucket test on windows for #{digest_algorithm} due to long path names"
|
292
|
+
else
|
293
|
+
checksum = save_bucket_file("I'm the contents of a file")
|
294
|
+
expect(Puppet::FileBucket::File.indirection.find("#{digest_algorithm}/#{checksum}", :diff_with => checksum)).to eq('')
|
295
|
+
end
|
255
296
|
end
|
256
297
|
|
257
298
|
it "should generate a proper diff if there is a diff" do
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
299
|
+
if Puppet::Util::Platform.windows? && (['sha512', 'sha384'].include? digest_algorithm)
|
300
|
+
skip "PUP-8257: Skip file bucket test on windows for #{digest_algorithm} due to long path names"
|
301
|
+
else
|
302
|
+
checksum1 = save_bucket_file("foo\nbar\nbaz")
|
303
|
+
checksum2 = save_bucket_file("foo\nbiz\nbaz")
|
304
|
+
|
305
|
+
diff = Puppet::FileBucket::File.indirection.find("#{digest_algorithm}/#{checksum1}", :diff_with => checksum2)
|
306
|
+
expect(diff).to include("-bar\n+biz\n")
|
307
|
+
end
|
263
308
|
end
|
264
309
|
|
265
310
|
it "should raise an exception if the hash to diff against isn't found" do
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
311
|
+
if Puppet::Util::Platform.windows? && (['sha512', 'sha384'].include? digest_algorithm)
|
312
|
+
skip "PUP-8257: Skip file bucket test on windows for #{digest_algorithm} due to long path names"
|
313
|
+
else
|
314
|
+
checksum = save_bucket_file("whatever")
|
315
|
+
|
316
|
+
expect do
|
317
|
+
Puppet::FileBucket::File.indirection.find("#{digest_algorithm}/#{checksum}", :diff_with => not_bucketed_checksum)
|
318
|
+
end.to raise_error "could not find diff_with #{not_bucketed_checksum}"
|
319
|
+
end
|
271
320
|
end
|
272
321
|
|
273
322
|
it "should return nil if the hash to diff from isn't found" do
|
274
|
-
|
275
|
-
|
276
|
-
|
323
|
+
if Puppet::Util::Platform.windows? && (['sha512', 'sha384'].include? digest_algorithm)
|
324
|
+
skip "PUP-8257: Skip file bucket test on windows for #{digest_algorithm} due to long path names"
|
325
|
+
else
|
326
|
+
checksum = save_bucket_file("whatever")
|
327
|
+
|
328
|
+
expect(Puppet::FileBucket::File.indirection.find("#{digest_algorithm}/#{not_bucketed_checksum}", :diff_with => checksum)).to eq(nil)
|
329
|
+
end
|
277
330
|
end
|
278
331
|
end
|
279
332
|
end
|
@@ -343,6 +396,7 @@ describe Puppet::FileBucketFile::File, :uses_checksums => true do
|
|
343
396
|
|
344
397
|
describe "when saving files" do
|
345
398
|
it "should save the contents to the calculated path" do
|
399
|
+
skip("Windows Long File Name support is incomplete PUP-8257, this doesn't fail reliably so it should be skipped.") if Puppet::Util::Platform.windows? && (['sha512', 'sha384'].include? digest_algorithm)
|
346
400
|
options = {}
|
347
401
|
if override_bucket_path
|
348
402
|
options[:bucket_path] = @bucket_top_dir
|