puppet 5.3.7-x86-mingw32 → 5.4.0-x86-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
@@ -36,6 +36,18 @@ describe checksum do
|
|
36
36
|
expect(@checksum.sum("foobar")).to eq("{sha256}#{sum}")
|
37
37
|
end
|
38
38
|
|
39
|
+
it "when using digest_algorithm 'sha512' should return the summed contents with a checksum label" do
|
40
|
+
sum = Digest::SHA512.hexdigest("foobar")
|
41
|
+
@resource[:checksum] = :sha512
|
42
|
+
expect(@checksum.sum("foobar")).to eq("{sha512}#{sum}")
|
43
|
+
end
|
44
|
+
|
45
|
+
it "when using digest_algorithm 'sha384' should return the summed contents with a checksum label" do
|
46
|
+
sum = Digest::SHA384.hexdigest("foobar")
|
47
|
+
@resource[:checksum] = :sha384
|
48
|
+
expect(@checksum.sum("foobar")).to eq("{sha384}#{sum}")
|
49
|
+
end
|
50
|
+
|
39
51
|
it "should use :md5 as its default type" do
|
40
52
|
expect(@checksum.default).to eq(:md5)
|
41
53
|
end
|
@@ -82,4 +94,12 @@ describe checksum do
|
|
82
94
|
Puppet.settings[:supported_checksum_types] = values
|
83
95
|
expect(Puppet.settings[:supported_checksum_types]).to eq(values)
|
84
96
|
end
|
97
|
+
|
98
|
+
it 'rejects md5 checksums in FIPS mode' do
|
99
|
+
Puppet::Util::Platform.stubs(:fips_enabled?).returns true
|
100
|
+
expect {
|
101
|
+
@resource[:checksum] = :md5
|
102
|
+
}.to raise_error(Puppet::ResourceError,
|
103
|
+
/Parameter checksum failed.* MD5 is not supported in FIPS mode/)
|
104
|
+
end
|
85
105
|
end
|
data/spec/unit/type/file_spec.rb
CHANGED
@@ -1469,6 +1469,8 @@ describe Puppet::Type.type(:file) do
|
|
1469
1469
|
describe "when using source" do
|
1470
1470
|
before do
|
1471
1471
|
file[:source] = File.expand_path('/one')
|
1472
|
+
# Contents of an empty file generate the below hash values
|
1473
|
+
# in case you need to add support for additional algorithms in future
|
1472
1474
|
@checksum_values = {
|
1473
1475
|
:md5 => 'd41d8cd98f00b204e9800998ecf8427e',
|
1474
1476
|
:md5lite => 'd41d8cd98f00b204e9800998ecf8427e',
|
@@ -1476,6 +1478,9 @@ describe Puppet::Type.type(:file) do
|
|
1476
1478
|
:sha256lite => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
|
1477
1479
|
:sha1 => 'da39a3ee5e6b4b0d3255bfef95601890afd80709',
|
1478
1480
|
:sha1lite => 'da39a3ee5e6b4b0d3255bfef95601890afd80709',
|
1481
|
+
:sha224 => 'd14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f',
|
1482
|
+
:sha384 => '38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b',
|
1483
|
+
:sha512 => 'cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e',
|
1479
1484
|
:mtime => 'Jan 26 13:59:49 2016',
|
1480
1485
|
:ctime => 'Jan 26 13:59:49 2016'
|
1481
1486
|
}
|
@@ -1569,6 +1574,9 @@ describe Puppet::Type.type(:file) do
|
|
1569
1574
|
:sha256lite => 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
|
1570
1575
|
:sha1 => 'da39a3ee5e6b4b0d3255bfef95601890afd80709',
|
1571
1576
|
:sha1lite => 'da39a3ee5e6b4b0d3255bfef95601890afd80709',
|
1577
|
+
:sha224 => 'd14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f',
|
1578
|
+
:sha384 => '38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b',
|
1579
|
+
:sha512 => 'cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e',
|
1572
1580
|
}
|
1573
1581
|
end
|
1574
1582
|
|
@@ -10,6 +10,14 @@ describe Puppet::Type.type(:group) do
|
|
10
10
|
expect(@class.provider_feature(:system_groups)).not_to be_nil
|
11
11
|
end
|
12
12
|
|
13
|
+
it 'should default to `present`' do
|
14
|
+
expect(@class.new(:name => "foo")[:ensure]).to eq(:present)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should set ensure to whatever is passed in' do
|
18
|
+
expect(@class.new(:name => "foo", :ensure => 'absent')[:ensure]).to eq(:absent)
|
19
|
+
end
|
20
|
+
|
13
21
|
describe "when validating attributes" do
|
14
22
|
[:name, :allowdupe].each do |param|
|
15
23
|
it "should have a #{param} parameter" do
|
@@ -12,6 +12,10 @@ describe Puppet::Type.type(:k5login), :unless => Puppet.features.microsoft_windo
|
|
12
12
|
it { is_expected.to be_validattr :path }
|
13
13
|
it { is_expected.to be_validattr :principals }
|
14
14
|
it { is_expected.to be_validattr :mode }
|
15
|
+
it { is_expected.to be_validattr :selrange }
|
16
|
+
it { is_expected.to be_validattr :selrole }
|
17
|
+
it { is_expected.to be_validattr :seltype }
|
18
|
+
it { is_expected.to be_validattr :seluser }
|
15
19
|
# We have one, inline provider implemented.
|
16
20
|
it { is_expected.to be_validattr :provider }
|
17
21
|
end
|
@@ -22,7 +26,11 @@ describe Puppet::Type.type(:k5login), :unless => Puppet.features.microsoft_windo
|
|
22
26
|
attrs = {
|
23
27
|
:ensure => 'present',
|
24
28
|
:path => path,
|
25
|
-
:principals => 'fred@EXAMPLE.COM'
|
29
|
+
:principals => 'fred@EXAMPLE.COM',
|
30
|
+
:seluser => 'user_u',
|
31
|
+
:selrole => 'role_r',
|
32
|
+
:seltype => 'type_t',
|
33
|
+
:selrange => 's0',
|
26
34
|
}.merge(attrs)
|
27
35
|
|
28
36
|
if content = attrs.delete(:content)
|
@@ -69,6 +77,19 @@ describe Puppet::Type.type(:k5login), :unless => Puppet.features.microsoft_windo
|
|
69
77
|
end
|
70
78
|
end
|
71
79
|
|
80
|
+
context "with selinux" do
|
81
|
+
subject { resource(:content => "daniel@EXAMPLE.COM\n",).retrieve }
|
82
|
+
it "should return correct values based on SELinux state" do
|
83
|
+
Puppet::Type::K5login::ProviderK5login.any_instance.stubs(:selinux_support?).returns true
|
84
|
+
Puppet::Type::K5login::ProviderK5login.any_instance.stubs(:get_selinux_current_context).returns "user_u:role_r:type_t:s0"
|
85
|
+
|
86
|
+
expect(subject[:seluser]).to eq("user_u")
|
87
|
+
expect(subject[:selrole]).to eq("role_r")
|
88
|
+
expect(subject[:seltype]).to eq("type_t")
|
89
|
+
expect(subject[:selrange]).to eq("s0")
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
72
93
|
context "with two principals" do
|
73
94
|
subject do
|
74
95
|
content = ["daniel@EXAMPLE.COM", "george@EXAMPLE.COM"].join("\n")
|
@@ -57,6 +57,21 @@ describe Puppet::Type.type(:scheduled_task), :if => Puppet.features.microsoft_wi
|
|
57
57
|
end
|
58
58
|
|
59
59
|
describe 'when setting whether the task is enabled or not' do
|
60
|
+
it 'should return true when enabled is set to true' do
|
61
|
+
expect(described_class.new(
|
62
|
+
:title => 'Foo',
|
63
|
+
:command => 'C:\Windows\System32\notepad.exe',
|
64
|
+
:enabled => 'true',
|
65
|
+
)[:enabled]).to eq(:true)
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'should return false when enabled is set to false' do
|
69
|
+
expect(described_class.new(
|
70
|
+
:title => 'Foo',
|
71
|
+
:command => 'C:\Windows\System32\notepad.exe',
|
72
|
+
:enabled => 'false',
|
73
|
+
)[:enabled]).to eq(:false)
|
74
|
+
end
|
60
75
|
end
|
61
76
|
|
62
77
|
describe 'when setting the working directory' do
|
data/spec/unit/type/user_spec.rb
CHANGED
@@ -86,7 +86,7 @@ describe Puppet::Type.type(:user) do
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
-
properties = [:ensure, :uid, :gid, :home, :comment, :shell, :password, :password_min_age, :password_max_age, :groups, :roles, :auths, :profiles, :project, :keys, :expiry]
|
89
|
+
properties = [:ensure, :uid, :gid, :home, :comment, :shell, :password, :password_min_age, :password_max_age, :password_warn_days, :groups, :roles, :auths, :profiles, :project, :keys, :expiry]
|
90
90
|
|
91
91
|
properties.each do |property|
|
92
92
|
it "should have a #{property} property" do
|
@@ -314,6 +314,16 @@ describe Puppet::Type.type(:user) do
|
|
314
314
|
end
|
315
315
|
end
|
316
316
|
|
317
|
+
describe "when managing warning password days" do
|
318
|
+
it "should accept a negative warning days" do
|
319
|
+
expect { described_class.new(:name => 'foo', :password_warn_days => '-1') }.to_not raise_error
|
320
|
+
end
|
321
|
+
|
322
|
+
it "should fail with an empty warning days" do
|
323
|
+
expect { described_class.new(:name => 'foo', :password_warn_days => '') }.to raise_error(Puppet::Error, /warning days must be provided as a number/)
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
317
327
|
describe "when managing passwords" do
|
318
328
|
before do
|
319
329
|
@password = described_class.new(:name => 'foo', :password => 'mypass').parameter(:password)
|
@@ -174,6 +174,11 @@ describe Puppet::Type.type(:yumrepo) do
|
|
174
174
|
it_behaves_like "a yumrepo parameter that can be absent", :gpgcheck
|
175
175
|
end
|
176
176
|
|
177
|
+
describe "payload_gpgcheck" do
|
178
|
+
it_behaves_like "a yumrepo parameter that expects a boolean parameter", :payload_gpgcheck
|
179
|
+
it_behaves_like "a yumrepo parameter that can be absent", :payload_gpgcheck
|
180
|
+
end
|
181
|
+
|
177
182
|
describe "repo_gpgcheck" do
|
178
183
|
it_behaves_like "a yumrepo parameter that expects a boolean parameter", :repo_gpgcheck
|
179
184
|
it_behaves_like "a yumrepo parameter that can be absent", :repo_gpgcheck
|
@@ -10,7 +10,7 @@ describe Puppet::Util::Checksums do
|
|
10
10
|
@summer = Puppet::Util::Checksums
|
11
11
|
end
|
12
12
|
|
13
|
-
content_sums = [:md5, :md5lite, :sha1, :sha1lite, :sha256, :sha256lite]
|
13
|
+
content_sums = [:md5, :md5lite, :sha1, :sha1lite, :sha256, :sha256lite, :sha512, :sha384, :sha224]
|
14
14
|
file_only = [:ctime, :mtime, :none]
|
15
15
|
|
16
16
|
content_sums.each do |sumtype|
|
@@ -42,7 +42,7 @@ describe Puppet::Util::Checksums do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
%w{{md5}asdfasdf {sha1}asdfasdf {ctime}asdasdf {mtime}asdfasdf
|
45
|
-
{sha256}asdfasdf {sha256lite}asdfasdf}.each do |sum|
|
45
|
+
{sha256}asdfasdf {sha256lite}asdfasdf {sha512}asdfasdf {sha384}asdfasdf {sha224}asdfasdf}.each do |sum|
|
46
46
|
it "should consider #{sum} to be a checksum" do
|
47
47
|
expect(@summer).to be_checksum(sum)
|
48
48
|
end
|
@@ -66,7 +66,7 @@ describe Puppet::Util::Checksums do
|
|
66
66
|
expect(@summer.sumtype("asdfasdfa")).to be_nil
|
67
67
|
end
|
68
68
|
|
69
|
-
{:md5 => Digest::MD5, :sha1 => Digest::SHA1, :sha256 => Digest::SHA256}.each do |sum, klass|
|
69
|
+
{:md5 => Digest::MD5, :sha1 => Digest::SHA1, :sha256 => Digest::SHA256, :sha512 => Digest::SHA512, :sha384 => Digest::SHA384}.each do |sum, klass|
|
70
70
|
describe("when using #{sum}") do
|
71
71
|
it "should use #{klass} to calculate string checksums" do
|
72
72
|
klass.expects(:hexdigest).with("mycontent").returns "whatever"
|
@@ -207,6 +207,20 @@ describe ":eventlog", :if => Puppet::Util::Platform.windows? do
|
|
207
207
|
expect(Puppet.features.eventlog?).to be_truthy
|
208
208
|
end
|
209
209
|
|
210
|
+
it "should truncate extremely long log messages" do
|
211
|
+
long_msg = "x" * 32000
|
212
|
+
expected_truncated_msg = "#{'x' * 31785}...Message exceeds character length limit, truncating."
|
213
|
+
expected_data = "a vogon ship: " + expected_truncated_msg
|
214
|
+
|
215
|
+
eventlog = stub('eventlog')
|
216
|
+
eventlog.expects(:report_event).with(has_entries(:event_type => 2, :event_id => 2, :data => expected_data))
|
217
|
+
msg = Puppet::Util::Log.new(:level => :warning, :message => long_msg, :source => "a vogon ship")
|
218
|
+
Puppet::Util::Windows::EventLog.stubs(:open).returns(eventlog)
|
219
|
+
|
220
|
+
dest = klass.new
|
221
|
+
dest.handle(msg)
|
222
|
+
end
|
223
|
+
|
210
224
|
it "logs to the Puppet Application event log" do
|
211
225
|
Puppet::Util::Windows::EventLog.expects(:open).with('Puppet').returns(stub('eventlog'))
|
212
226
|
|
@@ -184,7 +184,7 @@ eos
|
|
184
184
|
"VLAN99" => "VLAN99"
|
185
185
|
}.each do |input,expected|
|
186
186
|
it "should canonicalize #{input} to #{expected}" do
|
187
|
-
expect(@cisco.
|
187
|
+
expect(@cisco.canonicalize_ifname(input)).to eq(expected)
|
188
188
|
end
|
189
189
|
end
|
190
190
|
|
@@ -92,7 +92,7 @@ describe Puppet::Util::Plist, :if => Puppet.features.cfpropertylist? do
|
|
92
92
|
subject.stubs(:open_file_with_args).with(plist_path, 'r:UTF-8').returns(invalid_xml_plist)
|
93
93
|
Puppet.expects(:debug).with(regexp_matches(/^Failed with CFFormatError/))
|
94
94
|
Puppet.expects(:debug).with("Plist #{plist_path} ill-formatted, converting with plutil")
|
95
|
-
Puppet::Util::Execution.expects(:execute).with(['/usr/bin/plutil', '-convert', 'xml1', '-o', '
|
95
|
+
Puppet::Util::Execution.expects(:execute).with(['/usr/bin/plutil', '-convert', 'xml1', '-o', '/dev/stdout', plist_path],
|
96
96
|
{:failonfail => true, :combine => true}).returns(valid_xml_plist)
|
97
97
|
expect(subject.read_plist_file(plist_path)).to eq(valid_xml_plist_hash)
|
98
98
|
end
|
@@ -101,7 +101,7 @@ describe Puppet::Util::Plist, :if => Puppet.features.cfpropertylist? do
|
|
101
101
|
subject.stubs(:open_file_with_args).with(plist_path, 'r:UTF-8').returns(non_plist_data)
|
102
102
|
Puppet.expects(:debug).with(regexp_matches(/^Failed with (CFFormatError|NoMethodError)/))
|
103
103
|
Puppet.expects(:debug).with("Plist #{plist_path} ill-formatted, converting with plutil")
|
104
|
-
Puppet::Util::Execution.expects(:execute).with(['/usr/bin/plutil', '-convert', 'xml1', '-o', '
|
104
|
+
Puppet::Util::Execution.expects(:execute).with(['/usr/bin/plutil', '-convert', 'xml1', '-o', '/dev/stdout', plist_path],
|
105
105
|
{:failonfail => true, :combine => true}).raises(Puppet::ExecutionFailure, 'boom')
|
106
106
|
expect(subject.read_plist_file(plist_path)).to eq(nil)
|
107
107
|
end
|
@@ -110,7 +110,7 @@ describe Puppet::Util::Plist, :if => Puppet.features.cfpropertylist? do
|
|
110
110
|
subject.stubs(:open_file_with_args).with(plist_path, 'r:UTF-8').returns(binary_data)
|
111
111
|
Puppet.expects(:debug).with(regexp_matches(/^Failed with (CFFormatError|ArgumentError)/))
|
112
112
|
Puppet.expects(:debug).with("Plist #{plist_path} ill-formatted, converting with plutil")
|
113
|
-
Puppet::Util::Execution.expects(:execute).with(['/usr/bin/plutil', '-convert', 'xml1', '-o', '
|
113
|
+
Puppet::Util::Execution.expects(:execute).with(['/usr/bin/plutil', '-convert', 'xml1', '-o', '/dev/stdout', plist_path],
|
114
114
|
{:failonfail => true, :combine => true}).raises(Puppet::ExecutionFailure, 'boom')
|
115
115
|
expect(subject.read_plist_file(plist_path)).to eq(nil)
|
116
116
|
end
|
@@ -106,14 +106,14 @@ describe Puppet::Util::Windows::ADSI, :if => Puppet.features.microsoft_windows?
|
|
106
106
|
end
|
107
107
|
|
108
108
|
it "should be able to check the existence of a user" do
|
109
|
-
Puppet::Util::Windows::SID.expects(:
|
109
|
+
Puppet::Util::Windows::SID.expects(:name_to_sid_object).with(username).returns nil
|
110
110
|
Puppet::Util::Windows::ADSI.expects(:connect).with("WinNT://./#{username},user").returns connection
|
111
111
|
connection.expects(:Class).returns('User')
|
112
112
|
expect(Puppet::Util::Windows::ADSI::User.exists?(username)).to be_truthy
|
113
113
|
end
|
114
114
|
|
115
115
|
it "should be able to check the existence of a domain user" do
|
116
|
-
Puppet::Util::Windows::SID.expects(:
|
116
|
+
Puppet::Util::Windows::SID.expects(:name_to_sid_object).with("#{domain}\\#{username}").returns nil
|
117
117
|
Puppet::Util::Windows::ADSI.expects(:connect).with("WinNT://#{domain}/#{username},user").returns connection
|
118
118
|
connection.expects(:Class).returns('User')
|
119
119
|
expect(Puppet::Util::Windows::ADSI::User.exists?(domain_username)).to be_truthy
|
@@ -213,7 +213,7 @@ describe Puppet::Util::Windows::ADSI, :if => Puppet.features.microsoft_windows?
|
|
213
213
|
end
|
214
214
|
|
215
215
|
it "should generate the correct URI" do
|
216
|
-
Puppet::Util::Windows::SID.stubs(:
|
216
|
+
Puppet::Util::Windows::SID.stubs(:octet_string_to_sid_object).returns(sid)
|
217
217
|
expect(user.uri).to eq("WinNT://testcomputername/#{username},user")
|
218
218
|
end
|
219
219
|
|
@@ -276,8 +276,8 @@ describe Puppet::Util::Windows::ADSI, :if => Puppet.features.microsoft_windows?
|
|
276
276
|
let(:someone_sid){ stub(:account => 'someone', :domain => 'testcomputername')}
|
277
277
|
|
278
278
|
describe "should be able to use SID objects" do
|
279
|
-
let(:system) { Puppet::Util::Windows::SID.
|
280
|
-
let(:invalid) { Puppet::Util::Windows::SID.
|
279
|
+
let(:system) { Puppet::Util::Windows::SID.name_to_sid_object('SYSTEM') }
|
280
|
+
let(:invalid) { Puppet::Util::Windows::SID.name_to_sid_object('foobar') }
|
281
281
|
|
282
282
|
it "to add a member" do
|
283
283
|
adsi_group.expects(:Add).with("WinNT://S-1-5-18")
|
@@ -303,14 +303,11 @@ describe Puppet::Util::Windows::ADSI, :if => Puppet.features.microsoft_windows?
|
|
303
303
|
it "should provide its groups as a list of names" do
|
304
304
|
names = ['user1', 'user2']
|
305
305
|
|
306
|
-
users = names.map { |name| stub('user', :Name => name
|
306
|
+
users = names.map { |name| stub('user', :Name => name) }
|
307
307
|
|
308
308
|
adsi_group.expects(:Members).returns(users)
|
309
309
|
|
310
|
-
|
311
|
-
Puppet::Util::Windows::SID.expects(:octet_string_to_principal).with('user2').returns(stub(:domain_account => 'HOSTNAME\user2'))
|
312
|
-
|
313
|
-
expect(group.members.map(&:domain_account)).to match(['HOSTNAME\user1', 'HOSTNAME\user2'])
|
310
|
+
expect(group.members).to match(names)
|
314
311
|
end
|
315
312
|
|
316
313
|
context "calling .set_members" do
|
@@ -323,16 +320,16 @@ describe Puppet::Util::Windows::ADSI, :if => Puppet.features.microsoft_windows?
|
|
323
320
|
]
|
324
321
|
|
325
322
|
# use stubbed objectSid on member to return stubbed SID
|
326
|
-
Puppet::Util::Windows::SID.expects(:
|
327
|
-
Puppet::Util::Windows::SID.expects(:
|
323
|
+
Puppet::Util::Windows::SID.expects(:octet_string_to_sid_object).with([0]).returns(sids[0])
|
324
|
+
Puppet::Util::Windows::SID.expects(:octet_string_to_sid_object).with([1]).returns(sids[1])
|
328
325
|
|
329
|
-
Puppet::Util::Windows::SID.expects(:
|
330
|
-
Puppet::Util::Windows::SID.expects(:
|
326
|
+
Puppet::Util::Windows::SID.expects(:name_to_sid_object).with('user2').returns(sids[1])
|
327
|
+
Puppet::Util::Windows::SID.expects(:name_to_sid_object).with('DOMAIN2\user3').returns(sids[2])
|
331
328
|
|
332
329
|
Puppet::Util::Windows::ADSI.expects(:sid_uri).with(sids[0]).returns("WinNT://DOMAIN/user1,user")
|
333
330
|
Puppet::Util::Windows::ADSI.expects(:sid_uri).with(sids[2]).returns("WinNT://DOMAIN2/user3,user")
|
334
331
|
|
335
|
-
members = names.each_with_index.map{|n,i| stub(:Name => n, :objectSID => [i]
|
332
|
+
members = names.each_with_index.map{|n,i| stub(:Name => n, :objectSID => [i])}
|
336
333
|
adsi_group.expects(:Members).returns members
|
337
334
|
|
338
335
|
adsi_group.expects(:Remove).with('WinNT://DOMAIN/user1,user')
|
@@ -350,15 +347,15 @@ describe Puppet::Util::Windows::ADSI, :if => Puppet.features.microsoft_windows?
|
|
350
347
|
]
|
351
348
|
|
352
349
|
# use stubbed objectSid on member to return stubbed SID
|
353
|
-
Puppet::Util::Windows::SID.expects(:
|
354
|
-
Puppet::Util::Windows::SID.expects(:
|
350
|
+
Puppet::Util::Windows::SID.expects(:octet_string_to_sid_object).with([0]).returns(sids[0])
|
351
|
+
Puppet::Util::Windows::SID.expects(:octet_string_to_sid_object).with([1]).returns(sids[1])
|
355
352
|
|
356
|
-
Puppet::Util::Windows::SID.expects(:
|
357
|
-
Puppet::Util::Windows::SID.expects(:
|
353
|
+
Puppet::Util::Windows::SID.expects(:name_to_sid_object).with('user2').returns(sids[1])
|
354
|
+
Puppet::Util::Windows::SID.expects(:name_to_sid_object).with('DOMAIN2\user3').returns(sids[2])
|
358
355
|
|
359
356
|
Puppet::Util::Windows::ADSI.expects(:sid_uri).with(sids[2]).returns("WinNT://DOMAIN2/user3,user")
|
360
357
|
|
361
|
-
members = names.each_with_index.map{|n,i| stub(:Name => n, :objectSID => [i]
|
358
|
+
members = names.each_with_index.map{|n,i| stub(:Name => n, :objectSID => [i])}
|
362
359
|
adsi_group.expects(:Members).returns members
|
363
360
|
|
364
361
|
adsi_group.expects(:Remove).with('WinNT://DOMAIN/user1,user').never
|
@@ -385,13 +382,13 @@ describe Puppet::Util::Windows::ADSI, :if => Puppet.features.microsoft_windows?
|
|
385
382
|
]
|
386
383
|
|
387
384
|
# use stubbed objectSid on member to return stubbed SID
|
388
|
-
Puppet::Util::Windows::SID.expects(:
|
389
|
-
Puppet::Util::Windows::SID.expects(:
|
385
|
+
Puppet::Util::Windows::SID.expects(:octet_string_to_sid_object).with([0]).returns(sids[0])
|
386
|
+
Puppet::Util::Windows::SID.expects(:octet_string_to_sid_object).with([1]).returns(sids[1])
|
390
387
|
|
391
388
|
Puppet::Util::Windows::ADSI.expects(:sid_uri).with(sids[0]).returns("WinNT://DOMAIN/user1,user")
|
392
389
|
Puppet::Util::Windows::ADSI.expects(:sid_uri).with(sids[1]).returns("WinNT://testcomputername/user2,user")
|
393
390
|
|
394
|
-
members = names.each_with_index.map{|n,i| stub(:Name => n, :objectSID => [i]
|
391
|
+
members = names.each_with_index.map{|n,i| stub(:Name => n, :objectSID => [i])}
|
395
392
|
adsi_group.expects(:Members).returns members
|
396
393
|
|
397
394
|
adsi_group.expects(:Remove).with('WinNT://DOMAIN/user1,user')
|
@@ -407,10 +404,10 @@ describe Puppet::Util::Windows::ADSI, :if => Puppet.features.microsoft_windows?
|
|
407
404
|
stub(:account => 'user2', :domain => 'testcomputername', :sid => 2 ),
|
408
405
|
]
|
409
406
|
# use stubbed objectSid on member to return stubbed SID
|
410
|
-
Puppet::Util::Windows::SID.expects(:
|
411
|
-
Puppet::Util::Windows::SID.expects(:
|
407
|
+
Puppet::Util::Windows::SID.expects(:octet_string_to_sid_object).with([0]).returns(sids[0])
|
408
|
+
Puppet::Util::Windows::SID.expects(:octet_string_to_sid_object).with([1]).returns(sids[1])
|
412
409
|
|
413
|
-
members = names.each_with_index.map{|n,i| stub(:Name => n, :objectSID => [i]
|
410
|
+
members = names.each_with_index.map{|n,i| stub(:Name => n, :objectSID => [i])}
|
414
411
|
adsi_group.expects(:Members).returns members
|
415
412
|
|
416
413
|
adsi_group.expects(:Remove).never
|
@@ -431,7 +428,7 @@ describe Puppet::Util::Windows::ADSI, :if => Puppet.features.microsoft_windows?
|
|
431
428
|
adsi_group.expects(:objectSID).returns([0])
|
432
429
|
Socket.expects(:gethostname).returns('TESTcomputerNAME')
|
433
430
|
computer_sid = stub(:account => groupname,:domain => 'testcomputername')
|
434
|
-
Puppet::Util::Windows::SID.expects(:
|
431
|
+
Puppet::Util::Windows::SID.expects(:octet_string_to_sid_object).with([0]).returns(computer_sid)
|
435
432
|
expect(group.uri).to eq("WinNT://./#{groupname},group")
|
436
433
|
end
|
437
434
|
end
|
@@ -461,7 +458,7 @@ describe Puppet::Util::Windows::ADSI, :if => Puppet.features.microsoft_windows?
|
|
461
458
|
end
|
462
459
|
|
463
460
|
it "should be able to confirm the existence of a group" do
|
464
|
-
Puppet::Util::Windows::SID.expects(:
|
461
|
+
Puppet::Util::Windows::SID.expects(:name_to_sid_object).with(groupname).returns nil
|
465
462
|
Puppet::Util::Windows::ADSI.expects(:connect).with("WinNT://./#{groupname},group").returns connection
|
466
463
|
connection.expects(:Class).returns('Group')
|
467
464
|
|
@@ -503,14 +500,13 @@ describe Puppet::Util::Windows::ADSI, :if => Puppet.features.microsoft_windows?
|
|
503
500
|
Puppet::Util::Windows::ADSI.expects(:execquery).with('select name from win32_group where localaccount = "TRUE"').returns(wmi_groups)
|
504
501
|
|
505
502
|
native_group = stub('IADsGroup')
|
506
|
-
|
507
|
-
native_group.expects(:Members).returns([stub(:Name => 'Administrator', :objectSID => [], :ole_respond_to? => true)])
|
503
|
+
native_group.expects(:Members).returns([stub(:Name => 'Administrator')])
|
508
504
|
Puppet::Util::Windows::ADSI.expects(:connect).with("WinNT://./#{name},group").returns(native_group)
|
509
505
|
|
510
506
|
groups = Puppet::Util::Windows::ADSI::Group.to_a
|
511
507
|
expect(groups.length).to eq(1)
|
512
508
|
expect(groups[0].name).to eq(name)
|
513
|
-
expect(groups[0].members
|
509
|
+
expect(groups[0].members).to eq(['Administrator'])
|
514
510
|
end
|
515
511
|
end
|
516
512
|
|
@@ -13,10 +13,10 @@ describe "Puppet::Util::Windows::SID", :if => Puppet.features.microsoft_windows?
|
|
13
13
|
let(:null_sid) { 'S-1-0-0' }
|
14
14
|
let(:unknown_name) { 'chewbacca' }
|
15
15
|
|
16
|
-
context "#
|
16
|
+
context "#octet_string_to_sid_object" do
|
17
17
|
it "should properly convert an array of bytes for a well-known non-localized SID" do
|
18
18
|
bytes = [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
19
|
-
converted = subject.
|
19
|
+
converted = subject.octet_string_to_sid_object(bytes)
|
20
20
|
|
21
21
|
expect(converted).to be_an_instance_of Puppet::Util::Windows::SID::Principal
|
22
22
|
expect(converted.sid_bytes).to eq(bytes)
|
@@ -28,13 +28,13 @@ describe "Puppet::Util::Windows::SID", :if => Puppet.features.microsoft_windows?
|
|
28
28
|
|
29
29
|
it "should raise an error for non-array input" do
|
30
30
|
expect {
|
31
|
-
subject.
|
31
|
+
subject.octet_string_to_sid_object(invalid_sid)
|
32
32
|
}.to raise_error(Puppet::Error, /Octet string must be an array of bytes/)
|
33
33
|
end
|
34
34
|
|
35
35
|
it "should raise an error for an empty byte array" do
|
36
36
|
expect {
|
37
|
-
subject.
|
37
|
+
subject.octet_string_to_sid_object([])
|
38
38
|
}.to raise_error(Puppet::Error, /Octet string must be an array of bytes/)
|
39
39
|
end
|
40
40
|
|
@@ -42,7 +42,7 @@ describe "Puppet::Util::Windows::SID", :if => Puppet.features.microsoft_windows?
|
|
42
42
|
expect {
|
43
43
|
# S-1-1-1 which is not a valid account
|
44
44
|
valid_octet_invalid_user =[1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0]
|
45
|
-
subject.
|
45
|
+
subject.octet_string_to_sid_object(valid_octet_invalid_user)
|
46
46
|
}.to raise_error do |error|
|
47
47
|
expect(error).to be_a(Puppet::Util::Windows::Error)
|
48
48
|
expect(error.code).to eq(1332) # ERROR_NONE_MAPPED
|
@@ -52,7 +52,7 @@ describe "Puppet::Util::Windows::SID", :if => Puppet.features.microsoft_windows?
|
|
52
52
|
it "should raise an error for a malformed byte array" do
|
53
53
|
expect {
|
54
54
|
invalid_octet = [2]
|
55
|
-
subject.
|
55
|
+
subject.octet_string_to_sid_object(invalid_octet)
|
56
56
|
}.to raise_error do |error|
|
57
57
|
expect(error).to be_a(Puppet::Util::Windows::Error)
|
58
58
|
expect(error.code).to eq(87) # ERROR_INVALID_PARAMETER
|
@@ -72,12 +72,12 @@ describe "Puppet::Util::Windows::SID", :if => Puppet.features.microsoft_windows?
|
|
72
72
|
end
|
73
73
|
|
74
74
|
it "should return a SID for a passed user or group name" do
|
75
|
-
subject.expects(:
|
75
|
+
subject.expects(:name_to_sid_object).with('testers').returns stub(:sid => 'S-1-5-32-547')
|
76
76
|
expect(subject.name_to_sid('testers')).to eq('S-1-5-32-547')
|
77
77
|
end
|
78
78
|
|
79
79
|
it "should return a SID for a passed fully-qualified user or group name" do
|
80
|
-
subject.expects(:
|
80
|
+
subject.expects(:name_to_sid_object).with('MACHINE\testers').returns stub(:sid => 'S-1-5-32-547')
|
81
81
|
expect(subject.name_to_sid('MACHINE\testers')).to eq('S-1-5-32-547')
|
82
82
|
end
|
83
83
|
|
@@ -128,108 +128,37 @@ describe "Puppet::Util::Windows::SID", :if => Puppet.features.microsoft_windows?
|
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
|
-
context "#
|
131
|
+
context "#name_to_sid_object" do
|
132
132
|
it "should return nil if the account does not exist" do
|
133
|
-
expect(subject.
|
133
|
+
expect(subject.name_to_sid_object(unknown_name)).to be_nil
|
134
134
|
end
|
135
135
|
|
136
136
|
it "should return a Puppet::Util::Windows::SID::Principal instance for any valid sid" do
|
137
|
-
expect(subject.
|
137
|
+
expect(subject.name_to_sid_object(sid)).to be_an_instance_of(Puppet::Util::Windows::SID::Principal)
|
138
138
|
end
|
139
139
|
|
140
140
|
it "should accept unqualified account name" do
|
141
141
|
# NOTE: lookup by name works in localized environments only for a few instances
|
142
142
|
# this works in French Windows, even though the account is really Syst\u00E8me
|
143
|
-
expect(subject.
|
143
|
+
expect(subject.name_to_sid_object('SYSTEM').sid).to eq(sid)
|
144
144
|
end
|
145
145
|
|
146
146
|
it "should be case-insensitive" do
|
147
147
|
# NOTE: lookup by name works in localized environments only for a few instances
|
148
148
|
# this works in French Windows, even though the account is really Syst\u00E8me
|
149
|
-
expect(subject.
|
149
|
+
expect(subject.name_to_sid_object('SYSTEM')).to eq(subject.name_to_sid_object('system'))
|
150
150
|
end
|
151
151
|
|
152
152
|
it "should be leading and trailing whitespace-insensitive" do
|
153
153
|
# NOTE: lookup by name works in localized environments only for a few instances
|
154
154
|
# this works in French Windows, even though the account is really Syst\u00E8me
|
155
|
-
expect(subject.
|
155
|
+
expect(subject.name_to_sid_object('SYSTEM')).to eq(subject.name_to_sid_object(' SYSTEM '))
|
156
156
|
end
|
157
157
|
|
158
158
|
it "should accept domain qualified account names" do
|
159
159
|
# NOTE: lookup by name works in localized environments only for a few instances
|
160
160
|
# this works in French Windows, even though the account is really AUTORITE NT\\Syst\u00E8me
|
161
|
-
expect(subject.
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
context "#ads_to_principal" do
|
166
|
-
it "should raise an error for non-WIN32OLE input" do
|
167
|
-
expect {
|
168
|
-
subject.ads_to_principal(stub('WIN32OLE', { :Name => 'foo' }))
|
169
|
-
}.to raise_error(Puppet::Error, /ads_object must be an IAdsUser or IAdsGroup instance/)
|
170
|
-
end
|
171
|
-
|
172
|
-
it "should raise an error for an empty byte array in the objectSID property" do
|
173
|
-
expect {
|
174
|
-
subject.ads_to_principal(stub('WIN32OLE', { :objectSID => [], :Name => '', :ole_respond_to? => true }))
|
175
|
-
}.to raise_error(Puppet::Error, /Octet string must be an array of bytes/)
|
176
|
-
end
|
177
|
-
|
178
|
-
it "should raise an error for a malformed byte array" do
|
179
|
-
expect {
|
180
|
-
invalid_octet = [2]
|
181
|
-
subject.ads_to_principal(stub('WIN32OLE', { :objectSID => invalid_octet, :Name => '', :ole_respond_to? => true }))
|
182
|
-
}.to raise_error do |error|
|
183
|
-
expect(error).to be_a(Puppet::Util::Windows::Error)
|
184
|
-
expect(error.code).to eq(87) # ERROR_INVALID_PARAMETER
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
it "should raise an error when a valid byte array for SID is unresolvable and its Name does not match" do
|
189
|
-
expect {
|
190
|
-
# S-1-1-1 is a valid SID that will not resolve
|
191
|
-
valid_octet_invalid_user = [1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0]
|
192
|
-
subject.ads_to_principal(stub('WIN32OLE', { :objectSID => valid_octet_invalid_user, :Name => unknown_name, :ole_respond_to? => true }))
|
193
|
-
}.to raise_error do |error|
|
194
|
-
expect(error).to be_a(Puppet::Error)
|
195
|
-
expect(error.cause.code).to eq(1332) # ERROR_NONE_MAPPED
|
196
|
-
end
|
197
|
-
end
|
198
|
-
|
199
|
-
it "should return a Principal object even when the SID is unresolvable, as long as the Name matches" do
|
200
|
-
# S-1-1-1 is a valid SID that will not resolve
|
201
|
-
valid_octet_invalid_user = [1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0]
|
202
|
-
unresolvable_user = stub('WIN32OLE', { :objectSID => valid_octet_invalid_user, :Name => 'S-1-1-1', :ole_respond_to? => true })
|
203
|
-
principal = subject.ads_to_principal(unresolvable_user)
|
204
|
-
|
205
|
-
expect(principal).to be_an_instance_of(Puppet::Util::Windows::SID::Principal)
|
206
|
-
expect(principal.account).to eq('S-1-1-1 (unresolvable)')
|
207
|
-
expect(principal.domain).to eq(nil)
|
208
|
-
expect(principal.domain_account).to eq('S-1-1-1 (unresolvable)')
|
209
|
-
expect(principal.sid).to eq('S-1-1-1')
|
210
|
-
expect(principal.sid_bytes).to eq(valid_octet_invalid_user)
|
211
|
-
expect(principal.account_type).to eq(:SidTypeUnknown)
|
212
|
-
end
|
213
|
-
|
214
|
-
it "should return a Puppet::Util::Windows::SID::Principal instance for any valid sid" do
|
215
|
-
system_bytes = [1, 1, 0, 0, 0, 0, 0, 5, 18, 0, 0, 0]
|
216
|
-
adsuser = stub('WIN32OLE', { :objectSID => system_bytes, :Name => 'SYSTEM', :ole_respond_to? => true })
|
217
|
-
expect(subject.ads_to_principal(adsuser)).to be_an_instance_of(Puppet::Util::Windows::SID::Principal)
|
218
|
-
end
|
219
|
-
|
220
|
-
it "should properly convert an array of bytes for a well-known non-localized SID, ignoring the Name from the WIN32OLE object" do
|
221
|
-
bytes = [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
222
|
-
adsuser = stub('WIN32OLE', { :objectSID => bytes, :Name => unknown_name, :ole_respond_to? => true })
|
223
|
-
converted = subject.ads_to_principal(adsuser)
|
224
|
-
|
225
|
-
expect(converted).to be_an_instance_of Puppet::Util::Windows::SID::Principal
|
226
|
-
expect(converted.sid_bytes).to eq(bytes)
|
227
|
-
expect(converted.sid).to eq(null_sid)
|
228
|
-
|
229
|
-
# carefully select a SID here that is not localized on international Windows
|
230
|
-
expect(converted.account).to eq('NULL SID')
|
231
|
-
# garbage name supplied does not carry forward as SID is looked up again
|
232
|
-
expect(converted.account).to_not eq(adsuser.Name)
|
161
|
+
expect(subject.name_to_sid_object('NT AUTHORITY\SYSTEM').sid).to eq(sid)
|
233
162
|
end
|
234
163
|
end
|
235
164
|
|