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
data/lib/puppet/functions/all.rb
CHANGED
@@ -94,7 +94,11 @@ Puppet::Functions.create_function(:all) do
|
|
94
94
|
|
95
95
|
def all_Enumerable_2(enumerable)
|
96
96
|
enum = Puppet::Pops::Types::Iterable.asserted_iterable(self, enumerable)
|
97
|
-
enum.
|
98
|
-
|
97
|
+
if enum.hash_style?
|
98
|
+
enum.all? { |entry| yield(*entry) }
|
99
|
+
else
|
100
|
+
enum.each_with_index { |e, i| return false unless yield(i, e) }
|
101
|
+
true
|
102
|
+
end
|
99
103
|
end
|
100
104
|
end
|
@@ -37,7 +37,7 @@
|
|
37
37
|
# ~~~
|
38
38
|
#
|
39
39
|
# With three arguments, an `Annotation` type, an object, and an the string `clear`, the function will
|
40
|
-
# clear the
|
40
|
+
# clear the annotation of the given type in the given object. The old annotation is returned if
|
41
41
|
# it existed.
|
42
42
|
#
|
43
43
|
# @example Using `annotate` with three arguments where third argument is the string 'clear'
|
data/lib/puppet/functions/any.rb
CHANGED
@@ -27,7 +27,7 @@
|
|
27
27
|
#
|
28
28
|
# Would notice `true` if the looked up hash had a value that is neither `false` nor `undef` for at least
|
29
29
|
# one of the keys. That is, it is equivalent to the expression
|
30
|
-
# `$
|
30
|
+
# `$looked_up[routers] || $looked_up[servers] || $looked_up[workstations]`.
|
31
31
|
#
|
32
32
|
# When the first argument is a `Hash`, Puppet passes each key and value pair to the lambda
|
33
33
|
# as an array in the form `[key, value]`.
|
@@ -99,7 +99,11 @@ Puppet::Functions.create_function(:any) do
|
|
99
99
|
|
100
100
|
def any_Enumerable_2(enumerable)
|
101
101
|
enum = Puppet::Pops::Types::Iterable.asserted_iterable(self, enumerable)
|
102
|
-
enum.
|
103
|
-
|
102
|
+
if enum.hash_style?
|
103
|
+
enum.any? { |entry| yield(*entry) }
|
104
|
+
else
|
105
|
+
enum.each_with_index { |e, i| return true if yield(i, e) }
|
106
|
+
false
|
107
|
+
end
|
104
108
|
end
|
105
109
|
end
|
@@ -13,6 +13,12 @@ Puppet::Functions.create_function(:contain, Puppet::Functions::InternalFunction)
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def contain(scope, *classes)
|
16
|
+
if Puppet[:tasks]
|
17
|
+
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
18
|
+
Puppet::Pops::Issues::CATALOG_OPERATION_NOT_SUPPORTED_WHEN_SCRIPTING,
|
19
|
+
{:operation => 'contain'})
|
20
|
+
end
|
21
|
+
|
16
22
|
# Make call patterns uniform and protected against nested arrays, also make
|
17
23
|
# names absolute if so desired.
|
18
24
|
classes = scope.transform_and_assert_classnames(classes.flatten)
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# The `convert_to(value, type)` is a convenience function does the same as `new(type, value)`.
|
2
|
+
# The difference in the argument ordering allows it to be used in chained style for
|
3
|
+
# improved readability "left to right".
|
4
|
+
#
|
5
|
+
# When the function is given a lambda, it is called with the converted value, and the function
|
6
|
+
# returns what the lambda returns, otherwise the converted value.
|
7
|
+
#
|
8
|
+
# @example 'convert_to' instead of 'new'
|
9
|
+
#
|
10
|
+
# ~~~ puppet
|
11
|
+
# # using new operator - that is "calling the type" with operator ()
|
12
|
+
# Hash(Array("abc").map |$i,$v| { [$i, $v] })
|
13
|
+
#
|
14
|
+
# # using 'convert_to'
|
15
|
+
# "abc".convert_to(Array).map |$i,$v| { [$i, $v] }.convert_to(Hash)
|
16
|
+
#
|
17
|
+
# ~~~
|
18
|
+
#
|
19
|
+
# @since 5.4.0
|
20
|
+
#
|
21
|
+
Puppet::Functions.create_function(:convert_to) do
|
22
|
+
dispatch :convert_to do
|
23
|
+
param 'Any', :value
|
24
|
+
param 'Type', :type
|
25
|
+
optional_block_param 'Callable[1,1]', :block
|
26
|
+
end
|
27
|
+
|
28
|
+
def convert_to(value, type, &block)
|
29
|
+
result = call_function('new', type, value)
|
30
|
+
block_given? ? yield(result) : result
|
31
|
+
end
|
32
|
+
end
|
@@ -105,7 +105,6 @@ Puppet::Functions.create_function(:'defined', Puppet::Functions::InternalFunctio
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def is_defined(scope, *vals)
|
108
|
-
env = scope.environment
|
109
108
|
vals.any? do |val|
|
110
109
|
case val
|
111
110
|
when String
|
@@ -120,7 +119,6 @@ Puppet::Functions.create_function(:'defined', Puppet::Functions::InternalFunctio
|
|
120
119
|
Puppet::Pops::Evaluator::Runtime3ResourceSupport.find_main_class(scope)
|
121
120
|
else
|
122
121
|
# Find a resource type, definition or class definition
|
123
|
-
krt = scope.environment.known_resource_types
|
124
122
|
Puppet::Pops::Evaluator::Runtime3ResourceSupport.find_resource_type_or_class(scope, val)
|
125
123
|
end
|
126
124
|
end
|
@@ -150,7 +148,6 @@ Puppet::Functions.create_function(:'defined', Puppet::Functions::InternalFunctio
|
|
150
148
|
#
|
151
149
|
raise ArgumentError, _('The given class type is a reference to all classes') if val.type.class_name.nil?
|
152
150
|
Puppet::Pops::Evaluator::Runtime3ResourceSupport.find_hostclass(scope, val.type.class_name)
|
153
|
-
#scope.environment.known_resource_types.find_hostclass(val.type.class_name)
|
154
151
|
end
|
155
152
|
else
|
156
153
|
raise ArgumentError, _("Invalid argument of type '%{value_class}' to 'defined'") % { value_class: val.class }
|
@@ -151,13 +151,17 @@ Puppet::Functions.create_function(:each) do
|
|
151
151
|
|
152
152
|
def foreach_Enumerable_2(enumerable)
|
153
153
|
enum = Puppet::Pops::Types::Iterable.asserted_iterable(self, enumerable)
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
index
|
154
|
+
if enum.hash_style?
|
155
|
+
enum.each { |entry| yield(*entry) }
|
156
|
+
else
|
157
|
+
begin
|
158
|
+
index = 0
|
159
|
+
loop do
|
160
|
+
yield(index, enum.next)
|
161
|
+
index += 1
|
162
|
+
end
|
163
|
+
rescue StopIteration
|
159
164
|
end
|
160
|
-
rescue StopIteration
|
161
165
|
end
|
162
166
|
# produces the receiver
|
163
167
|
enumerable
|
@@ -119,19 +119,25 @@ Puppet::Functions.create_function(:filter) do
|
|
119
119
|
end
|
120
120
|
|
121
121
|
def filter_Enumerable_2(enumerable)
|
122
|
-
result = []
|
123
|
-
index = 0
|
124
122
|
enum = Puppet::Pops::Types::Iterable.asserted_iterable(self, enumerable)
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
123
|
+
if enum.hash_style?
|
124
|
+
result = {}
|
125
|
+
enum.each { |k, v| result[k] = v if yield(k, v) == true }
|
126
|
+
result
|
127
|
+
else
|
128
|
+
result = []
|
129
|
+
begin
|
130
|
+
index = 0
|
131
|
+
loop do
|
132
|
+
it = enum.next
|
133
|
+
if yield(index, it) == true
|
134
|
+
result << it
|
135
|
+
end
|
136
|
+
index += 1
|
130
137
|
end
|
131
|
-
|
138
|
+
rescue StopIteration
|
132
139
|
end
|
133
|
-
|
140
|
+
result
|
134
141
|
end
|
135
|
-
result
|
136
142
|
end
|
137
143
|
end
|
@@ -19,7 +19,6 @@ Puppet::Functions.create_function(:find_file, Puppet::Functions::InternalFunctio
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def find_file(scope, *args)
|
22
|
-
path = nil
|
23
22
|
args.each do |file|
|
24
23
|
found = Puppet::Parser::Files.find_file(file, scope.compiler.environment)
|
25
24
|
if found && Puppet::FileSystem.exist?(found)
|
@@ -11,6 +11,12 @@ Puppet::Functions.create_function(:include, Puppet::Functions::InternalFunction)
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def include(scope, *classes)
|
14
|
+
if Puppet[:tasks]
|
15
|
+
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
16
|
+
Puppet::Pops::Issues::CATALOG_OPERATION_NOT_SUPPORTED_WHEN_SCRIPTING,
|
17
|
+
{:operation => 'include'})
|
18
|
+
end
|
19
|
+
|
14
20
|
classes = scope.transform_and_assert_classnames(classes.flatten)
|
15
21
|
result = classes.map {|name| Puppet::Pops::Types::TypeFactory.host_class(name) }
|
16
22
|
scope.compiler.evaluate_classes(classes, scope, false)
|
data/lib/puppet/functions/map.rb
CHANGED
@@ -107,7 +107,6 @@ Puppet::Functions.create_function(:map) do
|
|
107
107
|
|
108
108
|
def map_Enumerable_1(enumerable)
|
109
109
|
result = []
|
110
|
-
index = 0
|
111
110
|
enum = Puppet::Pops::Types::Iterable.asserted_iterable(self, enumerable)
|
112
111
|
begin
|
113
112
|
loop { result << yield(enum.next) }
|
@@ -117,16 +116,20 @@ Puppet::Functions.create_function(:map) do
|
|
117
116
|
end
|
118
117
|
|
119
118
|
def map_Enumerable_2(enumerable)
|
120
|
-
result = []
|
121
|
-
index = 0
|
122
119
|
enum = Puppet::Pops::Types::Iterable.asserted_iterable(self, enumerable)
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
120
|
+
if enum.hash_style?
|
121
|
+
enum.map { |entry| yield(*entry) }
|
122
|
+
else
|
123
|
+
result = []
|
124
|
+
begin
|
125
|
+
index = 0
|
126
|
+
loop do
|
127
|
+
result << yield(index, enum.next)
|
128
|
+
index = index +1
|
129
|
+
end
|
130
|
+
rescue StopIteration
|
127
131
|
end
|
128
|
-
|
132
|
+
result
|
129
133
|
end
|
130
|
-
result
|
131
134
|
end
|
132
135
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# Finds an existing module and returns the path to its root directory.
|
2
|
+
#
|
3
|
+
# The argument to this function should be a module name String
|
4
|
+
# For example, the reference `mysql` will search for the
|
5
|
+
# directory `<MODULES DIRECTORY>/mysql` and return the first
|
6
|
+
# found on the modulepath.
|
7
|
+
#
|
8
|
+
# This function can also accept:
|
9
|
+
#
|
10
|
+
# * Multiple String arguments, which will return the path of the **first** module
|
11
|
+
# found, skipping non existing modules.
|
12
|
+
# * An array of module names, which will return the path of the **first** module
|
13
|
+
# found from the given names in the array, skipping non existing modules.
|
14
|
+
#
|
15
|
+
# The function returns `undef` if none of the given modules were found
|
16
|
+
#
|
17
|
+
# @since 5.4.0
|
18
|
+
#
|
19
|
+
Puppet::Functions.create_function(:module_directory, Puppet::Functions::InternalFunction) do
|
20
|
+
dispatch :module_directory do
|
21
|
+
scope_param
|
22
|
+
repeated_param 'String', :names
|
23
|
+
end
|
24
|
+
|
25
|
+
dispatch :module_directory_array do
|
26
|
+
scope_param
|
27
|
+
repeated_param 'Array[String]', :names
|
28
|
+
end
|
29
|
+
|
30
|
+
def module_directory_array(scope, names)
|
31
|
+
module_directory(scope, *names)
|
32
|
+
end
|
33
|
+
|
34
|
+
def module_directory(scope, *names)
|
35
|
+
names.each do |module_name|
|
36
|
+
found = scope.compiler.environment.module(module_name)
|
37
|
+
return found.path if found
|
38
|
+
end
|
39
|
+
nil
|
40
|
+
end
|
41
|
+
end
|
data/lib/puppet/functions/new.rb
CHANGED
@@ -14,10 +14,7 @@ Puppet::Functions.create_function(:new, Puppet::Functions::InternalFunction) do
|
|
14
14
|
|
15
15
|
def new_instance(scope, t, *args)
|
16
16
|
return args[0] if args.size == 1 && !t.is_a?(Puppet::Pops::Types::PInitType) && t.instance?(args[0])
|
17
|
-
result =
|
18
|
-
new_function_for_type(t, scope).call(scope, *args)
|
19
|
-
end
|
20
|
-
assert_type(t, result)
|
17
|
+
result = assert_type(t, new_function_for_type(t, scope).call(scope, *args))
|
21
18
|
return block_given? ? yield(result) : result
|
22
19
|
end
|
23
20
|
|
@@ -66,7 +66,7 @@ Puppet::Functions.create_function(:regsubst) do
|
|
66
66
|
|
67
67
|
def regsubst_regexp(target, pattern, replacement, flags = nil)
|
68
68
|
pattern = (pattern.pattern || '') if pattern.is_a?(Puppet::Pops::Types::PRegexpType)
|
69
|
-
inner_regsubst(target, pattern, replacement,
|
69
|
+
inner_regsubst(target, pattern, replacement, flags == 'G' ? :gsub : :sub)
|
70
70
|
end
|
71
71
|
|
72
72
|
def inner_regsubst(target, re, replacement, op)
|
@@ -11,6 +11,12 @@ Puppet::Functions.create_function(:require, Puppet::Functions::InternalFunction)
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def require_impl(scope, *classes)
|
14
|
+
if Puppet[:tasks]
|
15
|
+
raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
|
16
|
+
Puppet::Pops::Issues::CATALOG_OPERATION_NOT_SUPPORTED_WHEN_SCRIPTING,
|
17
|
+
{:operation => 'require'})
|
18
|
+
end
|
19
|
+
|
14
20
|
# Make call patterns uniform and protected against nested arrays, also make
|
15
21
|
# names absolute if so desired.
|
16
22
|
classes = scope.transform_and_assert_classnames(classes.flatten)
|
data/lib/puppet/generate/type.rb
CHANGED
@@ -5,7 +5,7 @@ require 'puppet/generate/models/type/type'
|
|
5
5
|
|
6
6
|
module Puppet
|
7
7
|
module Generate
|
8
|
-
#
|
8
|
+
# Responsible for generating type definitions in Puppet
|
9
9
|
class Type
|
10
10
|
# Represents an input to the type generator
|
11
11
|
class Input
|
@@ -191,7 +191,7 @@ module Puppet::GettextConfig
|
|
191
191
|
end
|
192
192
|
|
193
193
|
# @api private
|
194
|
-
# Attempt to load
|
194
|
+
# Attempt to load translations for the given project.
|
195
195
|
# @param [String] project_name the project whose translations we want to load
|
196
196
|
# @param [String] locale_dir the path to the directory containing translations
|
197
197
|
# @param [Symbol] file_format translation file format to use, either :po or :mo
|
@@ -218,7 +218,7 @@ module Puppet::GettextConfig
|
|
218
218
|
# chain for the currently selected text domain, if needed.
|
219
219
|
# @param [String] project_name the name of the project for which to load translations
|
220
220
|
# @param [String] locale_dir the path to the directory containing translations
|
221
|
-
# @param [Symbol] file_format the
|
221
|
+
# @param [Symbol] file_format the format of the translations files, :po or :mo
|
222
222
|
def self.add_repository_to_domain(project_name, locale_dir, file_format, text_domain = FastGettext.text_domain)
|
223
223
|
return if @gettext_disabled || !gettext_loaded?
|
224
224
|
|
data/lib/puppet/gettext/stubs.rb
CHANGED
@@ -178,7 +178,6 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
|
|
178
178
|
# TODO: get property/parameter defaults if entries are nil in the resource
|
179
179
|
# For now they're hard-coded to match the File type.
|
180
180
|
|
181
|
-
file_metadata = {}
|
182
181
|
list_of_resources.each do |resource|
|
183
182
|
sources = [resource[:source]].flatten.compact
|
184
183
|
next unless inlineable?(resource, sources)
|
@@ -161,7 +161,11 @@ module Puppet::FileBucketFile
|
|
161
161
|
if verify_identical_file(contents_file, bucket_file)
|
162
162
|
#TRANSLATORS "FileBucket" should not be translated
|
163
163
|
Puppet.info _("FileBucket got a duplicate file %{file_checksum}") % { file_checksum: bucket_file.checksum }
|
164
|
-
|
164
|
+
# Don't touch the contents file on Windows, since we can't update the
|
165
|
+
# mtime of read-only files there.
|
166
|
+
if !Puppet::Util::Platform.windows?
|
167
|
+
Puppet::FileSystem.touch(contents_file)
|
168
|
+
end
|
165
169
|
elsif contents_file_matches_checksum?(contents_file, bucket_file.checksum_data, bucket_file.checksum_type)
|
166
170
|
# If the contents or sizes don't match, but the checksum does,
|
167
171
|
# then we've found a conflict (potential hash collision).
|
@@ -246,7 +250,7 @@ module Puppet::FileBucketFile
|
|
246
250
|
# @return [void]
|
247
251
|
# @api private
|
248
252
|
def copy_bucket_file_to_contents_file(contents_file, bucket_file)
|
249
|
-
Puppet::
|
253
|
+
Puppet::Util.replace_file(contents_file, 0440) do |of|
|
250
254
|
# PUP-1044 writes all of the contents
|
251
255
|
bucket_file.stream() do |src|
|
252
256
|
FileUtils.copy_stream(src, of)
|
@@ -11,7 +11,7 @@ class Puppet::Indirector::FileServer < Puppet::Indirector::Terminus
|
|
11
11
|
def authorized?(request)
|
12
12
|
return false unless [:find, :search].include?(request.method)
|
13
13
|
|
14
|
-
mount,
|
14
|
+
mount, _ = configuration.split_path(request)
|
15
15
|
|
16
16
|
# If we're not serving this mount, then access is denied.
|
17
17
|
return false unless mount
|
@@ -5,7 +5,8 @@ class Puppet::Node::Ldap < Puppet::Indirector::Ldap
|
|
5
5
|
desc "Search in LDAP for node configuration information. See
|
6
6
|
the [LDAP Nodes](https://docs.puppetlabs.com/guides/ldap_nodes.html) page for more information. This will first
|
7
7
|
search for whatever the certificate name is, then (if that name
|
8
|
-
contains a `.`) for the short name, then `default`.
|
8
|
+
contains a `.`) for the short name, then `default`.
|
9
|
+
Requires ruby-ldap with MRI ruby or jruby-ldap with puppetserver/jruby"
|
9
10
|
|
10
11
|
# The attributes that Puppet class information is stored in.
|
11
12
|
def class_attributes
|
@@ -93,7 +94,8 @@ class Puppet::Node::Ldap < Puppet::Indirector::Ldap
|
|
93
94
|
result[:stacked] = get_stacked_values_from_entry(entry)
|
94
95
|
result[:parameters] = get_parameters_from_entry(entry)
|
95
96
|
|
96
|
-
|
97
|
+
# delete from parameters to prevent "Already declered variable $environment" error
|
98
|
+
result[:environment] = result[:parameters].delete(:environment) if result[:parameters][:environment]
|
97
99
|
|
98
100
|
result[:stacked_parameters] = {}
|
99
101
|
|
@@ -222,9 +224,23 @@ class Puppet::Node::Ldap < Puppet::Indirector::Ldap
|
|
222
224
|
result.uniq
|
223
225
|
end
|
224
226
|
|
227
|
+
# Workaround jruby-ldap 0.0.2 missing the #to_hash method
|
228
|
+
#
|
229
|
+
# @see https://github.com/jruby/jruby-ldap/pull/5
|
230
|
+
#
|
231
|
+
# @param entry [LDAP::Entry] The LDAP::Entry object to convert to a hash
|
232
|
+
# @return [Hash] The hash of the provided LDAP::Entry object with keys
|
233
|
+
# downcased (puppet variables need to start with lowercase char)
|
234
|
+
def ldap_entry_to_hash(entry)
|
235
|
+
h = {}
|
236
|
+
entry.get_attributes.each { |a| h[a.downcase.to_sym] = entry[a] }
|
237
|
+
h[:dn] = [entry.dn]
|
238
|
+
h
|
239
|
+
end
|
240
|
+
|
225
241
|
def get_parameters_from_entry(entry)
|
226
242
|
stacked_params = stacked_attributes
|
227
|
-
entry.
|
243
|
+
ldap_entry_to_hash(entry).inject({}) do |hash, ary|
|
228
244
|
unless stacked_params.include?(ary[0]) # don't add our stacked parameters to the main param list
|
229
245
|
if ary[1].length == 1
|
230
246
|
hash[ary[0]] = ary[1].shift
|
@@ -197,19 +197,23 @@ class Puppet::Indirector::Request
|
|
197
197
|
end
|
198
198
|
|
199
199
|
# ... Fall back onto the default server.
|
200
|
-
|
200
|
+
begin
|
201
|
+
bound_server = Puppet.lookup(:server)
|
202
|
+
rescue
|
201
203
|
if primary_server = Puppet.settings[:server_list][0]
|
202
|
-
primary_server[0]
|
204
|
+
bound_server = primary_server[0]
|
203
205
|
else
|
204
|
-
Puppet.settings[:server]
|
206
|
+
bound_server = Puppet.settings[:server]
|
205
207
|
end
|
206
208
|
end
|
207
209
|
|
208
|
-
|
210
|
+
begin
|
211
|
+
bound_port = Puppet.lookup(:serverport)
|
212
|
+
rescue
|
209
213
|
if primary_server = Puppet.settings[:server_list][0]
|
210
|
-
primary_server[1]
|
214
|
+
bound_port = primary_server[1]
|
211
215
|
else
|
212
|
-
Puppet.settings[:masterport]
|
216
|
+
bound_port = Puppet.settings[:masterport]
|
213
217
|
end
|
214
218
|
end
|
215
219
|
self.server = default_server || bound_server
|