puppet 3.1.1 → 3.2.0.rc1
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.
- data/CONTRIBUTING.md +2 -2
- data/Gemfile +32 -19
- data/README_DEVELOPER.md +332 -14
- data/Rakefile +9 -5
- data/ext/build_defaults.yaml +2 -3
- data/ext/debian/changelog.erb +6 -0
- data/ext/debian/control +6 -6
- data/ext/envpuppet +4 -4
- data/ext/project_data.yaml +1 -0
- data/ext/puppet-nm-dispatcher +13 -0
- data/ext/redhat/puppet.spec.erb +17 -0
- data/ext/suse/client.init +1 -1
- data/ext/systemd/puppetagent.service +2 -2
- data/ext/systemd/puppetmaster.service +2 -2
- data/lib/hiera/scope.rb +29 -11
- data/lib/hiera_puppet.rb +1 -3
- data/lib/puppet/agent.rb +3 -3
- data/lib/puppet/application.rb +2 -2
- data/lib/puppet/application/agent.rb +27 -12
- data/lib/puppet/application/apply.rb +11 -1
- data/lib/puppet/application/describe.rb +1 -1
- data/lib/puppet/application/doc.rb +13 -9
- data/lib/puppet/application/filebucket.rb +0 -1
- data/lib/puppet/application/kick.rb +1 -0
- data/lib/puppet/application/master.rb +16 -8
- data/lib/puppet/daemon.rb +19 -64
- data/lib/puppet/defaults.rb +61 -5
- data/lib/puppet/error.rb +15 -4
- data/lib/puppet/external/nagios/grammar.ry +1 -1
- data/lib/puppet/external/nagios/makefile +1 -1
- data/lib/puppet/external/nagios/parser.rb +185 -618
- data/lib/puppet/external/pson/pure/parser.rb +47 -1
- data/lib/puppet/face/certificate.rb +3 -3
- data/lib/puppet/face/module.rb +1 -1
- data/lib/puppet/face/module/changes.rb +3 -1
- data/lib/puppet/face/module/uninstall.rb +1 -1
- data/lib/puppet/face/node/clean.rb +5 -5
- data/lib/puppet/feature/base.rb +3 -1
- data/lib/puppet/feature/libuser.rb +8 -0
- data/lib/puppet/file_serving/fileset.rb +9 -1
- data/lib/puppet/forge.rb +28 -5
- data/lib/puppet/forge/errors.rb +34 -0
- data/lib/puppet/forge/repository.rb +1 -1
- data/lib/puppet/indirector.rb +4 -1
- data/lib/puppet/indirector/catalog/compiler.rb +37 -30
- data/lib/puppet/indirector/facts/inventory_active_record.rb +1 -0
- data/lib/puppet/indirector/indirection.rb +28 -15
- data/lib/puppet/indirector/rest.rb +18 -10
- data/lib/puppet/interface.rb +11 -4
- data/lib/puppet/interface/action.rb +1 -3
- data/lib/puppet/interface/action_builder.rb +0 -3
- data/lib/puppet/interface/action_manager.rb +0 -3
- data/lib/puppet/interface/face_collection.rb +0 -2
- data/lib/puppet/interface/option.rb +0 -2
- data/lib/puppet/interface/option_builder.rb +0 -2
- data/lib/puppet/interface/option_manager.rb +0 -2
- data/lib/puppet/metatype/manager.rb +1 -1
- data/lib/puppet/module_tool.rb +1 -0
- data/lib/puppet/module_tool/applications/application.rb +0 -3
- data/lib/puppet/module_tool/applications/builder.rb +8 -20
- data/lib/puppet/module_tool/applications/checksummer.rb +1 -1
- data/lib/puppet/module_tool/applications/installer.rb +1 -0
- data/lib/puppet/module_tool/applications/unpacker.rb +3 -11
- data/lib/puppet/module_tool/checksums.rb +1 -1
- data/lib/puppet/module_tool/errors/installer.rb +18 -1
- data/lib/puppet/module_tool/modulefile.rb +2 -2
- data/lib/puppet/module_tool/skeleton/templates/generator/Modulefile.erb +1 -1
- data/lib/puppet/module_tool/tar.rb +17 -0
- data/lib/puppet/module_tool/tar/gnu.rb +9 -0
- data/lib/puppet/module_tool/tar/mini.rb +39 -0
- data/lib/puppet/module_tool/tar/solaris.rb +5 -0
- data/lib/puppet/network/http.rb +1 -0
- data/lib/puppet/network/http/connection.rb +9 -23
- data/lib/puppet/network/http/handler.rb +38 -7
- data/lib/puppet/network/http/rack/rest.rb +14 -3
- data/lib/puppet/network/http/webrick.rb +3 -1
- data/lib/puppet/network/http/webrick/rest.rb +11 -2
- data/lib/puppet/node/environment.rb +3 -1
- data/lib/puppet/parameter.rb +32 -29
- data/lib/puppet/parameter/package_options.rb +1 -1
- data/lib/puppet/parameter/path.rb +1 -1
- data/lib/puppet/parameter/value.rb +1 -1
- data/lib/puppet/parameter/value_collection.rb +7 -3
- data/lib/puppet/parser/ast.rb +3 -1
- data/lib/puppet/parser/ast/arithmetic_operator.rb +56 -12
- data/lib/puppet/parser/ast/astarray.rb +1 -1
- data/lib/puppet/parser/ast/block_expression.rb +41 -0
- data/lib/puppet/parser/ast/function.rb +13 -2
- data/lib/puppet/parser/ast/lambda.rb +107 -0
- data/lib/puppet/parser/ast/leaf.rb +1 -2
- data/lib/puppet/parser/ast/method_call.rb +77 -0
- data/lib/puppet/parser/ast/vardef.rb +7 -0
- data/lib/puppet/parser/compiler.rb +27 -16
- data/lib/puppet/parser/e_parser_adapter.rb +120 -0
- data/lib/puppet/parser/files.rb +7 -6
- data/lib/puppet/parser/functions.rb +10 -8
- data/lib/puppet/parser/functions/collect.rb +43 -0
- data/lib/puppet/parser/functions/each.rb +96 -0
- data/lib/puppet/parser/functions/foreach.rb +96 -0
- data/lib/puppet/parser/functions/fqdn_rand.rb +2 -2
- data/lib/puppet/parser/functions/hiera.rb +20 -2
- data/lib/puppet/parser/functions/hiera_array.rb +21 -2
- data/lib/puppet/parser/functions/hiera_hash.rb +23 -2
- data/lib/puppet/parser/functions/hiera_include.rb +33 -2
- data/lib/puppet/parser/functions/inline_template.rb +4 -4
- data/lib/puppet/parser/functions/reduce.rb +74 -0
- data/lib/puppet/parser/functions/reject.rb +46 -0
- data/lib/puppet/parser/functions/select.rb +46 -0
- data/lib/puppet/parser/functions/slice.rb +96 -0
- data/lib/puppet/parser/functions/template.rb +2 -2
- data/lib/puppet/parser/grammar.ra +7 -4
- data/lib/puppet/parser/lexer.rb +10 -0
- data/lib/puppet/parser/methods.rb +69 -0
- data/lib/puppet/parser/parser.rb +855 -808
- data/lib/puppet/parser/parser_factory.rb +62 -0
- data/lib/puppet/parser/parser_support.rb +8 -2
- data/lib/puppet/parser/scope.rb +153 -47
- data/lib/puppet/parser/templatewrapper.rb +28 -21
- data/lib/puppet/parser/type_loader.rb +3 -1
- data/lib/puppet/pops.rb +40 -0
- data/lib/puppet/pops/adaptable.rb +190 -0
- data/lib/puppet/pops/adapters.rb +65 -0
- data/lib/puppet/pops/containment.rb +37 -0
- data/lib/puppet/pops/issues.rb +258 -0
- data/lib/puppet/pops/label_provider.rb +71 -0
- data/lib/puppet/pops/model/ast_transformer.rb +636 -0
- data/lib/puppet/pops/model/ast_tree_dumper.rb +378 -0
- data/lib/puppet/pops/model/factory.rb +804 -0
- data/lib/puppet/pops/model/model.rb +567 -0
- data/lib/puppet/pops/model/model_label_provider.rb +75 -0
- data/lib/puppet/pops/model/model_tree_dumper.rb +352 -0
- data/lib/puppet/pops/model/tree_dumper.rb +59 -0
- data/lib/puppet/pops/parser/egrammar.ra +723 -0
- data/lib/puppet/pops/parser/eparser.rb +2300 -0
- data/lib/puppet/pops/parser/grammar.ra +746 -0
- data/lib/puppet/pops/parser/lexer.rb +842 -0
- data/lib/puppet/pops/parser/makefile +13 -0
- data/lib/puppet/pops/parser/parser_support.rb +203 -0
- data/lib/puppet/pops/patterns.rb +35 -0
- data/lib/puppet/pops/utils.rb +104 -0
- data/lib/puppet/pops/validation.rb +297 -0
- data/lib/puppet/pops/validation/checker3_1.rb +551 -0
- data/lib/puppet/pops/validation/validator_factory_3_1.rb +41 -0
- data/lib/puppet/pops/visitable.rb +6 -0
- data/lib/puppet/pops/visitor.rb +50 -0
- data/lib/puppet/property.rb +37 -28
- data/lib/puppet/property/ensure.rb +2 -2
- data/lib/puppet/property/ordered_list.rb +1 -1
- data/lib/puppet/provider.rb +26 -30
- data/lib/puppet/provider/aixobject.rb +45 -44
- data/lib/puppet/provider/augeas/augeas.rb +0 -1
- data/lib/puppet/provider/confiner.rb +1 -1
- data/lib/puppet/provider/cron/crontab.rb +107 -67
- data/lib/puppet/provider/group/groupadd.rb +59 -3
- data/lib/puppet/provider/interface/cisco.rb +4 -4
- data/lib/puppet/provider/mount/parsed.rb +1 -1
- data/lib/puppet/provider/nameservice.rb +22 -6
- data/lib/puppet/provider/nameservice/pw.rb +1 -1
- data/lib/puppet/provider/package/aix.rb +28 -4
- data/lib/puppet/provider/package/gem.rb +0 -2
- data/lib/puppet/provider/package/macports.rb +1 -1
- data/lib/puppet/provider/package/nim.rb +249 -4
- data/lib/puppet/provider/package/opkg.rb +77 -0
- data/lib/puppet/provider/package/pacman.rb +2 -2
- data/lib/puppet/provider/package/rpm.rb +30 -16
- data/lib/puppet/provider/package/yum.rb +3 -3
- data/lib/puppet/provider/parsedfile.rb +80 -3
- data/lib/puppet/provider/selmodule/semodule.rb +2 -2
- data/lib/puppet/provider/service/debian.rb +0 -4
- data/lib/puppet/provider/service/freebsd.rb +2 -2
- data/lib/puppet/provider/service/gentoo.rb +0 -9
- data/lib/puppet/provider/service/init.rb +27 -2
- data/lib/puppet/provider/service/launchd.rb +1 -1
- data/lib/puppet/provider/service/openwrt.rb +36 -0
- data/lib/puppet/provider/service/redhat.rb +0 -9
- data/lib/puppet/provider/service/src.rb +38 -4
- data/lib/puppet/provider/service/systemd.rb +2 -2
- data/lib/puppet/provider/service/upstart.rb +1 -8
- data/lib/puppet/provider/user/aix.rb +4 -10
- data/lib/puppet/provider/user/pw.rb +6 -10
- data/lib/puppet/provider/user/useradd.rb +129 -31
- data/lib/puppet/provider/vlan/cisco.rb +4 -4
- data/lib/puppet/reference/function.rb +2 -2
- data/lib/puppet/reference/indirection.rb +46 -5
- data/lib/puppet/reference/metaparameter.rb +2 -2
- data/lib/puppet/reports.rb +5 -5
- data/lib/puppet/reports/rrdgraph.rb +4 -4
- data/lib/puppet/reports/tagmail.rb +1 -1
- data/lib/puppet/resource.rb +1 -1
- data/lib/puppet/resource/type.rb +13 -11
- data/lib/puppet/scheduler.rb +16 -0
- data/lib/puppet/scheduler/job.rb +53 -0
- data/lib/puppet/scheduler/scheduler.rb +45 -0
- data/lib/puppet/scheduler/splay_job.rb +32 -0
- data/lib/puppet/scheduler/timer.rb +13 -0
- data/lib/puppet/settings/base_setting.rb +1 -1
- data/lib/puppet/simple_graph.rb +4 -4
- data/lib/puppet/ssl/base.rb +12 -2
- data/lib/puppet/ssl/certificate.rb +4 -1
- data/lib/puppet/ssl/certificate_request.rb +4 -1
- data/lib/puppet/ssl/certificate_revocation_list.rb +4 -1
- data/lib/puppet/ssl/configuration.rb +32 -0
- data/lib/puppet/ssl/host.rb +18 -21
- data/lib/puppet/ssl/key.rb +4 -1
- data/lib/puppet/ssl/validator.rb +116 -0
- data/lib/puppet/transaction.rb +1 -1
- data/lib/puppet/transaction/event.rb +3 -10
- data/lib/puppet/transaction/event_manager.rb +8 -1
- data/lib/puppet/transaction/report.rb +17 -16
- data/lib/puppet/type.rb +77 -69
- data/lib/puppet/type/cron.rb +20 -8
- data/lib/puppet/type/exec.rb +9 -3
- data/lib/puppet/type/file.rb +95 -21
- data/lib/puppet/type/file/content.rb +1 -1
- data/lib/puppet/type/file/mode.rb +7 -1
- data/lib/puppet/type/file/source.rb +2 -2
- data/lib/puppet/type/group.rb +11 -0
- data/lib/puppet/type/scheduled_task.rb +5 -1
- data/lib/puppet/type/service.rb +1 -1
- data/lib/puppet/type/ssh_authorized_key.rb +2 -2
- data/lib/puppet/type/user.rb +24 -6
- data/lib/puppet/util.rb +12 -2
- data/lib/puppet/util/classgen.rb +4 -4
- data/lib/puppet/util/colors.rb +55 -0
- data/lib/puppet/util/command_line/trollop.rb +4 -4
- data/lib/puppet/util/errors.rb +39 -3
- data/lib/puppet/util/fileparsing.rb +5 -0
- data/lib/puppet/util/filetype.rb +11 -9
- data/lib/puppet/util/instrumentation/instrumentable.rb +2 -2
- data/lib/puppet/util/libuser.conf +15 -0
- data/lib/puppet/util/libuser.rb +12 -0
- data/lib/puppet/util/monkey_patches.rb +48 -0
- data/lib/puppet/util/network_device.rb +1 -1
- data/lib/puppet/util/network_device/base.rb +2 -2
- data/lib/puppet/util/network_device/cisco/device.rb +29 -19
- data/lib/puppet/util/network_device/config.rb +5 -2
- data/lib/puppet/util/network_device/ipcalc.rb +1 -1
- data/lib/puppet/util/network_device/transport/ssh.rb +4 -3
- data/lib/puppet/util/network_device/transport/telnet.rb +4 -2
- data/lib/puppet/util/plugins.rb +4 -4
- data/lib/puppet/util/posix.rb +1 -1
- data/lib/puppet/util/profiler.rb +28 -0
- data/lib/puppet/util/profiler/logging.rb +47 -0
- data/lib/puppet/util/profiler/none.rb +8 -0
- data/lib/puppet/util/profiler/object_counts.rb +17 -0
- data/lib/puppet/util/profiler/wall_clock.rb +34 -0
- data/lib/puppet/util/provider_features.rb +1 -1
- data/lib/puppet/util/rdoc/parser.rb +5 -5
- data/lib/puppet/util/ssl.rb +38 -0
- data/lib/puppet/util/subclass_loader.rb +1 -5
- data/lib/puppet/util/windows.rb +1 -0
- data/lib/puppet/util/windows/process.rb +3 -0
- data/lib/puppet/util/windows/root_certs.rb +86 -0
- data/lib/puppet/util/windows/security.rb +1 -0
- data/lib/puppet/version.rb +1 -1
- data/spec/fixtures/integration/provider/cron/crontab/create_normal_entry +19 -0
- data/spec/fixtures/integration/provider/cron/crontab/create_special_entry +18 -0
- data/spec/fixtures/integration/provider/cron/crontab/crontab_user1 +15 -0
- data/spec/fixtures/integration/provider/cron/crontab/crontab_user2 +4 -0
- data/spec/fixtures/integration/provider/cron/crontab/modify_entry +13 -0
- data/spec/fixtures/integration/provider/cron/crontab/moved_cronjob_input1 +15 -0
- data/spec/fixtures/integration/provider/cron/crontab/moved_cronjob_input2 +6 -0
- data/spec/fixtures/integration/provider/cron/crontab/remove_named_resource +12 -0
- data/spec/fixtures/integration/provider/cron/crontab/remove_unnamed_resource +14 -0
- data/spec/fixtures/unit/pops/parser/lexer/aliastest.pp +16 -0
- data/spec/fixtures/unit/pops/parser/lexer/append.pp +11 -0
- data/spec/fixtures/unit/pops/parser/lexer/argumentdefaults.pp +14 -0
- data/spec/fixtures/unit/pops/parser/lexer/arithmetic_expression.pp +8 -0
- data/spec/fixtures/unit/pops/parser/lexer/arraytrailingcomma.pp +3 -0
- data/spec/fixtures/unit/pops/parser/lexer/casestatement.pp +65 -0
- data/spec/fixtures/unit/pops/parser/lexer/classheirarchy.pp +15 -0
- data/spec/fixtures/unit/pops/parser/lexer/classincludes.pp +17 -0
- data/spec/fixtures/unit/pops/parser/lexer/classpathtest.pp +11 -0
- data/spec/fixtures/unit/pops/parser/lexer/collection.pp +10 -0
- data/spec/fixtures/unit/pops/parser/lexer/collection_override.pp +8 -0
- data/spec/fixtures/unit/pops/parser/lexer/collection_within_virtual_definitions.pp +20 -0
- data/spec/fixtures/unit/pops/parser/lexer/componentmetaparams.pp +11 -0
- data/spec/fixtures/unit/pops/parser/lexer/componentrequire.pp +8 -0
- data/spec/fixtures/unit/pops/parser/lexer/deepclassheirarchy.pp +23 -0
- data/spec/fixtures/unit/pops/parser/lexer/defineoverrides.pp +17 -0
- data/spec/fixtures/unit/pops/parser/lexer/emptyclass.pp +9 -0
- data/spec/fixtures/unit/pops/parser/lexer/emptyexec.pp +3 -0
- data/spec/fixtures/unit/pops/parser/lexer/emptyifelse.pp +9 -0
- data/spec/fixtures/unit/pops/parser/lexer/falsevalues.pp +3 -0
- data/spec/fixtures/unit/pops/parser/lexer/filecreate.pp +11 -0
- data/spec/fixtures/unit/pops/parser/lexer/fqdefinition.pp +5 -0
- data/spec/fixtures/unit/pops/parser/lexer/fqparents.pp +11 -0
- data/spec/fixtures/unit/pops/parser/lexer/funccomma.pp +5 -0
- data/spec/fixtures/unit/pops/parser/lexer/hash.pp +33 -0
- data/spec/fixtures/unit/pops/parser/lexer/ifexpression.pp +12 -0
- data/spec/fixtures/unit/pops/parser/lexer/implicititeration.pp +15 -0
- data/spec/fixtures/unit/pops/parser/lexer/multilinecomments.pp +10 -0
- data/spec/fixtures/unit/pops/parser/lexer/multipleclass.pp +9 -0
- data/spec/fixtures/unit/pops/parser/lexer/multipleinstances.pp +7 -0
- data/spec/fixtures/unit/pops/parser/lexer/multisubs.pp +13 -0
- data/spec/fixtures/unit/pops/parser/lexer/namevartest.pp +9 -0
- data/spec/fixtures/unit/pops/parser/lexer/scopetest.pp +13 -0
- data/spec/fixtures/unit/pops/parser/lexer/selectorvalues.pp +49 -0
- data/spec/fixtures/unit/pops/parser/lexer/simpledefaults.pp +5 -0
- data/spec/fixtures/unit/pops/parser/lexer/simpleselector.pp +38 -0
- data/spec/fixtures/unit/pops/parser/lexer/singleary.pp +19 -0
- data/spec/fixtures/unit/pops/parser/lexer/singlequote.pp +11 -0
- data/spec/fixtures/unit/pops/parser/lexer/singleselector.pp +22 -0
- data/spec/fixtures/unit/pops/parser/lexer/subclass_name_duplication.pp +11 -0
- data/spec/fixtures/unit/pops/parser/lexer/tag.pp +9 -0
- data/spec/fixtures/unit/pops/parser/lexer/tagged.pp +35 -0
- data/spec/fixtures/unit/pops/parser/lexer/virtualresources.pp +14 -0
- data/spec/fixtures/unit/provider/cron/crontab/single_line.yaml +4 -4
- data/spec/fixtures/unit/provider/cron/crontab/vixie_header.txt +3 -0
- data/spec/fixtures/unit/provider/cron/parsed/managed +6 -0
- data/spec/fixtures/unit/provider/cron/parsed/simple +9 -0
- data/spec/fixtures/unit/provider/parsedfile/simple.txt +4 -0
- data/spec/fixtures/unit/provider/service/systemd/list_units +18 -0
- data/spec/integration/parser/collector_spec.rb +1 -1
- data/spec/integration/parser/compiler_spec.rb +252 -227
- data/spec/integration/parser/parser_spec.rb +171 -53
- data/spec/integration/parser/scope_spec.rb +1 -1
- data/spec/integration/provider/cron/crontab_spec.rb +187 -0
- data/spec/integration/provider/service/systemd_spec.rb +20 -0
- data/spec/integration/type/file_spec.rb +21 -21
- data/spec/integration/type/package_spec.rb +1 -1
- data/spec/lib/puppet_spec/database.rb +2 -5
- data/spec/spec_helper.rb +6 -1
- data/spec/unit/application/apply_spec.rb +16 -1
- data/spec/unit/application/describe_spec.rb +1 -1
- data/spec/unit/application/doc_spec.rb +55 -32
- data/spec/unit/application/kick_spec.rb +8 -6
- data/spec/unit/application/master_spec.rb +4 -4
- data/spec/unit/daemon_spec.rb +1 -1
- data/spec/unit/forge/errors_spec.rb +40 -0
- data/spec/unit/forge/repository_spec.rb +11 -1
- data/spec/unit/forge_spec.rb +13 -3
- data/spec/unit/hiera/backend/puppet_backend_spec.rb +1 -0
- data/spec/unit/hiera/scope_spec.rb +48 -25
- data/spec/unit/indirector/catalog/active_record_spec.rb +6 -3
- data/spec/unit/indirector/catalog/compiler_spec.rb +3 -28
- data/spec/unit/indirector/catalog/static_compiler_spec.rb +1 -1
- data/spec/unit/indirector/facts/inventory_active_record_spec.rb +154 -150
- data/spec/unit/indirector/indirection_spec.rb +5 -0
- data/spec/unit/indirector/resource/active_record_spec.rb +5 -22
- data/spec/unit/indirector_spec.rb +7 -1
- data/spec/unit/interface/action_builder_spec.rb +1 -1
- data/spec/unit/interface/action_manager_spec.rb +0 -2
- data/spec/unit/interface/action_spec.rb +1 -1
- data/spec/unit/interface/documentation_spec.rb +0 -2
- data/spec/unit/interface/face_collection_spec.rb +1 -1
- data/spec/unit/interface/option_builder_spec.rb +1 -1
- data/spec/unit/interface/option_spec.rb +0 -1
- data/spec/unit/module_spec.rb +17 -19
- data/spec/unit/module_tool/application_spec.rb +1 -3
- data/spec/unit/module_tool/applications/builder_spec.rb +38 -0
- data/spec/unit/module_tool/applications/checksummer_spec.rb +134 -0
- data/spec/unit/module_tool/applications/installer_spec.rb +71 -91
- data/spec/unit/module_tool/applications/searcher_spec.rb +1 -3
- data/spec/unit/module_tool/applications/uninstaller_spec.rb +18 -26
- data/spec/unit/module_tool/applications/unpacker_spec.rb +19 -52
- data/spec/unit/module_tool/tar/gnu_spec.rb +19 -0
- data/spec/unit/module_tool/tar/mini_spec.rb +59 -0
- data/spec/unit/module_tool/tar/solaris_spec.rb +19 -0
- data/spec/unit/network/http/connection_spec.rb +17 -2
- data/spec/unit/network/http/handler_spec.rb +195 -167
- data/spec/unit/network/http/rack/rest_spec.rb +26 -4
- data/spec/unit/network/http/webrick/rest_spec.rb +28 -1
- data/spec/unit/network/http/webrick_spec.rb +12 -3
- data/spec/unit/node/environment_spec.rb +421 -404
- data/spec/unit/parser/ast/arithmetic_operator_spec.rb +98 -2
- data/spec/unit/parser/collector_spec.rb +4 -4
- data/spec/unit/parser/compiler_spec.rb +13 -13
- data/spec/unit/parser/eparser_adapter_spec.rb +407 -0
- data/spec/unit/parser/functions/extlookup_spec.rb +20 -17
- data/spec/unit/parser/functions/fqdn_rand_spec.rb +5 -0
- data/spec/unit/parser/functions/hiera_include_spec.rb +0 -2
- data/spec/unit/parser/functions/hiera_spec.rb +0 -2
- data/spec/unit/parser/functions_spec.rb +27 -15
- data/spec/unit/parser/methods/collect_spec.rb +110 -0
- data/spec/unit/parser/methods/each_spec.rb +91 -0
- data/spec/unit/parser/methods/foreach_spec.rb +91 -0
- data/spec/unit/parser/methods/reduce_spec.rb +67 -0
- data/spec/unit/parser/methods/reject_spec.rb +73 -0
- data/spec/unit/parser/methods/select_spec.rb +79 -0
- data/spec/unit/parser/methods/shared.rb +61 -0
- data/spec/unit/parser/methods/slice_spec.rb +97 -0
- data/spec/unit/parser/parser_spec.rb +2 -2
- data/spec/unit/parser/scope_spec.rb +39 -16
- data/spec/unit/parser/templatewrapper_spec.rb +6 -5
- data/spec/unit/parser/type_loader_spec.rb +191 -165
- data/spec/unit/pops/adaptable_spec.rb +143 -0
- data/spec/unit/pops/containment_spec.rb +25 -0
- data/spec/unit/pops/factory_rspec_helper.rb +77 -0
- data/spec/unit/pops/factory_spec.rb +329 -0
- data/spec/unit/pops/issues_spec.rb +26 -0
- data/spec/unit/pops/label_provider_spec.rb +42 -0
- data/spec/unit/pops/model/ast_transformer_spec.rb +65 -0
- data/spec/unit/pops/model/model_spec.rb +37 -0
- data/spec/unit/pops/parser/lexer_spec.rb +884 -0
- data/spec/unit/pops/parser/parse_basic_expressions_spec.rb +248 -0
- data/spec/unit/pops/parser/parse_calls_spec.rb +93 -0
- data/spec/unit/pops/parser/parse_conditionals_spec.rb +159 -0
- data/spec/unit/pops/parser/parse_containers_spec.rb +175 -0
- data/spec/unit/pops/parser/parse_resource_spec.rb +228 -0
- data/spec/unit/pops/parser/parser_rspec_helper.rb +11 -0
- data/spec/unit/pops/parser/parser_spec.rb +15 -0
- data/spec/unit/pops/parser/rgen_sanitycheck_spec.rb +16 -0
- data/spec/unit/pops/transformer/transform_basic_expressions_spec.rb +243 -0
- data/spec/unit/pops/transformer/transform_calls_spec.rb +80 -0
- data/spec/unit/pops/transformer/transform_conditionals_spec.rb +132 -0
- data/spec/unit/pops/transformer/transform_containers_spec.rb +182 -0
- data/spec/unit/pops/transformer/transform_resource_spec.rb +185 -0
- data/spec/unit/pops/transformer/transformer_rspec_helper.rb +27 -0
- data/spec/unit/pops/visitor_spec.rb +94 -0
- data/spec/unit/property_spec.rb +11 -0
- data/spec/unit/provider/augeas/augeas_spec.rb +3 -0
- data/spec/unit/provider/cron/crontab_spec.rb +97 -7
- data/spec/unit/provider/cron/parsed_spec.rb +325 -0
- data/spec/unit/provider/exec/posix_spec.rb +1 -1
- data/spec/unit/provider/group/groupadd_spec.rb +33 -3
- data/spec/unit/provider/group/pw_spec.rb +5 -5
- data/spec/unit/provider/nameservice_spec.rb +304 -0
- data/spec/unit/provider/package/aix_spec.rb +53 -11
- data/spec/unit/provider/package/aptrpm_spec.rb +6 -0
- data/spec/unit/provider/package/gem_spec.rb +6 -11
- data/spec/unit/provider/package/nim_spec.rb +216 -7
- data/spec/unit/provider/package/opkg_spec.rb +180 -0
- data/spec/unit/provider/package/rpm_spec.rb +149 -3
- data/spec/unit/provider/package/yum_spec.rb +6 -5
- data/spec/unit/provider/parsedfile_spec.rb +122 -28
- data/spec/unit/provider/service/freebsd_spec.rb +18 -0
- data/spec/unit/provider/service/init_spec.rb +108 -87
- data/spec/unit/provider/service/launchd_spec.rb +2 -2
- data/spec/unit/provider/service/openwrt_spec.rb +109 -0
- data/spec/unit/provider/service/src_spec.rb +117 -41
- data/spec/unit/provider/service/systemd_spec.rb +125 -17
- data/spec/unit/provider/service/upstart_spec.rb +1 -1
- data/spec/unit/provider/user/aix_spec.rb +42 -0
- data/spec/unit/provider/user/directoryservice_spec.rb +1 -0
- data/spec/unit/provider/user/pw_spec.rb +24 -12
- data/spec/unit/provider/user/user_role_add_spec.rb +1 -1
- data/spec/unit/provider/user/useradd_spec.rb +179 -15
- data/spec/unit/resource/type_spec.rb +3 -3
- data/spec/unit/scheduler/job_spec.rb +79 -0
- data/spec/unit/scheduler/scheduler_spec.rb +129 -0
- data/spec/unit/scheduler/splay_job_spec.rb +35 -0
- data/spec/unit/ssl/base_spec.rb +3 -9
- data/spec/unit/ssl/certificate_authority_spec.rb +1 -0
- data/spec/unit/ssl/certificate_request_spec.rb +3 -1
- data/spec/unit/ssl/certificate_spec.rb +3 -1
- data/spec/unit/ssl/configuration_spec.rb +74 -0
- data/spec/unit/ssl/host_spec.rb +28 -7
- data/spec/unit/ssl/validator_spec.rb +311 -0
- data/spec/unit/transaction/event_manager_spec.rb +49 -0
- data/spec/unit/transaction/event_spec.rb +20 -5
- data/spec/unit/transaction/report_spec.rb +8 -0
- data/spec/unit/type/cron_spec.rb +9 -0
- data/spec/unit/type/exec_spec.rb +11 -0
- data/spec/unit/type/file/content_spec.rb +20 -20
- data/spec/unit/type/file/mode_spec.rb +6 -0
- data/spec/unit/type/file/source_spec.rb +9 -7
- data/spec/unit/type/file_spec.rb +22 -3
- data/spec/unit/type/service_spec.rb +34 -21
- data/spec/unit/type_spec.rb +46 -1
- data/spec/unit/util/backups_spec.rb +2 -2
- data/spec/unit/util/execution_spec.rb +4 -1
- data/spec/unit/util/filetype_spec.rb +6 -0
- data/spec/unit/util/monkey_patches_spec.rb +18 -0
- data/spec/unit/util/network_device/cisco/device_spec.rb +37 -0
- data/spec/unit/util/network_device/config_spec.rb +14 -0
- data/spec/unit/util/network_device_spec.rb +3 -3
- data/spec/unit/util/profiler/logging_spec.rb +81 -0
- data/spec/unit/util/profiler/none_spec.rb +12 -0
- data/spec/unit/util/profiler/object_counts_spec.rb +14 -0
- data/spec/unit/util/profiler/wall_clock_spec.rb +13 -0
- data/spec/unit/util/pson_spec.rb +5 -0
- data/spec/unit/util/ssl_spec.rb +51 -0
- data/spec/unit/util/windows/root_certs_spec.rb +15 -0
- data/spec/unit/util_spec.rb +28 -0
- metadata +2593 -2307
- data/spec/unit/module_tool/applications/application_spec.rb +0 -19
@@ -0,0 +1,41 @@
|
|
1
|
+
# Configures validation suitable for 3.1 + iteration
|
2
|
+
#
|
3
|
+
class Puppet::Pops::Validation::ValidatorFactory_3_1
|
4
|
+
Issues = Puppet::Pops::Issues
|
5
|
+
|
6
|
+
# Produces a validator with the given acceptor as the recipient of produced diagnostics.
|
7
|
+
#
|
8
|
+
def validator acceptor
|
9
|
+
checker(diagnostic_producer(acceptor))
|
10
|
+
end
|
11
|
+
|
12
|
+
# Produces the diagnostics producer to use given an acceptor as the recipient of produced diagnostics
|
13
|
+
#
|
14
|
+
def diagnostic_producer acceptor
|
15
|
+
Puppet::Pops::Validation::DiagnosticProducer.new(acceptor, severity_producer(), label_provider())
|
16
|
+
end
|
17
|
+
|
18
|
+
# Produces the checker to use
|
19
|
+
def checker diagnostic_producer
|
20
|
+
Puppet::Pops::Validation::Checker3_1.new(diagnostic_producer)
|
21
|
+
end
|
22
|
+
|
23
|
+
# Produces the label provider to use
|
24
|
+
def label_provider
|
25
|
+
Puppet::Pops::Model::ModelLabelProvider.new()
|
26
|
+
end
|
27
|
+
|
28
|
+
# Produces the severity producer to use
|
29
|
+
def severity_producer
|
30
|
+
p = Puppet::Pops::Validation::SeverityProducer.new
|
31
|
+
|
32
|
+
# Configure each issue that should **not** be an error
|
33
|
+
#
|
34
|
+
p[Issues::RT_NO_STORECONFIGS_EXPORT] = :warning
|
35
|
+
p[Issues::RT_NO_STORECONFIGS] = :warning
|
36
|
+
p[Issues::NAME_WITH_HYPHEN] = :deprecation
|
37
|
+
p[Issues::DEPRECATED_NAME_AS_TYPE] = :deprecation
|
38
|
+
|
39
|
+
p
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# A Visitor performs delegation to a given receiver based on the configuration of the Visitor.
|
2
|
+
# A new visitor is created with a given receiver, a method prefix, min, and max argument counts.
|
3
|
+
# e.g.
|
4
|
+
# vistor = Visitor.new(self, "visit_from", 1, 1)
|
5
|
+
# will make the visitor call "self.visit_from_CLASS(x)" where CLASS is resolved to the given
|
6
|
+
# objects class, or one of is ancestors, the first class for which there is an implementation of
|
7
|
+
# a method will be selected.
|
8
|
+
#
|
9
|
+
# Raises RuntimeError if there are too few or too many arguments, or if the receiver is not
|
10
|
+
# configured to handle a given visiting object.
|
11
|
+
#
|
12
|
+
class Puppet::Pops::Visitor
|
13
|
+
attr_reader :receiver, :message, :min_args, :max_args, :cache
|
14
|
+
def initialize(receiver, message, min_args=0, max_args=nil)
|
15
|
+
raise ArgumentError.new("min_args must be >= 0") if min_args < 0
|
16
|
+
raise ArgumentError.new("max_args must be >= min_args or nil") if max_args && max_args < min_args
|
17
|
+
|
18
|
+
@receiver = receiver
|
19
|
+
@message = message
|
20
|
+
@min_args = min_args
|
21
|
+
@max_args = max_args
|
22
|
+
@cache = Hash.new
|
23
|
+
end
|
24
|
+
|
25
|
+
# Visit the configured receiver
|
26
|
+
def visit(thing, *args)
|
27
|
+
visit_this(@receiver, thing, *args)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Visit an explicit receiver
|
31
|
+
def visit_this(receiver, thing, *args)
|
32
|
+
raise "Visitor Error: Too few arguments passed. min = #{@min_args}" unless args.length >= @min_args
|
33
|
+
if @max_args
|
34
|
+
raise "Visitor Error: Too many arguments passed. max = #{@max_args}" unless args.length <= @max_args
|
35
|
+
end
|
36
|
+
if method_name = @cache[thing.class]
|
37
|
+
return receiver.send(method_name, thing, *args)
|
38
|
+
else
|
39
|
+
thing.class.ancestors().each do |ancestor|
|
40
|
+
method_name = :"#{@message}_#{ancestor.name.split("::").last}"
|
41
|
+
# DEBUG OUTPUT
|
42
|
+
# puts "Visitor checking: #{receiver.class}.#{method_name}, responds to: #{@receiver.respond_to? method_name}"
|
43
|
+
next unless receiver.respond_to? method_name
|
44
|
+
@cache[thing.class] = method_name
|
45
|
+
return receiver.send(method_name, thing, *args)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
raise "Visitor Error: the configured receiver (#{receiver.class}) can't handle instance of: #{thing.class}"
|
49
|
+
end
|
50
|
+
end
|
data/lib/puppet/property.rb
CHANGED
@@ -18,11 +18,11 @@ require 'puppet/parameter'
|
|
18
18
|
# value _(should)_ is read and written with the methods {#value} and {#value=} which delegate to
|
19
19
|
# {#should} and {#should=}, i.e. when a property is used like any other parameter, it is the _should_ value
|
20
20
|
# that is operated on.
|
21
|
-
#
|
21
|
+
#
|
22
22
|
# All resource type properties in the puppet system are derived from this class.
|
23
23
|
#
|
24
24
|
# The intention is that new parameters are created by using the DSL method {Puppet::Type.newproperty}.
|
25
|
-
#
|
25
|
+
#
|
26
26
|
# @abstract
|
27
27
|
# @note Properties of Types are expressed using subclasses of this class. Such a class describes one
|
28
28
|
# named property of a particular Type (as opposed to describing a type of property in general). This
|
@@ -35,12 +35,12 @@ require 'puppet/parameter'
|
|
35
35
|
#
|
36
36
|
# @todo Describe meta-parameter shadowing. This concept can not be understood by just looking at the descriptions
|
37
37
|
# of the methods involved.
|
38
|
-
#
|
38
|
+
#
|
39
39
|
# @see Puppet::Type
|
40
40
|
# @see Puppet::Parameter
|
41
41
|
#
|
42
42
|
# @api public
|
43
|
-
#
|
43
|
+
#
|
44
44
|
class Puppet::Property < Puppet::Parameter
|
45
45
|
require 'puppet/property/ensure'
|
46
46
|
|
@@ -52,9 +52,9 @@ class Puppet::Property < Puppet::Parameter
|
|
52
52
|
|
53
53
|
# The noop mode for this property.
|
54
54
|
# By setting a property's noop mode to `true`, any management of this property is inhibited. Calculation
|
55
|
-
# and reporting still takes place, but if a change of the underlying managed entity's state
|
55
|
+
# and reporting still takes place, but if a change of the underlying managed entity's state
|
56
56
|
# should take place it will not be carried out. This noop
|
57
|
-
# setting overrides the overall `Puppet[:noop]` mode as well as the noop mode in the _associated resource_
|
57
|
+
# setting overrides the overall `Puppet[:noop]` mode as well as the noop mode in the _associated resource_
|
58
58
|
#
|
59
59
|
attr_writer :noop
|
60
60
|
|
@@ -63,21 +63,21 @@ class Puppet::Property < Puppet::Parameter
|
|
63
63
|
# reads or writes this attribute.
|
64
64
|
# ??? Probably Unused
|
65
65
|
attr_accessor :unmanaged
|
66
|
-
|
66
|
+
|
67
67
|
# @return [Symbol] The name of the property as given when the property was created.
|
68
|
-
#
|
68
|
+
#
|
69
69
|
attr_reader :name
|
70
70
|
|
71
71
|
# @!attribute [rw] array_matching
|
72
72
|
# @comment note that $#46; is a period - char code require to not terminate sentence.
|
73
73
|
# The `is` vs. `should` array matching mode; `:first`, or `:all`.
|
74
|
-
#
|
74
|
+
#
|
75
75
|
# @comment there are two blank chars after the symbols to cause a break - do not remove these.
|
76
|
-
# * `:first`
|
76
|
+
# * `:first`
|
77
77
|
# This is primarily used for single value properties. When matched against an array of values
|
78
78
|
# a match is true if the `is` value matches any of the values in the `should` array. When the `is` value
|
79
79
|
# is also an array, the matching is performed against the entire array as the `is` value.
|
80
|
-
# * `:all`
|
80
|
+
# * `:all`
|
81
81
|
# : This is primarily used for multi-valued properties. When matched against an array of
|
82
82
|
# `should` values, the size of `is` and `should` must be the same, and all values in `is` must match
|
83
83
|
# a value in `should`.
|
@@ -104,7 +104,7 @@ class Puppet::Property < Puppet::Parameter
|
|
104
104
|
end
|
105
105
|
|
106
106
|
# Looks up a value's name among valid values, to enable option lookup with result as a key.
|
107
|
-
# @param name [Object] the parameter value to match against valid values (names).
|
107
|
+
# @param name [Object] the parameter value to match against valid values (names).
|
108
108
|
# @return {Symbol, Regexp} a value matching predicate
|
109
109
|
# @api private
|
110
110
|
#
|
@@ -142,6 +142,10 @@ class Puppet::Property < Puppet::Parameter
|
|
142
142
|
# was possible to specify a value of `:before` or `:after` for the purpose of calling
|
143
143
|
# both the block and the provider. Use of these deprecated options will now raise an exception later
|
144
144
|
# in the process when the _is_ value is set (see #set).
|
145
|
+
# @option options [Symbol] :invalidate_refreshes Indicates a change on this property should invalidate and
|
146
|
+
# remove any scheduled refreshes (from notify or subscribe) targeted at the same resource. For example, if
|
147
|
+
# a change in this property takes into account any changes that a scheduled refresh would have performed,
|
148
|
+
# then the scheduled refresh would be deleted.
|
145
149
|
# @option options [Object] any Any other option is treated as a call to a setter having the given
|
146
150
|
# option name (e.g. `:required_features` calls `required_features=` with the option's value as an
|
147
151
|
# argument).
|
@@ -160,7 +164,7 @@ class Puppet::Property < Puppet::Parameter
|
|
160
164
|
value
|
161
165
|
end
|
162
166
|
|
163
|
-
# Calls the provider setter method for this property with the given value as argument.
|
167
|
+
# Calls the provider setter method for this property with the given value as argument.
|
164
168
|
# @return [Object] what the provider returns when calling a setter for this property's name
|
165
169
|
# @raise [Puppet::Error] when the provider can not handle this property.
|
166
170
|
# @see #set
|
@@ -254,18 +258,23 @@ class Puppet::Property < Puppet::Parameter
|
|
254
258
|
|
255
259
|
# Produces an event describing a change of this property.
|
256
260
|
# In addition to the event attributes set by the resource type, this method adds:
|
257
|
-
#
|
261
|
+
#
|
258
262
|
# * `:name` - the event_name
|
259
263
|
# * `:desired_value` - a.k.a _should_ or _wanted value_
|
260
264
|
# * `:property` - reference to this property
|
261
265
|
# * `:source_description` - the _path_ (?? See todo)
|
266
|
+
# * `:invalidate_refreshes` - if scheduled refreshes should be invalidated
|
262
267
|
#
|
263
268
|
# @todo What is the intent of this method? What is the meaning of the :source_description passed in the
|
264
269
|
# options to the created event?
|
265
|
-
# @return [Puppet::Transaction::Event] the created event
|
270
|
+
# @return [Puppet::Transaction::Event] the created event
|
266
271
|
# @see Puppet::Type#event
|
267
272
|
def event
|
268
|
-
|
273
|
+
attrs = { :name => event_name, :desired_value => should, :property => self, :source_description => path }
|
274
|
+
if should and value = self.class.value_collection.match?(should)
|
275
|
+
attrs[:invalidate_refreshes] = true if value.invalidate_refreshes
|
276
|
+
end
|
277
|
+
resource.event attrs
|
269
278
|
end
|
270
279
|
|
271
280
|
# @todo What is this?
|
@@ -274,9 +283,9 @@ class Puppet::Property < Puppet::Parameter
|
|
274
283
|
|
275
284
|
# Initializes a Property the same way as a Parameter and handles the special case when a property is shadowing a meta-parameter.
|
276
285
|
# @todo There is some special initialization when a property is not a metaparameter but
|
277
|
-
# Puppet::Type.metaparamclass(for this class's name) is not nil - if that is the case a
|
286
|
+
# Puppet::Type.metaparamclass(for this class's name) is not nil - if that is the case a
|
278
287
|
# setup_shadow is performed for that class.
|
279
|
-
#
|
288
|
+
#
|
280
289
|
# @param hash [Hash] options passed to the super initializer {Puppet::Parameter#initialize}
|
281
290
|
# @note New properties of a type should be created via the DSL method {Puppet::Type.newproperty}.
|
282
291
|
# @see Puppet::Parameter#initialize description of Parameter initialize options.
|
@@ -372,11 +381,11 @@ class Puppet::Property < Puppet::Parameter
|
|
372
381
|
|
373
382
|
# Checks if the given current and desired values are equal.
|
374
383
|
# This default implementation performs this check in a backwards compatible way where
|
375
|
-
# the equality of the two values is checked, and then the equality of current with desired
|
384
|
+
# the equality of the two values is checked, and then the equality of current with desired
|
376
385
|
# converted to a string.
|
377
|
-
#
|
386
|
+
#
|
378
387
|
# A derived implementation may override this method to perform a property specific equality check.
|
379
|
-
#
|
388
|
+
#
|
380
389
|
# The intent of this method is to provide an equality check suitable for checking if the property
|
381
390
|
# value is in sync or not. It is typically called from {#insync?}.
|
382
391
|
#
|
@@ -438,7 +447,7 @@ class Puppet::Property < Puppet::Parameter
|
|
438
447
|
# the _associated resource_ and finally in Puppet[:noop].
|
439
448
|
# @todo This logic is different than Parameter#noop in that the resource noop mode overrides
|
440
449
|
# the property's mode - in parameter it is the other way around. Bug or feature?
|
441
|
-
#
|
450
|
+
#
|
442
451
|
def noop
|
443
452
|
# This is only here to make testing easier.
|
444
453
|
if @resource.respond_to?(:noop?)
|
@@ -457,7 +466,7 @@ class Puppet::Property < Puppet::Parameter
|
|
457
466
|
# same name as this property (i.e. if the property name is 'gid', a call to the
|
458
467
|
# 'provider.gid' is expected to return the current value.
|
459
468
|
# @return [Object] what the provider returns as the current value of the property
|
460
|
-
#
|
469
|
+
#
|
461
470
|
def retrieve
|
462
471
|
provider.send(self.class.name)
|
463
472
|
end
|
@@ -517,10 +526,10 @@ class Puppet::Property < Puppet::Parameter
|
|
517
526
|
# If the _array matching mode_ {#match_all?} is true, an array of the wanted values in unmunged format
|
518
527
|
# is returned, else the first value in the array of wanted values in unmunged format is returned.
|
519
528
|
# @return [Array<Object>, Object, nil] Array of values if {#match_all?} else a single value, or nil if there are no
|
520
|
-
# wanted values.
|
529
|
+
# wanted values.
|
521
530
|
# @raise [Puppet::DevError] if the wanted value is non nil and not an array
|
522
531
|
#
|
523
|
-
# @note This method will potentially return different values than the original values as they are
|
532
|
+
# @note This method will potentially return different values than the original values as they are
|
524
533
|
# converted via munging/unmunging. If the original values are wanted, call {#shouldorig}.
|
525
534
|
#
|
526
535
|
# @see #shouldorig
|
@@ -565,8 +574,8 @@ class Puppet::Property < Puppet::Parameter
|
|
565
574
|
|
566
575
|
# Synchronizes the current value _(is)_ and the wanted value _(should)_ by calling {#set}.
|
567
576
|
# @raise [Puppet::DevError] if {#should} is nil
|
568
|
-
# @todo The implementation of this method is somewhat inefficient as it computes the should
|
569
|
-
# array twice.
|
577
|
+
# @todo The implementation of this method is somewhat inefficient as it computes the should
|
578
|
+
# array twice.
|
570
579
|
def sync
|
571
580
|
devfail "Got a nil value for should" unless should
|
572
581
|
set(should)
|
@@ -587,7 +596,7 @@ class Puppet::Property < Puppet::Parameter
|
|
587
596
|
# @raise [ArgumentError] if a required feature is not present
|
588
597
|
# @return [void]
|
589
598
|
# @api private
|
590
|
-
#
|
599
|
+
#
|
591
600
|
def validate_features_per_value(value)
|
592
601
|
if features = self.class.value_option(self.class.value_name(value), :required_features)
|
593
602
|
features = Array(features)
|
@@ -67,10 +67,10 @@ class Puppet::Property::Ensure < Puppet::Property
|
|
67
67
|
# The existence of the resource is checked by first consulting the provider (if it responds to
|
68
68
|
# `:exists`), and secondly the resource. A a value of `:present` or `:absent` is returned
|
69
69
|
# depending on if the managed entity exists or not.
|
70
|
-
#
|
70
|
+
#
|
71
71
|
# @return [Symbol] a value of `:present` or `:absent` depending on if it exists or not
|
72
72
|
# @raise [Puppet::DevError] if neither the provider nor the resource responds to `:exists`
|
73
|
-
#
|
73
|
+
#
|
74
74
|
def retrieve
|
75
75
|
# XXX This is a problem -- whether the object exists or not often
|
76
76
|
# depends on the results of other properties, yet we're the first property
|
@@ -6,7 +6,7 @@ module Puppet
|
|
6
6
|
# The maintained order is the order defined by the 'current' set of values (i.e. the
|
7
7
|
# original order is not disrupted). Any additions are added after the current values
|
8
8
|
# in their given order).
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# For an unordered list see {Puppet::Property::List}.
|
11
11
|
#
|
12
12
|
class OrderedList < List
|
data/lib/puppet/provider.rb
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
# lifecycle (creates, destroys), or alters some value reflected backed by a property).
|
15
15
|
# * **Flush** - is a hook that is called once per resource when everything has been applied. The intent is
|
16
16
|
# that an implementation may defer modification of the current state typically done in property setters
|
17
|
-
# and instead record information that allows flush to perform the changes more efficiently.
|
17
|
+
# and instead record information that allows flush to perform the changes more efficiently.
|
18
18
|
# * **Execution Methods** - The execution methods provides access to execution of arbitrary commands.
|
19
19
|
# As a convenience execution methods are available on both the instance and the class of a provider since a
|
20
20
|
# lot of provider logic switch between these contexts fairly freely.
|
@@ -30,8 +30,7 @@
|
|
30
30
|
#
|
31
31
|
# @note Class level methods are only called once to configure the provider (when the type is created), and not
|
32
32
|
# for each resource the provider is operating on.
|
33
|
-
# The instance methods are however called for each resource.
|
34
|
-
#
|
33
|
+
# The instance methods are however called for each resource.
|
35
34
|
#
|
36
35
|
# @api public
|
37
36
|
#
|
@@ -52,11 +51,11 @@ class Puppet::Provider
|
|
52
51
|
# Include the util module so we have access to things like 'which'
|
53
52
|
include Puppet::Util, Puppet::Util::Docs
|
54
53
|
include Puppet::Util::Logging
|
55
|
-
|
54
|
+
|
56
55
|
# @return [String] The name of the provider
|
57
56
|
attr_accessor :name
|
58
57
|
|
59
|
-
#
|
58
|
+
#
|
60
59
|
# @todo Original = _"The source parameter exists so that providers using the same
|
61
60
|
# source can specify this, so reading doesn't attempt to read the
|
62
61
|
# same package multiple times."_ This seems to be a package type specific attribute. Is this really
|
@@ -72,19 +71,19 @@ class Puppet::Provider
|
|
72
71
|
# @api private
|
73
72
|
# @deprecated This attribute is available for backwards compatibility reasons.
|
74
73
|
attr_reader :model
|
75
|
-
|
74
|
+
|
76
75
|
# @todo What is this type? A reference to a Puppet::Type ?
|
77
76
|
# @return [Puppet::Type] the resource type (that this provider is ... WHAT?)
|
78
77
|
#
|
79
78
|
attr_accessor :resource_type
|
80
|
-
|
79
|
+
|
81
80
|
# @!attribute [r] doc
|
82
81
|
# The (full) documentation for this provider class. The documentation for the provider class itself
|
83
82
|
# should be set with the DSL method {desc=}. Setting the documentation with with {doc=} has the same effect
|
84
83
|
# as setting it with {desc=} (only the class documentation part is set). In essence this means that
|
85
84
|
# there is no getter for the class documentation part (since the getter returns the full
|
86
85
|
# documentation when there are additional contributors).
|
87
|
-
#
|
86
|
+
#
|
88
87
|
# @return [String] Returns the full documentation for the provider.
|
89
88
|
# @see Puppet::Utils::Docs
|
90
89
|
# @comment This is puzzling ... a write only doc attribute??? The generated setter never seems to be
|
@@ -96,17 +95,15 @@ class Puppet::Provider
|
|
96
95
|
# {doc} attribute).
|
97
96
|
#
|
98
97
|
# @dsl type
|
99
|
-
#
|
100
98
|
#
|
101
99
|
attr_writer :doc
|
102
|
-
|
103
100
|
end
|
104
101
|
|
105
102
|
# @todo original = _"LAK 2007-05-09: Keep the model stuff around for backward compatibility"_, why is it
|
106
103
|
# both here (instance) and at class level? Is this a different model?
|
107
104
|
# @return [???] model is WHAT?
|
108
105
|
attr_reader :model
|
109
|
-
|
106
|
+
|
110
107
|
# @return [???] This resource is what? Is an instance of a provider attached to one particular Puppet::Resource?
|
111
108
|
#
|
112
109
|
attr_accessor :resource
|
@@ -168,11 +165,11 @@ class Puppet::Provider
|
|
168
165
|
# Confines this provider to be suitable only on hosts where the given commands are present.
|
169
166
|
# Also see {Puppet::Provider::Confiner#confine} for other types of confinement of a provider by use of other types of
|
170
167
|
# predicates.
|
171
|
-
#
|
168
|
+
#
|
172
169
|
# @note It is preferred if the commands are not entered with absolute paths as this allows puppet
|
173
170
|
# to search for them using the PATH variable.
|
174
171
|
#
|
175
|
-
# @param command_specs [Hash{String => String}] Map of name to command that the provider will
|
172
|
+
# @param command_specs [Hash{String => String}] Map of name to command that the provider will
|
176
173
|
# be executing on the system. Each command is specified with a name and the path of the executable.
|
177
174
|
# @return [void]
|
178
175
|
# @see optional_commands
|
@@ -188,7 +185,7 @@ class Puppet::Provider
|
|
188
185
|
# is lazy (when a resource is evaluated) and the absence of commands
|
189
186
|
# that will be present after other resources have been applied no longer needs to be specified as
|
190
187
|
# optional.
|
191
|
-
# @param [Hash{String => String}] command_specs Named commands that the provider will
|
188
|
+
# @param [Hash{String => String}] command_specs Named commands that the provider will
|
192
189
|
# be executing on the system. Each command is specified with a name and the path of the executable.
|
193
190
|
# (@see #has_command)
|
194
191
|
# @see commands
|
@@ -202,8 +199,8 @@ class Puppet::Provider
|
|
202
199
|
|
203
200
|
# Creates a convenience method for invocation of a command.
|
204
201
|
#
|
205
|
-
# This generates a Provider method that allows easy execution of the command. The generated
|
206
|
-
# method may take arguments that will be passed through to the executable as the command line arguments
|
202
|
+
# This generates a Provider method that allows easy execution of the command. The generated
|
203
|
+
# method may take arguments that will be passed through to the executable as the command line arguments
|
207
204
|
# when it is invoked.
|
208
205
|
#
|
209
206
|
# @example Use it like this:
|
@@ -223,7 +220,7 @@ class Puppet::Provider
|
|
223
220
|
# @yield [ ] A block that configures the command (see {Puppet::Provider::Command})
|
224
221
|
# @comment a yield [ ] produces {|| ...} in the signature, do not remove the space.
|
225
222
|
# @note the name ´has_command´ looks odd in an API context, but makes more sense when seen in the internal
|
226
|
-
# DSL context where a Provider is declaratively defined.
|
223
|
+
# DSL context where a Provider is declaratively defined.
|
227
224
|
#
|
228
225
|
def self.has_command(name, path, &block)
|
229
226
|
name = name.intern
|
@@ -325,9 +322,9 @@ class Puppet::Provider
|
|
325
322
|
#
|
326
323
|
# The _ancestors_ is the Ruby Module::ancestors method and the number of classes returned is used
|
327
324
|
# to boost the score. The intent is that if two providers are equal, but one is more "derived" than the other
|
328
|
-
# (i.e. includes more classes), it should win because it is more specific).
|
325
|
+
# (i.e. includes more classes), it should win because it is more specific).
|
329
326
|
# @note Because of how this value is
|
330
|
-
# calculated there could be surprising side effects if a provider included an excessive amount of classes.
|
327
|
+
# calculated there could be surprising side effects if a provider included an excessive amount of classes.
|
331
328
|
#
|
332
329
|
def self.specificity
|
333
330
|
# This strange piece of logic attempts to figure out how many parent providers there
|
@@ -356,9 +353,9 @@ class Puppet::Provider
|
|
356
353
|
#
|
357
354
|
# An implementation of this method should only cache the values of properties
|
358
355
|
# if they are discovered as part of the process for finding existing resources.
|
359
|
-
# Resource properties that require additional commands (than those used to determine existence/identity)
|
356
|
+
# Resource properties that require additional commands (than those used to determine existence/identity)
|
360
357
|
# should be implemented in their respective getter method. (This is important from a performance perspective;
|
361
|
-
# it may be expensive to compute, as well as wasteful as all discovered resources may perhaps not be managed).
|
358
|
+
# it may be expensive to compute, as well as wasteful as all discovered resources may perhaps not be managed).
|
362
359
|
#
|
363
360
|
# An implementation may return an empty list (naturally with the effect that it is not possible to query
|
364
361
|
# for manageable entities).
|
@@ -370,7 +367,7 @@ class Puppet::Provider
|
|
370
367
|
# @return [Array<Puppet::Provider>] a list of providers referencing the system entities
|
371
368
|
# @abstract this method must be implemented by a subclass and this super method should never be called as it raises an exception.
|
372
369
|
# @raise [Puppet::DevError] Error indicating that the method should have been implemented by subclass.
|
373
|
-
# @see prefetch
|
370
|
+
# @see prefetch
|
374
371
|
def self.instances
|
375
372
|
raise Puppet::DevError, "Provider #{self.name} has not defined the 'instances' class method"
|
376
373
|
end
|
@@ -406,7 +403,7 @@ class Puppet::Provider
|
|
406
403
|
# The generated methods may be overridden by more advanced implementations if something
|
407
404
|
# else than a straight forward getter/setter pair of methods is required.
|
408
405
|
# (i.e. define such overriding methods after this method has been called)
|
409
|
-
#
|
406
|
+
#
|
410
407
|
# An implementor of a provider that makes use of `prefetch` and `flush` can use this method since it uses
|
411
408
|
# the internal `@property_hash` variable to store values. An implementation would then update the system
|
412
409
|
# state on a call to `flush` based on the current values in the `@property_hash`.
|
@@ -447,7 +444,7 @@ class Puppet::Provider
|
|
447
444
|
private_class_method :create_class_and_instance_method
|
448
445
|
|
449
446
|
# @return [String] Returns the data source, which is the provider name if no other source has been set.
|
450
|
-
# @todo Unclear what "the source" is used for?
|
447
|
+
# @todo Unclear what "the source" is used for?
|
451
448
|
def self.source
|
452
449
|
@source ||= self.name
|
453
450
|
end
|
@@ -508,7 +505,7 @@ class Puppet::Provider
|
|
508
505
|
end
|
509
506
|
end
|
510
507
|
|
511
|
-
# Clears this provider instance to allow GC to clean up.
|
508
|
+
# Clears this provider instance to allow GC to clean up.
|
512
509
|
def clear
|
513
510
|
@resource = nil
|
514
511
|
@model = nil
|
@@ -532,8 +529,8 @@ class Puppet::Provider
|
|
532
529
|
# it is remembered for further operations. If a hash is used it becomes the internal `@property_hash`
|
533
530
|
# structure of the provider - this hash holds the current state property values of system entities
|
534
531
|
# as they are being discovered by querying or other operations (typically getters).
|
535
|
-
#
|
536
|
-
# @todo The use of a hash as a parameter needs a better exaplanation; why is this done? What is the intent?
|
532
|
+
#
|
533
|
+
# @todo The use of a hash as a parameter needs a better exaplanation; why is this done? What is the intent?
|
537
534
|
# @param resource [Puppet::Resource, Hash] optional resource or hash
|
538
535
|
#
|
539
536
|
def initialize(resource = nil)
|
@@ -596,7 +593,7 @@ class Puppet::Provider
|
|
596
593
|
# Otherwise, order by the providers class name.
|
597
594
|
return self.class.name <=> other.class.name
|
598
595
|
end
|
599
|
-
|
596
|
+
|
600
597
|
# @comment Document prefetch here as it does not exist anywhere else (called from transaction if implemented)
|
601
598
|
# @!method self.prefetch(resource_hash)
|
602
599
|
# @abstract A subclass may implement this - it is not implemented in the Provider class
|
@@ -605,13 +602,12 @@ class Puppet::Provider
|
|
605
602
|
# fetched state (i.e. what is returned from the {instances} method).
|
606
603
|
# @param resources_hash [Hash<{String => Puppet::Resource}>] map from name to resource of resources to prefetch
|
607
604
|
# @return [void]
|
608
|
-
|
605
|
+
|
609
606
|
# @comment Document flush here as it does not exist anywhere (called from transaction if implemented)
|
610
607
|
# @!method flush()
|
611
608
|
# @abstract A subclass may implement this - it is not implemented in the Provider class
|
612
609
|
# This method may be implemented by a provider in order to flush properties that has not been individually
|
613
610
|
# applied to the managed entity's current state.
|
614
611
|
# @return [void]
|
615
|
-
|
616
612
|
end
|
617
613
|
|