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
@@ -10,7 +10,10 @@ class Puppet::SSL::Certificate < Puppet::SSL::Base
|
|
10
10
|
wraps OpenSSL::X509::Certificate
|
11
11
|
|
12
12
|
extend Puppet::Indirector
|
13
|
-
indirects :certificate, :terminus_class => :file
|
13
|
+
indirects :certificate, :terminus_class => :file, :doc => <<DOC
|
14
|
+
This indirection wraps an `OpenSSL::X509::Certificate` object, representing a certificate (signed public key).
|
15
|
+
The indirection key is the certificate CN (generally a hostname).
|
16
|
+
DOC
|
14
17
|
|
15
18
|
# Because of how the format handler class is included, this
|
16
19
|
# can't be in the base class.
|
@@ -19,7 +19,10 @@ class Puppet::SSL::CertificateRequest < Puppet::SSL::Base
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
indirects :certificate_request, :terminus_class => :file, :extend => AutoSigner
|
22
|
+
indirects :certificate_request, :terminus_class => :file, :extend => AutoSigner, :doc => <<DOC
|
23
|
+
This indirection wraps an `OpenSSL::X509::Request` object, representing a certificate signing request (CSR).
|
24
|
+
The indirection key is the certificate CN (generally a hostname).
|
25
|
+
DOC
|
23
26
|
|
24
27
|
# Because of how the format handler class is included, this
|
25
28
|
# can't be in the base class.
|
@@ -8,7 +8,10 @@ class Puppet::SSL::CertificateRevocationList < Puppet::SSL::Base
|
|
8
8
|
wraps OpenSSL::X509::CRL
|
9
9
|
|
10
10
|
extend Puppet::Indirector
|
11
|
-
indirects :certificate_revocation_list, :terminus_class => :file
|
11
|
+
indirects :certificate_revocation_list, :terminus_class => :file, :doc => <<DOC
|
12
|
+
This indirection wraps an `OpenSSL::X509::CRL` object, representing a certificate revocation list (CRL).
|
13
|
+
The indirection key is the CA name (usually literally `ca`).
|
14
|
+
DOC
|
12
15
|
|
13
16
|
# Convert a string into an instance.
|
14
17
|
def self.from_s(string)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'puppet/ssl'
|
2
|
+
require 'openssl'
|
2
3
|
module Puppet
|
3
4
|
module SSL
|
4
5
|
# Puppet::SSL::Configuration is intended to separate out the following concerns:
|
@@ -27,6 +28,37 @@ class Configuration
|
|
27
28
|
def ca_auth_file
|
28
29
|
@ca_auth_file || @localcacert
|
29
30
|
end
|
31
|
+
|
32
|
+
##
|
33
|
+
# ca_auth_certificates returns an Array of OpenSSL::X509::Certificate
|
34
|
+
# instances intended to be used in the connection verify_callback. This
|
35
|
+
# method loads and parses the {#ca_auth_file} from the filesystem.
|
36
|
+
#
|
37
|
+
# @api private
|
38
|
+
#
|
39
|
+
# @return [Array<OpenSSL::X509::Certificate>]
|
40
|
+
def ca_auth_certificates
|
41
|
+
@ca_auth_certificates ||= decode_cert_bundle(read_file(ca_auth_file))
|
42
|
+
end
|
43
|
+
|
44
|
+
##
|
45
|
+
# Decode a string of concatenated certificates
|
46
|
+
#
|
47
|
+
# @return [Array<OpenSSL::X509::Certificate>]
|
48
|
+
def decode_cert_bundle(bundle_str)
|
49
|
+
re = /-----BEGIN CERTIFICATE-----.*?-----END CERTIFICATE-----/m
|
50
|
+
pem_ary = bundle_str.scan(re)
|
51
|
+
pem_ary.map do |pem_str|
|
52
|
+
OpenSSL::X509::Certificate.new(pem_str)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
private :decode_cert_bundle
|
56
|
+
|
57
|
+
# read_file makes testing easier.
|
58
|
+
def read_file(path)
|
59
|
+
File.read(path)
|
60
|
+
end
|
61
|
+
private :read_file
|
30
62
|
end
|
31
63
|
end
|
32
64
|
end
|
data/lib/puppet/ssl/host.rb
CHANGED
@@ -16,7 +16,10 @@ class Puppet::SSL::Host
|
|
16
16
|
CertificateRevocationList = Puppet::SSL::CertificateRevocationList
|
17
17
|
|
18
18
|
extend Puppet::Indirector
|
19
|
-
indirects :certificate_status, :terminus_class => :file
|
19
|
+
indirects :certificate_status, :terminus_class => :file, :doc => <<DOC
|
20
|
+
This indirection represents the host that ties a key, certificate, and certificate request together.
|
21
|
+
The indirection key is the certificate CN (generally a hostname).
|
22
|
+
DOC
|
20
23
|
|
21
24
|
attr_reader :name
|
22
25
|
attr_accessor :ca
|
@@ -156,20 +159,12 @@ class Puppet::SSL::Host
|
|
156
159
|
@certificate_request ||= CertificateRequest.indirection.find(name)
|
157
160
|
end
|
158
161
|
|
159
|
-
def this_csr_is_for_the_current_host
|
160
|
-
name == Puppet[:certname].downcase
|
161
|
-
end
|
162
|
-
|
163
|
-
def this_csr_is_for_the_current_host
|
164
|
-
name == Puppet[:certname].downcase
|
165
|
-
end
|
166
|
-
|
167
162
|
# Our certificate request requires the key but that's all.
|
168
163
|
def generate_certificate_request(options = {})
|
169
164
|
generate_key unless key
|
170
165
|
|
171
|
-
# If this is for the current machine...
|
172
|
-
if
|
166
|
+
# If this CSR is for the current machine...
|
167
|
+
if name == Puppet[:certname].downcase
|
173
168
|
# ...add our configured dns_alt_names
|
174
169
|
if Puppet[:dns_alt_names] and Puppet[:dns_alt_names] != ''
|
175
170
|
options[:dns_alt_names] ||= Puppet[:dns_alt_names]
|
@@ -257,10 +252,12 @@ ERROR_STRING
|
|
257
252
|
# a lookup in the middle of setting our ssl connection.
|
258
253
|
@ssl_store.add_file(Puppet[:localcacert])
|
259
254
|
|
260
|
-
# If there's a CRL, add it to our store.
|
261
|
-
if
|
262
|
-
|
263
|
-
|
255
|
+
# If we're doing revocation and there's a CRL, add it to our store.
|
256
|
+
if Puppet.settings[:certificate_revocation]
|
257
|
+
if crl = Puppet::SSL::CertificateRevocationList.indirection.find(CA_NAME)
|
258
|
+
@ssl_store.flags = OpenSSL::X509::V_FLAG_CRL_CHECK_ALL|OpenSSL::X509::V_FLAG_CRL_CHECK
|
259
|
+
@ssl_store.add_crl(crl.content)
|
260
|
+
end
|
264
261
|
end
|
265
262
|
return @ssl_store
|
266
263
|
end
|
@@ -284,7 +281,7 @@ ERROR_STRING
|
|
284
281
|
# It appears that we have no internal consumers of this api
|
285
282
|
# --jeffweiss 30 aug 2012
|
286
283
|
pson_hash[:fingerprint] = thing_to_use.fingerprint
|
287
|
-
|
284
|
+
|
288
285
|
# The above fingerprint doesn't tell us what message digest algorithm was used
|
289
286
|
# No problem, except that the default is changing between 2.7 and 3.0. Also, as
|
290
287
|
# we move to FIPS 140-2 compliance, MD5 is no longer allowed (and, gasp, will
|
@@ -294,15 +291,15 @@ ERROR_STRING
|
|
294
291
|
# --jeffweiss 31 july 2012
|
295
292
|
pson_hash[:fingerprints] = {}
|
296
293
|
pson_hash[:fingerprints][:default] = thing_to_use.fingerprint
|
297
|
-
|
298
|
-
suitable_message_digest_algorithms.each do |md|
|
294
|
+
|
295
|
+
suitable_message_digest_algorithms.each do |md|
|
299
296
|
pson_hash[:fingerprints][md] = thing_to_use.fingerprint md
|
300
297
|
end
|
301
298
|
pson_hash[:dns_alt_names] = thing_to_use.subject_alt_names
|
302
299
|
|
303
300
|
pson_hash.to_pson(*args)
|
304
301
|
end
|
305
|
-
|
302
|
+
|
306
303
|
# eventually we'll probably want to move this somewhere else or make it
|
307
304
|
# configurable
|
308
305
|
# --jeffweiss 29 aug 2012
|
@@ -319,7 +316,7 @@ ERROR_STRING
|
|
319
316
|
rescue SystemExit,NoMemoryError
|
320
317
|
raise
|
321
318
|
rescue Exception => detail
|
322
|
-
Puppet.log_exception(detail, "Could not request certificate: #{detail}")
|
319
|
+
Puppet.log_exception(detail, "Could not request certificate: #{detail.message}")
|
323
320
|
if time < 1
|
324
321
|
puts "Exiting; failed to retrieve certificate and waitforcert is disabled"
|
325
322
|
exit(1)
|
@@ -340,7 +337,7 @@ ERROR_STRING
|
|
340
337
|
break if certificate
|
341
338
|
Puppet.notice "Did not receive certificate"
|
342
339
|
rescue StandardError => detail
|
343
|
-
Puppet.log_exception(detail, "Could not request certificate: #{detail}")
|
340
|
+
Puppet.log_exception(detail, "Could not request certificate: #{detail.message}")
|
344
341
|
end
|
345
342
|
end
|
346
343
|
end
|
data/lib/puppet/ssl/key.rb
CHANGED
@@ -6,7 +6,10 @@ class Puppet::SSL::Key < Puppet::SSL::Base
|
|
6
6
|
wraps OpenSSL::PKey::RSA
|
7
7
|
|
8
8
|
extend Puppet::Indirector
|
9
|
-
indirects :key, :terminus_class => :file
|
9
|
+
indirects :key, :terminus_class => :file, :doc => <<DOC
|
10
|
+
This indirection wraps an `OpenSSL::PKey::RSA object, representing a private key.
|
11
|
+
The indirection key is the certificate CN (generally a hostname).
|
12
|
+
DOC
|
10
13
|
|
11
14
|
# Because of how the format handler class is included, this
|
12
15
|
# can't be in the base class.
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require 'puppet/ssl'
|
2
|
+
require 'openssl'
|
3
|
+
module Puppet
|
4
|
+
module SSL
|
5
|
+
class Validator
|
6
|
+
attr_reader :peer_certs
|
7
|
+
attr_reader :verify_errors
|
8
|
+
attr_reader :ssl_configuration
|
9
|
+
|
10
|
+
##
|
11
|
+
# @param [Hash] opts the options to initialze the instance with.
|
12
|
+
#
|
13
|
+
# @option opts [Puppet::SSL::Configuration] :ssl_configuration to use for
|
14
|
+
# authorizing the peer certificate chain.
|
15
|
+
def initialize(opts = {})
|
16
|
+
reset!
|
17
|
+
@ssl_configuration = opts[:ssl_configuration] or raise ArgumentError, ":ssl_configuration is required"
|
18
|
+
end
|
19
|
+
|
20
|
+
##
|
21
|
+
# reset to the initial state.
|
22
|
+
def reset!
|
23
|
+
@peer_certs = []
|
24
|
+
@verify_errors = []
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# call performs verification of the SSL connection and collection of the
|
29
|
+
# certificates for use in constructing the error message if the verification
|
30
|
+
# failed. This callback will be executed once for each certificate in a
|
31
|
+
# chain being verified.
|
32
|
+
#
|
33
|
+
# From the [OpenSSL
|
34
|
+
# documentation](http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html):
|
35
|
+
# The `verify_callback` function is used to control the behaviour when the
|
36
|
+
# SSL_VERIFY_PEER flag is set. It must be supplied by the application and
|
37
|
+
# receives two arguments: preverify_ok indicates, whether the verification of
|
38
|
+
# the certificate in question was passed (preverify_ok=1) or not
|
39
|
+
# (preverify_ok=0). x509_ctx is a pointer to the complete context used for
|
40
|
+
# the certificate chain verification.
|
41
|
+
#
|
42
|
+
# See {Puppet::Network::HTTP::Connection} for more information and where this
|
43
|
+
# class is intended to be used.
|
44
|
+
#
|
45
|
+
# @param [Boolean] preverify_ok indicates whether the verification of the
|
46
|
+
# certificate in question was passed (preverify_ok=true)
|
47
|
+
# @param [OpenSSL::SSL::SSLContext] ssl_context holds the SSLContext for the
|
48
|
+
# chain being verified.
|
49
|
+
#
|
50
|
+
# @return [Boolean] false if the peer is invalid, true otherwise.
|
51
|
+
def call(preverify_ok, ssl_context)
|
52
|
+
# We must make a copy since the scope of the ssl_context will be lost
|
53
|
+
# across invocations of this method.
|
54
|
+
current_cert = ssl_context.current_cert
|
55
|
+
@peer_certs << Puppet::SSL::Certificate.from_instance(current_cert)
|
56
|
+
|
57
|
+
if preverify_ok
|
58
|
+
# If we've copied all of the certs in the chain out of the SSL library
|
59
|
+
if @peer_certs.length == ssl_context.chain.length
|
60
|
+
# (#20027) The peer cert must be issued by a specific authority
|
61
|
+
preverify_ok = valid_peer?
|
62
|
+
end
|
63
|
+
else
|
64
|
+
if ssl_context.error_string
|
65
|
+
@verify_errors << "#{ssl_context.error_string} for #{current_cert.subject}"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
preverify_ok
|
69
|
+
rescue => ex
|
70
|
+
@verify_errors << ex.message
|
71
|
+
false
|
72
|
+
end
|
73
|
+
|
74
|
+
##
|
75
|
+
# Register the instance's call method with the connection.
|
76
|
+
#
|
77
|
+
# @param [Net::HTTP] connection The connection to velidate
|
78
|
+
#
|
79
|
+
# @return [void]
|
80
|
+
def register_verify_callback(connection)
|
81
|
+
connection.verify_callback = self
|
82
|
+
end
|
83
|
+
|
84
|
+
##
|
85
|
+
# Validate the peer certificates against the authorized certificates.
|
86
|
+
def valid_peer?
|
87
|
+
descending_cert_chain = @peer_certs.reverse.map {|c| c.content }
|
88
|
+
authz_ca_certs = ssl_configuration.ca_auth_certificates
|
89
|
+
|
90
|
+
if not has_authz_peer_cert(descending_cert_chain, authz_ca_certs)
|
91
|
+
msg = "The server presented a SSL certificate chain which does not include a " <<
|
92
|
+
"CA listed in the ssl_client_ca_auth file. "
|
93
|
+
msg << "Authorized Issuers: #{authz_ca_certs.collect {|c| c.subject}.join(', ')} " <<
|
94
|
+
"Peer Chain: #{descending_cert_chain.collect {|c| c.subject}.join(' => ')}"
|
95
|
+
@verify_errors << msg
|
96
|
+
false
|
97
|
+
else
|
98
|
+
true
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
##
|
103
|
+
# checks if the set of peer_certs contains at least one certificate issued
|
104
|
+
# by a certificate listed in authz_certs
|
105
|
+
#
|
106
|
+
# @return [Boolean]
|
107
|
+
def has_authz_peer_cert(peer_certs, authz_certs)
|
108
|
+
peer_certs.any? do |peer_cert|
|
109
|
+
authz_certs.any? do |authz_cert|
|
110
|
+
peer_cert.verify(authz_cert.public_key)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
data/lib/puppet/transaction.rb
CHANGED
@@ -9,7 +9,7 @@ class Puppet::Transaction::Event
|
|
9
9
|
include Puppet::Util::Tagging
|
10
10
|
include Puppet::Util::Logging
|
11
11
|
|
12
|
-
ATTRIBUTES = [:name, :resource, :property, :previous_value, :desired_value, :historical_value, :status, :message, :file, :line, :source_description, :audited]
|
12
|
+
ATTRIBUTES = [:name, :resource, :property, :previous_value, :desired_value, :historical_value, :status, :message, :file, :line, :source_description, :audited, :invalidate_refreshes]
|
13
13
|
YAML_ATTRIBUTES = %w{@audited @property @previous_value @desired_value @historical_value @message @name @status @time}.map(&:to_sym)
|
14
14
|
attr_accessor *ATTRIBUTES
|
15
15
|
attr_writer :tags
|
@@ -29,15 +29,8 @@ class Puppet::Transaction::Event
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def resource=(res)
|
32
|
-
|
33
|
-
|
34
|
-
# raise a TypeError, which we then catch. This should work on both
|
35
|
-
# versions, for all that it is a bit naff. --daniel 2012-03-11
|
36
|
-
if res.respond_to?(:[]) and level = res[:loglevel]
|
37
|
-
@default_log_level = level
|
38
|
-
end
|
39
|
-
rescue TypeError => e
|
40
|
-
raise unless e.to_s == "can't convert Symbol into Integer"
|
32
|
+
if res.respond_to?(:[]) and level = res[:loglevel]
|
33
|
+
@default_log_level = level
|
41
34
|
end
|
42
35
|
@resource = res.to_s
|
43
36
|
end
|
@@ -59,6 +59,13 @@ class Puppet::Transaction::EventManager
|
|
59
59
|
|
60
60
|
queue_events_for_resource(resource, resource, :refresh, [event]) if resource.self_refresh? and ! resource.deleting?
|
61
61
|
end
|
62
|
+
|
63
|
+
dequeue_events_for_resource(resource, :refresh) if events.detect { |e| e.invalidate_refreshes }
|
64
|
+
end
|
65
|
+
|
66
|
+
def dequeue_events_for_resource(target, callback)
|
67
|
+
target.info "Unscheduling #{callback} on #{target}"
|
68
|
+
@event_queues[target][callback] = {} if @event_queues[target]
|
62
69
|
end
|
63
70
|
|
64
71
|
def queue_events_for_resource(source, target, callback, events)
|
@@ -83,7 +90,7 @@ class Puppet::Transaction::EventManager
|
|
83
90
|
def queued_events(resource)
|
84
91
|
return unless callbacks = @event_queues[resource]
|
85
92
|
callbacks.each do |callback, events|
|
86
|
-
yield callback, events
|
93
|
+
yield callback, events unless events.empty?
|
87
94
|
end
|
88
95
|
end
|
89
96
|
|
@@ -3,16 +3,16 @@ require 'puppet/indirector'
|
|
3
3
|
|
4
4
|
# This class is used to report what happens on a client.
|
5
5
|
# There are two types of data in a report; _Logs_ and _Metrics_.
|
6
|
-
#
|
6
|
+
#
|
7
7
|
# * **Logs** - are the output that each change produces.
|
8
8
|
# * **Metrics** - are all of the numerical data involved in the transaction.
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# Use {Puppet::Reports} class to create a new custom report type. This class is indirectly used
|
11
11
|
# as a source of data to report in such a registered report.
|
12
|
-
#
|
12
|
+
#
|
13
13
|
# ##Metrics
|
14
14
|
# There are three types of metrics in each report, and each type of metric has one or more values.
|
15
|
-
#
|
15
|
+
#
|
16
16
|
# * Time: Keeps track of how long things took.
|
17
17
|
# * Total: Total time for the configuration run
|
18
18
|
# * File:
|
@@ -42,36 +42,36 @@ class Puppet::Transaction::Report
|
|
42
42
|
# The version of the configuration
|
43
43
|
# @todo Uncertain what this is?
|
44
44
|
# @return [???] the configuration version
|
45
|
-
attr_accessor :configuration_version
|
46
|
-
|
45
|
+
attr_accessor :configuration_version
|
46
|
+
|
47
47
|
# The host name for which the report is generated
|
48
48
|
# @return [String] the host name
|
49
49
|
attr_accessor :host
|
50
|
-
|
50
|
+
|
51
51
|
# The name of the environment the host is in
|
52
52
|
# @return [String] the environment name
|
53
53
|
attr_accessor :environment
|
54
|
-
|
54
|
+
|
55
55
|
# A hash with a map from resource to status
|
56
56
|
# @return [Hash<{String => String}>] Resource name to status string.
|
57
57
|
# @todo Uncertain if the types in the hash are correct...
|
58
58
|
attr_reader :resource_statuses
|
59
|
-
|
59
|
+
|
60
60
|
# A list of log messages.
|
61
61
|
# @return [Array<String>] logged messages
|
62
62
|
attr_reader :logs
|
63
|
-
|
63
|
+
|
64
64
|
# A hash of metric name to metric value.
|
65
65
|
# @return [Hash<{String => Object}>] A map of metric name to value.
|
66
66
|
# @todo Uncertain if all values are numbers - now marked as Object.
|
67
67
|
#
|
68
68
|
attr_reader :metrics
|
69
|
-
|
69
|
+
|
70
70
|
# The time when the report data was generated.
|
71
71
|
# @return [Time] A time object indicating when the report data was generated
|
72
72
|
#
|
73
73
|
attr_reader :time
|
74
|
-
|
74
|
+
|
75
75
|
# The 'kind' of report is the name of operation that triggered the report to be produced.
|
76
76
|
# Typically "apply".
|
77
77
|
# @return [String] the kind of operation that triggered the generation of the report.
|
@@ -80,14 +80,14 @@ class Puppet::Transaction::Report
|
|
80
80
|
|
81
81
|
# The status of the client run is an enumeration: 'failed', 'changed' or 'unchanged'
|
82
82
|
# @return [String] the status of the run - one of the values 'failed', 'changed', or 'unchanged'
|
83
|
-
#
|
83
|
+
#
|
84
84
|
attr_reader :status
|
85
|
-
|
85
|
+
|
86
86
|
# @return [String] The Puppet version in String form.
|
87
87
|
# @see Puppet::version()
|
88
88
|
#
|
89
89
|
attr_reader :puppet_version
|
90
|
-
|
90
|
+
|
91
91
|
# @return [Integer] (3) a report format version number
|
92
92
|
# @todo Unclear what this is - a version?
|
93
93
|
#
|
@@ -237,7 +237,7 @@ class Puppet::Transaction::Report
|
|
237
237
|
# individual bits represent the presence of different metrics.
|
238
238
|
#
|
239
239
|
# * 0x2 set if there are changes
|
240
|
-
# * 0x4 set if there are failures
|
240
|
+
# * 0x4 set if there are resource failures or resources that failed to restart
|
241
241
|
# @return [Integer] A bitmask where 0x2 is set if there are changes, and 0x4 is set of there are failures.
|
242
242
|
# @api public
|
243
243
|
#
|
@@ -245,6 +245,7 @@ class Puppet::Transaction::Report
|
|
245
245
|
status = 0
|
246
246
|
status |= 2 if @metrics["changes"]["total"] > 0
|
247
247
|
status |= 4 if @metrics["resources"]["failed"] > 0
|
248
|
+
status |= 4 if @metrics["resources"]["failed_to_restart"] > 0
|
248
249
|
status
|
249
250
|
end
|
250
251
|
|