puppet 5.3.7-x64-mingw32 → 5.4.0-x64-mingw32
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 +220 -182
- 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,11 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'puppet_spec/files'
|
4
|
+
|
5
|
+
require_relative('puppet_pal_2pec') unless RUBY_VERSION == '1.9.3'
|
6
|
+
|
7
|
+
#describe 'Puppet Pal' do
|
8
|
+
# pending("Puppet::Pal is not available on Ruby 1.9.3") if RUBY_VERSION == '1.9.3'
|
9
|
+
## before { skip("Puppet::Pal is not available on Ruby 1.9.3") if RUBY_VERSION == '1.9.3' }
|
10
|
+
# require_relative 'puppet_pal_2pec'
|
11
|
+
#end
|
@@ -44,7 +44,7 @@ describe Puppet::Settings::IniFile do
|
|
44
44
|
expect(config_fh.string).to eq "[the_section]\n#{mixed_utf8} = #{mixed_utf8.reverse}\n"
|
45
45
|
end
|
46
46
|
|
47
|
-
it "
|
47
|
+
it "adds a [main] section to a file when it's needed" do
|
48
48
|
config_fh = a_config_file_containing(<<-CONF)
|
49
49
|
[section]
|
50
50
|
name = different value
|
@@ -56,6 +56,7 @@ describe Puppet::Settings::IniFile do
|
|
56
56
|
end
|
57
57
|
|
58
58
|
expect(config_fh.string).to eq(<<-CONF)
|
59
|
+
[main]
|
59
60
|
name = value
|
60
61
|
[section]
|
61
62
|
name = different value
|
@@ -108,6 +109,46 @@ name = value
|
|
108
109
|
CONFIG
|
109
110
|
end
|
110
111
|
|
112
|
+
it "updates existing empty settings" do
|
113
|
+
config_fh = a_config_file_containing(<<-CONFIG)
|
114
|
+
# this is the preceding comment
|
115
|
+
[section]
|
116
|
+
name =
|
117
|
+
# this is the trailing comment
|
118
|
+
CONFIG
|
119
|
+
|
120
|
+
Puppet::Settings::IniFile.update(config_fh) do |config|
|
121
|
+
config.set("section", "name", "changed value")
|
122
|
+
end
|
123
|
+
|
124
|
+
expect(config_fh.string).to eq <<-CONFIG
|
125
|
+
# this is the preceding comment
|
126
|
+
[section]
|
127
|
+
name = changed value
|
128
|
+
# this is the trailing comment
|
129
|
+
CONFIG
|
130
|
+
end
|
131
|
+
|
132
|
+
it "can set empty settings" do
|
133
|
+
config_fh = a_config_file_containing(<<-CONFIG)
|
134
|
+
# this is the preceding comment
|
135
|
+
[section]
|
136
|
+
name = original value
|
137
|
+
# this is the trailing comment
|
138
|
+
CONFIG
|
139
|
+
|
140
|
+
Puppet::Settings::IniFile.update(config_fh) do |config|
|
141
|
+
config.set("section", "name", "")
|
142
|
+
end
|
143
|
+
|
144
|
+
expect(config_fh.string).to eq <<-CONFIG
|
145
|
+
# this is the preceding comment
|
146
|
+
[section]
|
147
|
+
name =
|
148
|
+
# this is the trailing comment
|
149
|
+
CONFIG
|
150
|
+
end
|
151
|
+
|
111
152
|
it "updates existing UTF-8 name / values in place" do
|
112
153
|
config_fh = a_config_file_containing(<<-CONFIG)
|
113
154
|
# this is the preceding comment
|
@@ -151,7 +192,7 @@ name = value
|
|
151
192
|
CONFIG
|
152
193
|
end
|
153
194
|
|
154
|
-
it "considers settings outside a section to be in section 'main'" do
|
195
|
+
it "considers settings found outside a section to be in section 'main'" do
|
155
196
|
config_fh = a_config_file_containing(<<-CONFIG)
|
156
197
|
name = original value
|
157
198
|
CONFIG
|
@@ -161,6 +202,7 @@ name = value
|
|
161
202
|
end
|
162
203
|
|
163
204
|
expect(config_fh.string).to eq <<-CONFIG
|
205
|
+
[main]
|
164
206
|
name = changed value
|
165
207
|
CONFIG
|
166
208
|
end
|
@@ -234,6 +276,275 @@ updated = new
|
|
234
276
|
CONFIG
|
235
277
|
end
|
236
278
|
|
279
|
+
it "adds a new setting to the appropriate section, when it would be added behind a setting with an identical value in a preceeding section" do
|
280
|
+
config_fh = a_config_file_containing(<<-CONFIG)
|
281
|
+
[different]
|
282
|
+
name = some value
|
283
|
+
[section]
|
284
|
+
name = some value
|
285
|
+
CONFIG
|
286
|
+
|
287
|
+
Puppet::Settings::IniFile.update(config_fh) do |config|
|
288
|
+
config.set("section", "new", "new value")
|
289
|
+
end
|
290
|
+
|
291
|
+
expect(config_fh.string).to eq <<-CONFIG
|
292
|
+
[different]
|
293
|
+
name = some value
|
294
|
+
[section]
|
295
|
+
name = some value
|
296
|
+
new = new value
|
297
|
+
CONFIG
|
298
|
+
end
|
299
|
+
|
300
|
+
context 'config with no main section' do
|
301
|
+
it 'file does not change when there are no sections or entries' do
|
302
|
+
config_fh = a_config_file_containing(<<-CONFIG)
|
303
|
+
CONFIG
|
304
|
+
|
305
|
+
Puppet::Settings::IniFile.update(config_fh) do |config|
|
306
|
+
config.delete('main', 'missing')
|
307
|
+
end
|
308
|
+
|
309
|
+
expect(config_fh.string).to eq <<-CONFIG
|
310
|
+
CONFIG
|
311
|
+
end
|
312
|
+
|
313
|
+
it 'when there is only 1 entry we can delete it' do
|
314
|
+
config_fh = a_config_file_containing(<<-CONFIG)
|
315
|
+
base = value
|
316
|
+
CONFIG
|
317
|
+
|
318
|
+
Puppet::Settings::IniFile.update(config_fh) do |config|
|
319
|
+
config.delete('main', 'base')
|
320
|
+
end
|
321
|
+
|
322
|
+
expect(config_fh.string).to eq <<-CONFIG
|
323
|
+
CONFIG
|
324
|
+
end
|
325
|
+
|
326
|
+
it 'we delete 1 entry from the default section and add the [main] section header' do
|
327
|
+
config_fh = a_config_file_containing(<<-CONFIG)
|
328
|
+
base = value
|
329
|
+
other = another value
|
330
|
+
CONFIG
|
331
|
+
|
332
|
+
Puppet::Settings::IniFile.update(config_fh) do |config|
|
333
|
+
config.delete('main', 'base')
|
334
|
+
end
|
335
|
+
|
336
|
+
expect(config_fh.string).to eq <<-CONFIG
|
337
|
+
[main]
|
338
|
+
other = another value
|
339
|
+
CONFIG
|
340
|
+
end
|
341
|
+
|
342
|
+
it 'we add [main] to the config file when attempting to delete a setting in another section' do
|
343
|
+
config_fh = a_config_file_containing(<<-CONF)
|
344
|
+
name = different value
|
345
|
+
CONF
|
346
|
+
|
347
|
+
Puppet::Settings::IniFile.update(config_fh) do |config|
|
348
|
+
config.delete('section', 'name')
|
349
|
+
end
|
350
|
+
|
351
|
+
expect(config_fh.string).to eq(<<-CONF)
|
352
|
+
[main]
|
353
|
+
name = different value
|
354
|
+
CONF
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
358
|
+
context 'config with 1 section' do
|
359
|
+
it 'file does not change when entry to delete does not exist' do
|
360
|
+
config_fh = a_config_file_containing(<<-CONFIG)
|
361
|
+
[main]
|
362
|
+
base = value
|
363
|
+
CONFIG
|
364
|
+
|
365
|
+
Puppet::Settings::IniFile.update(config_fh) do |config|
|
366
|
+
config.delete('main', 'missing')
|
367
|
+
end
|
368
|
+
|
369
|
+
expect(config_fh.string).to eq <<-CONFIG
|
370
|
+
[main]
|
371
|
+
base = value
|
372
|
+
CONFIG
|
373
|
+
end
|
374
|
+
|
375
|
+
it 'deletes the 1 entry in the section' do
|
376
|
+
config_fh = a_config_file_containing(<<-CONFIG)
|
377
|
+
[main]
|
378
|
+
base = DELETING
|
379
|
+
CONFIG
|
380
|
+
|
381
|
+
Puppet::Settings::IniFile.update(config_fh) do |config|
|
382
|
+
config.delete('main', 'base')
|
383
|
+
end
|
384
|
+
|
385
|
+
expect(config_fh.string).to eq <<-CONFIG
|
386
|
+
[main]
|
387
|
+
CONFIG
|
388
|
+
end
|
389
|
+
|
390
|
+
it 'deletes the entry and leaves another entry' do
|
391
|
+
config_fh = a_config_file_containing(<<-CONFIG)
|
392
|
+
[main]
|
393
|
+
base = DELETING
|
394
|
+
after = value to keep
|
395
|
+
CONFIG
|
396
|
+
|
397
|
+
Puppet::Settings::IniFile.update(config_fh) do |config|
|
398
|
+
config.delete('main', 'base')
|
399
|
+
end
|
400
|
+
|
401
|
+
expect(config_fh.string).to eq <<-CONFIG
|
402
|
+
[main]
|
403
|
+
after = value to keep
|
404
|
+
CONFIG
|
405
|
+
end
|
406
|
+
|
407
|
+
it 'deletes the entry while leaving other entries' do
|
408
|
+
config_fh = a_config_file_containing(<<-CONFIG)
|
409
|
+
[main]
|
410
|
+
before = value to keep before
|
411
|
+
base = DELETING
|
412
|
+
after = value to keep
|
413
|
+
CONFIG
|
414
|
+
|
415
|
+
Puppet::Settings::IniFile.update(config_fh) do |config|
|
416
|
+
config.delete('main', 'base')
|
417
|
+
end
|
418
|
+
|
419
|
+
expect(config_fh.string).to eq <<-CONFIG
|
420
|
+
[main]
|
421
|
+
before = value to keep before
|
422
|
+
after = value to keep
|
423
|
+
CONFIG
|
424
|
+
end
|
425
|
+
|
426
|
+
it 'when there are two entries of the same setting name delete one of them' do
|
427
|
+
config_fh = a_config_file_containing(<<-CONFIG)
|
428
|
+
[main]
|
429
|
+
base = value
|
430
|
+
base = value
|
431
|
+
CONFIG
|
432
|
+
|
433
|
+
Puppet::Settings::IniFile.update(config_fh) do |config|
|
434
|
+
config.delete('main', 'base')
|
435
|
+
end
|
436
|
+
|
437
|
+
expect(config_fh.string).to eq <<-CONFIG
|
438
|
+
[main]
|
439
|
+
base = value
|
440
|
+
CONFIG
|
441
|
+
end
|
442
|
+
end
|
443
|
+
|
444
|
+
context 'with 2 sections' do
|
445
|
+
it 'file does not change when entry to delete does not exist' do
|
446
|
+
config_fh = a_config_file_containing(<<-CONFIG)
|
447
|
+
[main]
|
448
|
+
base = value
|
449
|
+
[section]
|
450
|
+
CONFIG
|
451
|
+
|
452
|
+
Puppet::Settings::IniFile.update(config_fh) do |config|
|
453
|
+
config.delete('section', 'missing')
|
454
|
+
end
|
455
|
+
|
456
|
+
expect(config_fh.string).to eq <<-CONFIG
|
457
|
+
[main]
|
458
|
+
base = value
|
459
|
+
[section]
|
460
|
+
CONFIG
|
461
|
+
end
|
462
|
+
|
463
|
+
it 'deletes the 1 entry in the specified section' do
|
464
|
+
config_fh = a_config_file_containing(<<-CONFIG)
|
465
|
+
[main]
|
466
|
+
base = value
|
467
|
+
[section]
|
468
|
+
base = value
|
469
|
+
CONFIG
|
470
|
+
|
471
|
+
Puppet::Settings::IniFile.update(config_fh) do |config|
|
472
|
+
config.delete('section', 'base')
|
473
|
+
end
|
474
|
+
|
475
|
+
expect(config_fh.string).to eq <<-CONFIG
|
476
|
+
[main]
|
477
|
+
base = value
|
478
|
+
[section]
|
479
|
+
CONFIG
|
480
|
+
end
|
481
|
+
|
482
|
+
it 'deletes the entry while leaving other entries' do
|
483
|
+
config_fh = a_config_file_containing(<<-CONFIG)
|
484
|
+
[main]
|
485
|
+
before = value also staying
|
486
|
+
base = value staying
|
487
|
+
after = value to keep
|
488
|
+
[section]
|
489
|
+
before value in section keeping
|
490
|
+
base = DELETING
|
491
|
+
after = value to keep
|
492
|
+
CONFIG
|
493
|
+
|
494
|
+
Puppet::Settings::IniFile.update(config_fh) do |config|
|
495
|
+
config.delete('section', 'base')
|
496
|
+
end
|
497
|
+
|
498
|
+
expect(config_fh.string).to eq <<-CONFIG
|
499
|
+
[main]
|
500
|
+
before = value also staying
|
501
|
+
base = value staying
|
502
|
+
after = value to keep
|
503
|
+
[section]
|
504
|
+
before value in section keeping
|
505
|
+
after = value to keep
|
506
|
+
CONFIG
|
507
|
+
end
|
508
|
+
end
|
509
|
+
|
510
|
+
context 'with 2 sections' do
|
511
|
+
it 'deletes the entry while leaving other entries' do
|
512
|
+
config_fh = a_config_file_containing(<<-CONFIG)
|
513
|
+
[main]
|
514
|
+
before = value also staying
|
515
|
+
base = value staying
|
516
|
+
after = value to keep
|
517
|
+
[section]
|
518
|
+
before value in section keeping
|
519
|
+
base = DELETING
|
520
|
+
after = value to keep
|
521
|
+
[otherSection]
|
522
|
+
before value in section keeping
|
523
|
+
base = value to keep really
|
524
|
+
after = value to keep
|
525
|
+
CONFIG
|
526
|
+
|
527
|
+
Puppet::Settings::IniFile.update(config_fh) do |config|
|
528
|
+
config.delete('section', 'base')
|
529
|
+
end
|
530
|
+
|
531
|
+
expect(config_fh.string).to eq <<-CONFIG
|
532
|
+
[main]
|
533
|
+
before = value also staying
|
534
|
+
base = value staying
|
535
|
+
after = value to keep
|
536
|
+
[section]
|
537
|
+
before value in section keeping
|
538
|
+
after = value to keep
|
539
|
+
[otherSection]
|
540
|
+
before value in section keeping
|
541
|
+
base = value to keep really
|
542
|
+
after = value to keep
|
543
|
+
CONFIG
|
544
|
+
end
|
545
|
+
end
|
546
|
+
|
547
|
+
|
237
548
|
def a_config_file_containing(text)
|
238
549
|
# set_encoding required for Ruby 1.9.3 as ASCII is the default
|
239
550
|
StringIO.new(text).set_encoding(Encoding::UTF_8)
|
@@ -335,10 +335,51 @@ describe Puppet::SSL::CertificateRequest do
|
|
335
335
|
expect(csr.verify(key.content)).to be_truthy
|
336
336
|
end
|
337
337
|
|
338
|
-
|
338
|
+
# Attempts to use SHA512 and SHA384 for signing certificates don't seem to work
|
339
|
+
# So commenting it out till it is sorted out
|
340
|
+
# The problem seems to be with the ability to sign a CSR when using either of
|
341
|
+
# these hash algorithms
|
342
|
+
|
343
|
+
# it "should use SHA512 to sign the csr when SHA256 and SHA1 aren't available" do
|
344
|
+
# csr = OpenSSL::X509::Request.new
|
345
|
+
# OpenSSL::Digest.expects(:const_defined?).with("SHA256").returns(false)
|
346
|
+
# OpenSSL::Digest.expects(:const_defined?).with("SHA1").returns(false)
|
347
|
+
# OpenSSL::Digest.expects(:const_defined?).with("SHA512").returns(true)
|
348
|
+
# signer = Puppet::SSL::CertificateSigner.new
|
349
|
+
# signer.sign(csr, key.content)
|
350
|
+
# expect(csr.verify(key.content)).to be_truthy
|
351
|
+
# end
|
352
|
+
|
353
|
+
# it "should use SHA384 to sign the csr when SHA256/SHA1/SHA512 aren't available" do
|
354
|
+
# csr = OpenSSL::X509::Request.new
|
355
|
+
# OpenSSL::Digest.expects(:const_defined?).with("SHA256").returns(false)
|
356
|
+
# OpenSSL::Digest.expects(:const_defined?).with("SHA1").returns(false)
|
357
|
+
# OpenSSL::Digest.expects(:const_defined?).with("SHA512").returns(false)
|
358
|
+
# OpenSSL::Digest.expects(:const_defined?).with("SHA384").returns(true)
|
359
|
+
# signer = Puppet::SSL::CertificateSigner.new
|
360
|
+
# signer.sign(csr, key.content)
|
361
|
+
# expect(csr.verify(key.content)).to be_truthy
|
362
|
+
# end
|
363
|
+
|
364
|
+
it "should use SHA224 to sign the csr when SHA256/SHA1/SHA512/SHA384 aren't available" do
|
339
365
|
csr = OpenSSL::X509::Request.new
|
340
366
|
OpenSSL::Digest.expects(:const_defined?).with("SHA256").returns(false)
|
341
367
|
OpenSSL::Digest.expects(:const_defined?).with("SHA1").returns(false)
|
368
|
+
OpenSSL::Digest.expects(:const_defined?).with("SHA512").returns(false)
|
369
|
+
OpenSSL::Digest.expects(:const_defined?).with("SHA384").returns(false)
|
370
|
+
OpenSSL::Digest.expects(:const_defined?).with("SHA224").returns(true)
|
371
|
+
signer = Puppet::SSL::CertificateSigner.new
|
372
|
+
signer.sign(csr, key.content)
|
373
|
+
expect(csr.verify(key.content)).to be_truthy
|
374
|
+
end
|
375
|
+
|
376
|
+
it "should raise an error if neither SHA256/SHA1/SHA512/SHA384/SHA224 are available" do
|
377
|
+
csr = OpenSSL::X509::Request.new
|
378
|
+
OpenSSL::Digest.expects(:const_defined?).with("SHA256").returns(false)
|
379
|
+
OpenSSL::Digest.expects(:const_defined?).with("SHA1").returns(false)
|
380
|
+
OpenSSL::Digest.expects(:const_defined?).with("SHA512").returns(false)
|
381
|
+
OpenSSL::Digest.expects(:const_defined?).with("SHA384").returns(false)
|
382
|
+
OpenSSL::Digest.expects(:const_defined?).with("SHA224").returns(false)
|
342
383
|
expect {
|
343
384
|
signer = Puppet::SSL::CertificateSigner.new
|
344
385
|
}.to raise_error(Puppet::Error)
|
@@ -156,7 +156,8 @@ describe Puppet::SSL::CertificateRevocationList do
|
|
156
156
|
end
|
157
157
|
|
158
158
|
it "should sign the CRL with the CA's private key and a digest instance" do
|
159
|
-
|
159
|
+
digest = Puppet::SSL::CertificateSigner.new.digest
|
160
|
+
@crl.content.expects(:sign).with { |key, signer| key == @key and signer.is_a?(digest) }
|
160
161
|
@crl.revoke(1, @key)
|
161
162
|
end
|
162
163
|
|
@@ -583,6 +583,7 @@ describe Puppet::Transaction::Report do
|
|
583
583
|
expect(tripped.report_format).to eq(report.report_format)
|
584
584
|
expect(tripped.puppet_version).to eq(report.puppet_version)
|
585
585
|
expect(tripped.status).to eq(report.status)
|
586
|
+
expect(tripped.transaction_completed).to eq(report.transaction_completed)
|
586
587
|
expect(tripped.environment).to eq(report.environment)
|
587
588
|
expect(tripped.corrective_change).to eq(report.corrective_change)
|
588
589
|
|
@@ -4,7 +4,6 @@ require 'matchers/include_in_order'
|
|
4
4
|
require 'puppet_spec/compiler'
|
5
5
|
|
6
6
|
require 'puppet/transaction'
|
7
|
-
require 'puppet/transaction/persistence'
|
8
7
|
require 'fileutils'
|
9
8
|
|
10
9
|
describe Puppet::Transaction do
|
@@ -132,31 +131,31 @@ describe Puppet::Transaction do
|
|
132
131
|
transaction.evaluate
|
133
132
|
end
|
134
133
|
end
|
134
|
+
end
|
135
135
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
136
|
+
describe "when evaluating a skipped resource for corrective change it" do
|
137
|
+
before :each do
|
138
|
+
# Enable persistence during tests
|
139
|
+
Puppet::Transaction::Persistence.any_instance.stubs(:enabled?).returns(true)
|
140
|
+
end
|
141
141
|
|
142
|
-
|
143
|
-
|
142
|
+
it "should persist in the transactionstore" do
|
143
|
+
Puppet[:transactionstorefile] = tmpfile('persistence_test')
|
144
144
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
145
|
+
resource = Puppet::Type.type(:notify).new :title => "foobar"
|
146
|
+
transaction = transaction_with_resource(resource)
|
147
|
+
transaction.evaluate
|
148
|
+
expect(transaction.resource_status(resource)).to be_changed
|
149
149
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
150
|
+
transaction = transaction_with_resource(resource)
|
151
|
+
transaction.expects(:skip?).with(resource).returns true
|
152
|
+
transaction.event_manager.expects(:process_events).with(resource).never
|
153
|
+
transaction.evaluate
|
154
|
+
expect(transaction.resource_status(resource)).to be_skipped
|
155
155
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
end
|
156
|
+
persistence = Puppet::Transaction::Persistence.new
|
157
|
+
persistence.load
|
158
|
+
expect(persistence.get_system_value(resource.ref, "message")).to eq(["foobar"])
|
160
159
|
end
|
161
160
|
end
|
162
161
|
|
@@ -591,6 +590,98 @@ describe Puppet::Transaction do
|
|
591
590
|
|
592
591
|
transaction.prefetch_if_necessary(resource)
|
593
592
|
end
|
593
|
+
|
594
|
+
it "should not prefetch a provider which has failed" do
|
595
|
+
transaction.prefetch_failed_providers[:sshkey][:parsed] = true
|
596
|
+
|
597
|
+
resource.provider.class.expects(:prefetch).never
|
598
|
+
|
599
|
+
transaction.prefetch_if_necessary(resource)
|
600
|
+
end
|
601
|
+
|
602
|
+
describe "and prefetching fails" do
|
603
|
+
before :each do
|
604
|
+
resource.provider.class.expects(:prefetch).raises(Puppet::Error, "message")
|
605
|
+
end
|
606
|
+
|
607
|
+
context "without future_features flag" do
|
608
|
+
before :each do
|
609
|
+
Puppet.settings[:future_features] = false
|
610
|
+
end
|
611
|
+
|
612
|
+
it "should not rescue prefetch executions" do
|
613
|
+
expect { transaction.prefetch_if_necessary(resource) }.to raise_error(Puppet::Error)
|
614
|
+
end
|
615
|
+
end
|
616
|
+
|
617
|
+
context "with future_features flag" do
|
618
|
+
before :each do
|
619
|
+
Puppet.settings[:future_features] = true
|
620
|
+
end
|
621
|
+
|
622
|
+
it "should rescue prefetch executions" do
|
623
|
+
transaction.prefetch_if_necessary(resource)
|
624
|
+
|
625
|
+
expect(transaction.prefetched_providers[:sshkey][:parsed]).to be_truthy
|
626
|
+
end
|
627
|
+
|
628
|
+
it "should mark resources as failed" do
|
629
|
+
transaction.evaluate
|
630
|
+
|
631
|
+
expect(transaction.resource_status(resource).failed?).to be_truthy
|
632
|
+
end
|
633
|
+
|
634
|
+
it "should mark a provider that has failed prefetch" do
|
635
|
+
transaction.prefetch_if_necessary(resource)
|
636
|
+
|
637
|
+
expect(transaction.prefetch_failed_providers[:sshkey][:parsed]).to be_truthy
|
638
|
+
end
|
639
|
+
|
640
|
+
describe "and new resources are generated" do
|
641
|
+
let(:generator) { Puppet::Type.type(:notify).new :title => "generator" }
|
642
|
+
let(:generated) do
|
643
|
+
%w[a b c].map { |name| Puppet::Type.type(:sshkey).new :title => "foo", :name => name, :type => :dsa, :key => "eh", :provider => :parsed }
|
644
|
+
end
|
645
|
+
|
646
|
+
before :each do
|
647
|
+
catalog.add_resource generator
|
648
|
+
generator.stubs(:generate).returns generated
|
649
|
+
catalog.stubs(:container_of).returns generator
|
650
|
+
end
|
651
|
+
|
652
|
+
it "should not evaluate resources with a failed provider, even if the prefetch is rescued" do
|
653
|
+
#Only the generator resource should be applied, all the other resources are failed, and skipped.
|
654
|
+
catalog.remove_resource resource2
|
655
|
+
transaction.expects(:apply).once
|
656
|
+
|
657
|
+
transaction.evaluate
|
658
|
+
end
|
659
|
+
|
660
|
+
it "should not fail other resources added after the failing resource" do
|
661
|
+
new_resource = Puppet::Type.type(:notify).new :name => "baz"
|
662
|
+
catalog.add_resource(new_resource)
|
663
|
+
|
664
|
+
transaction.evaluate
|
665
|
+
|
666
|
+
expect(transaction.resource_status(new_resource).failed?).to be_falsey
|
667
|
+
end
|
668
|
+
|
669
|
+
it "should fail other resources that require the failing resource" do
|
670
|
+
new_resource = Puppet::Type.type(:notify).new(:name => "baz", :require => resource)
|
671
|
+
catalog.add_resource(new_resource)
|
672
|
+
|
673
|
+
catalog.remove_resource resource2
|
674
|
+
transaction.expects(:apply).once
|
675
|
+
|
676
|
+
transaction.evaluate
|
677
|
+
|
678
|
+
expect(transaction.resource_status(resource).failed?).to be_truthy
|
679
|
+
expect(transaction.resource_status(new_resource).dependency_failed?).to be_truthy
|
680
|
+
expect(transaction.skip?(new_resource)).to be_truthy
|
681
|
+
end
|
682
|
+
end
|
683
|
+
end
|
684
|
+
end
|
594
685
|
end
|
595
686
|
|
596
687
|
describe "during teardown" do
|