puppet 3.2.4 → 3.3.0.rc2
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/COMMITTERS.md +101 -42
- data/Gemfile +15 -4
- data/README.md +5 -1
- data/README_DEVELOPER.md +117 -54
- data/Rakefile +4 -0
- data/ext/build_defaults.yaml +3 -2
- data/ext/debian/puppet-common.manpages +33 -1
- data/ext/gentoo/init.d/puppet +1 -1
- data/ext/gentoo/init.d/puppetmaster +1 -1
- data/ext/redhat/puppet.spec.erb +0 -1
- data/install.rb +2 -1
- data/lib/hiera/backend/puppet_backend.rb +1 -1
- data/lib/puppet/application.rb +10 -9
- data/lib/puppet/application/agent.rb +87 -93
- data/lib/puppet/application/apply.rb +0 -2
- data/lib/puppet/application/device.rb +3 -3
- data/lib/puppet/application/kick.rb +2 -2
- data/lib/puppet/application/master.rb +41 -19
- data/lib/puppet/application/queue.rb +5 -3
- data/lib/puppet/bindings.rb +147 -0
- data/lib/puppet/configurer.rb +25 -15
- data/lib/puppet/configurer/fact_handler.rb +2 -9
- data/lib/puppet/daemon.rb +44 -33
- data/lib/puppet/defaults.rb +57 -26
- data/lib/puppet/error.rb +1 -1
- data/lib/puppet/external/dot.rb +2 -2
- data/lib/puppet/external/nagios/base.rb +1 -6
- data/lib/puppet/external/pson/common.rb +2 -2
- data/lib/puppet/external/pson/pure/generator.rb +2 -2
- data/lib/puppet/external/pson/pure/parser.rb +1 -1
- data/lib/puppet/face/ca.rb +1 -1
- data/lib/puppet/face/config.rb +1 -1
- data/lib/puppet/face/help.rb +2 -2
- data/lib/puppet/face/module/list.rb +2 -2
- data/lib/puppet/feature/rails.rb +1 -1
- data/lib/puppet/file_bucket/dipper.rb +0 -1
- data/lib/puppet/file_serving/base.rb +1 -1
- data/lib/puppet/file_serving/configuration/parser.rb +20 -14
- data/lib/puppet/forge.rb +0 -32
- data/lib/puppet/forge/cache.rb +1 -1
- data/lib/puppet/forge/errors.rb +3 -3
- data/lib/puppet/forge/repository.rb +7 -42
- data/lib/puppet/graph.rb +11 -0
- data/lib/puppet/graph/key.rb +26 -0
- data/lib/puppet/graph/prioritizer.rb +29 -0
- data/lib/puppet/graph/random_prioritizer.rb +16 -0
- data/lib/puppet/{rb_tree_map.rb → graph/rb_tree_map.rb} +3 -3
- data/lib/puppet/graph/relationship_graph.rb +246 -0
- data/lib/puppet/graph/sequential_prioritizer.rb +31 -0
- data/lib/puppet/{simple_graph.rb → graph/simple_graph.rb} +22 -3
- data/lib/puppet/graph/title_hash_prioritizer.rb +16 -0
- data/lib/puppet/indirector.rb +2 -2
- data/lib/puppet/indirector/catalog/compiler.rb +10 -7
- data/lib/puppet/indirector/catalog/static_compiler.rb +50 -0
- data/lib/puppet/indirector/certificate/rest.rb +1 -1
- data/lib/puppet/indirector/exec.rb +1 -1
- data/lib/puppet/indirector/facts/facter.rb +2 -2
- data/lib/puppet/indirector/facts/inventory_active_record.rb +0 -1
- data/lib/puppet/indirector/facts/network_device.rb +1 -1
- data/lib/puppet/indirector/file_bucket_file/file.rb +0 -1
- data/lib/puppet/indirector/indirection.rb +2 -2
- data/lib/puppet/indirector/memory.rb +9 -0
- data/lib/puppet/indirector/node/ldap.rb +2 -4
- data/lib/puppet/indirector/report/processor.rb +1 -2
- data/lib/puppet/indirector/report/rest.rb +1 -1
- data/lib/puppet/indirector/request.rb +32 -10
- data/lib/puppet/indirector/resource/rest.rb +1 -1
- data/lib/puppet/indirector/resource_type/parser.rb +31 -12
- data/lib/puppet/interface.rb +1 -1
- data/lib/puppet/interface/documentation.rb +7 -11
- data/lib/puppet/interface/option.rb +1 -1
- data/lib/puppet/interface/option_builder.rb +1 -1
- data/lib/puppet/metatype/manager.rb +2 -2
- data/lib/puppet/module.rb +7 -1
- data/lib/puppet/module_tool.rb +1 -1
- data/lib/puppet/module_tool/applications/application.rb +10 -0
- data/lib/puppet/module_tool/applications/installer.rb +6 -3
- data/lib/puppet/module_tool/dependency.rb +2 -0
- data/lib/puppet/module_tool/errors/upgrader.rb +1 -1
- data/lib/puppet/module_tool/metadata.rb +25 -13
- data/lib/puppet/module_tool/modulefile.rb +7 -7
- data/lib/puppet/module_tool/shared_behaviors.rb +4 -2
- data/lib/puppet/module_tool/skeleton.rb +1 -1
- data/lib/puppet/module_tool/skeleton/templates/generator/manifests/init.pp.erb +5 -5
- data/lib/puppet/module_tool/skeleton/templates/generator/tests/init.pp.erb +5 -4
- data/lib/puppet/network/auth_config_parser.rb +3 -0
- data/lib/puppet/network/authconfig.rb +0 -1
- data/lib/puppet/network/authorization.rb +1 -1
- data/lib/puppet/network/authstore.rb +2 -2
- data/lib/puppet/network/format_handler.rb +25 -114
- data/lib/puppet/network/format_support.rb +106 -0
- data/lib/puppet/network/formats.rb +10 -4
- data/lib/puppet/network/http/compression.rb +1 -1
- data/lib/puppet/network/http/connection.rb +76 -32
- data/lib/puppet/network/http/handler.rb +122 -61
- data/lib/puppet/network/http/rack/rest.rb +1 -1
- data/lib/puppet/network/http/webrick/rest.rb +9 -3
- data/lib/puppet/network/http_pool.rb +2 -2
- data/lib/puppet/network/resolver.rb +1 -0
- data/lib/puppet/network/server.rb +5 -81
- data/lib/puppet/node/environment.rb +256 -13
- data/lib/puppet/node/facts.rb +28 -2
- data/lib/puppet/parameter.rb +27 -18
- data/lib/puppet/parameter/boolean.rb +20 -0
- data/lib/puppet/parameter/path.rb +1 -1
- data/lib/puppet/parameter/value.rb +1 -1
- data/lib/puppet/parameter/value_collection.rb +1 -1
- data/lib/puppet/parser/ast/arithmetic_operator.rb +8 -0
- data/lib/puppet/parser/ast/casestatement.rb +0 -3
- data/lib/puppet/parser/ast/lambda.rb +25 -6
- data/lib/puppet/parser/ast/leaf.rb +10 -3
- data/lib/puppet/parser/ast/nop.rb +1 -1
- data/lib/puppet/parser/ast/resource_override.rb +0 -2
- data/lib/puppet/parser/compiler.rb +92 -34
- data/lib/puppet/parser/files.rb +0 -5
- data/lib/puppet/parser/functions/create_resources.rb +23 -46
- data/lib/puppet/parser/functions/each.rb +0 -2
- data/lib/puppet/parser/functions/extlookup.rb +2 -2
- data/lib/puppet/parser/functions/foreach.rb +0 -2
- data/lib/puppet/parser/functions/hiera_include.rb +1 -1
- data/lib/puppet/parser/functions/lookup.rb +44 -0
- data/lib/puppet/parser/functions/slice.rb +1 -1
- data/lib/puppet/parser/grammar.ra +0 -1
- data/lib/puppet/parser/lexer.rb +0 -1
- data/lib/puppet/parser/parser.rb +0 -1
- data/lib/puppet/parser/parser_factory.rb +3 -2
- data/lib/puppet/parser/parser_support.rb +1 -1
- data/lib/puppet/parser/relationship.rb +1 -1
- data/lib/puppet/parser/scope.rb +49 -24
- data/lib/puppet/parser/type_loader.rb +13 -18
- data/lib/puppet/pops.rb +45 -0
- data/lib/puppet/pops/adaptable.rb +2 -2
- data/lib/puppet/pops/adapters.rb +4 -0
- data/lib/puppet/pops/binder/binder.rb +421 -0
- data/lib/puppet/pops/binder/binder_issues.rb +142 -0
- data/lib/puppet/pops/binder/bindings_checker.rb +217 -0
- data/lib/puppet/pops/binder/bindings_composer.rb +241 -0
- data/lib/puppet/pops/binder/bindings_factory.rb +847 -0
- data/lib/puppet/pops/binder/bindings_label_provider.rb +46 -0
- data/lib/puppet/pops/binder/bindings_loader.rb +79 -0
- data/lib/puppet/pops/binder/bindings_model.rb +215 -0
- data/lib/puppet/pops/binder/bindings_model_dumper.rb +205 -0
- data/lib/puppet/pops/binder/bindings_validator_factory.rb +28 -0
- data/lib/puppet/pops/binder/config/binder_config.rb +139 -0
- data/lib/puppet/pops/binder/config/binder_config_checker.rb +183 -0
- data/lib/puppet/pops/binder/config/diagnostic_producer.rb +32 -0
- data/lib/puppet/pops/binder/config/issues.rb +106 -0
- data/lib/puppet/pops/binder/hiera2.rb +10 -0
- data/lib/puppet/pops/binder/hiera2/bindings_provider.rb +148 -0
- data/lib/puppet/pops/binder/hiera2/config.rb +69 -0
- data/lib/puppet/pops/binder/hiera2/config_checker.rb +68 -0
- data/lib/puppet/pops/binder/hiera2/diagnostic_producer.rb +36 -0
- data/lib/puppet/pops/binder/hiera2/issues.rb +67 -0
- data/lib/puppet/pops/binder/hiera2/json_backend.rb +18 -0
- data/lib/puppet/pops/binder/hiera2/yaml_backend.rb +21 -0
- data/lib/puppet/pops/binder/injector.rb +688 -0
- data/lib/puppet/pops/binder/injector_entry.rb +53 -0
- data/lib/puppet/pops/binder/key_factory.rb +61 -0
- data/lib/puppet/pops/binder/producers.rb +829 -0
- data/lib/puppet/pops/binder/scheme_handler/confdir_hiera_scheme.rb +67 -0
- data/lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb +34 -0
- data/lib/puppet/pops/binder/scheme_handler/module_hiera_scheme.rb +92 -0
- data/lib/puppet/pops/binder/scheme_handler/module_scheme.rb +84 -0
- data/lib/puppet/pops/binder/scheme_handler/symbolic_scheme.rb +54 -0
- data/lib/puppet/pops/binder/system_bindings.rb +72 -0
- data/lib/puppet/pops/issue_reporter.rb +75 -0
- data/lib/puppet/pops/issues.rb +9 -5
- data/lib/puppet/pops/model/ast_transformer.rb +4 -4
- data/lib/puppet/pops/model/ast_tree_dumper.rb +1 -1
- data/lib/puppet/pops/model/factory.rb +25 -13
- data/lib/puppet/pops/model/model.rb +1 -1
- data/lib/puppet/pops/model/tree_dumper.rb +2 -2
- data/lib/puppet/pops/parser/egrammar.ra +0 -1
- data/lib/puppet/pops/parser/eparser.rb +1 -2
- data/lib/puppet/pops/parser/evaluating_parser.rb +162 -0
- data/lib/puppet/pops/parser/lexer.rb +8 -6
- data/lib/puppet/pops/types/class_loader.rb +118 -0
- data/lib/puppet/pops/types/type_calculator.rb +557 -0
- data/lib/puppet/pops/types/type_factory.rb +147 -0
- data/lib/puppet/pops/types/type_parser.rb +117 -0
- data/lib/puppet/pops/types/types.rb +132 -0
- data/lib/puppet/pops/validation.rb +146 -17
- data/lib/puppet/pops/validation/checker3_1.rb +1 -1
- data/lib/puppet/pops/validation/validator_factory_3_1.rb +6 -16
- data/lib/puppet/property.rb +3 -3
- data/lib/puppet/property/keyvalue.rb +1 -1
- data/lib/puppet/provider.rb +2 -2
- data/lib/puppet/provider/aixobject.rb +19 -21
- data/lib/puppet/provider/augeas/augeas.rb +3 -1
- data/lib/puppet/provider/command.rb +2 -2
- data/lib/puppet/provider/group/aix.rb +1 -1
- data/lib/puppet/provider/group/ldap.rb +1 -1
- data/lib/puppet/provider/macauthorization/macauthorization.rb +1 -1
- data/lib/puppet/provider/mailalias/aliases.rb +3 -8
- data/lib/puppet/provider/mcx/mcxcontent.rb +7 -1
- data/lib/puppet/provider/mount.rb +8 -3
- data/lib/puppet/provider/nameservice.rb +1 -1
- data/lib/puppet/provider/nameservice/directoryservice.rb +5 -5
- data/lib/puppet/provider/package/appdmg.rb +1 -1
- data/lib/puppet/provider/package/apt.rb +0 -1
- data/lib/puppet/provider/package/dpkg.rb +86 -32
- data/lib/puppet/provider/package/fink.rb +0 -2
- data/lib/puppet/provider/package/freebsd.rb +0 -2
- data/lib/puppet/provider/package/openbsd.rb +57 -10
- data/lib/puppet/provider/package/opkg.rb +0 -1
- data/lib/puppet/provider/package/pacman.rb +0 -1
- data/lib/puppet/provider/package/pip.rb +1 -1
- data/lib/puppet/provider/package/pkgdmg.rb +17 -6
- data/lib/puppet/provider/package/pkgutil.rb +1 -1
- data/lib/puppet/provider/package/portage.rb +9 -1
- data/lib/puppet/provider/package/ports.rb +2 -2
- data/lib/puppet/provider/package/rpm.rb +29 -12
- data/lib/puppet/provider/package/rug.rb +1 -1
- data/lib/puppet/provider/package/urpmi.rb +11 -15
- data/lib/puppet/provider/package/windows/exe_package.rb +1 -1
- data/lib/puppet/provider/package/windows/package.rb +1 -26
- data/lib/puppet/provider/package/yum.rb +1 -1
- data/lib/puppet/provider/package/zypper.rb +22 -3
- data/lib/puppet/provider/parsedfile.rb +1 -12
- data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +1 -1
- data/lib/puppet/provider/service/base.rb +1 -1
- data/lib/puppet/provider/service/daemontools.rb +3 -3
- data/lib/puppet/provider/service/debian.rb +1 -1
- data/lib/puppet/provider/service/init.rb +14 -20
- data/lib/puppet/provider/service/openrc.rb +3 -1
- data/lib/puppet/provider/service/redhat.rb +5 -8
- data/lib/puppet/provider/service/runit.rb +3 -2
- data/lib/puppet/provider/service/systemd.rb +1 -1
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +1 -1
- data/lib/puppet/provider/sshkey/parsed.rb +0 -2
- data/lib/puppet/provider/user/aix.rb +25 -12
- data/lib/puppet/provider/user/directoryservice.rb +4 -7
- data/lib/puppet/provider/user/ldap.rb +0 -1
- data/lib/puppet/provider/user/user_role_add.rb +2 -0
- data/lib/puppet/provider/user/useradd.rb +1 -1
- data/lib/puppet/provider/zone/solaris.rb +1 -2
- data/lib/puppet/reference/metaparameter.rb +1 -1
- data/lib/puppet/reference/type.rb +1 -1
- data/lib/puppet/reports/rrdgraph.rb +1 -1
- data/lib/puppet/reports/tagmail.rb +1 -1
- data/lib/puppet/resource.rb +16 -4
- data/lib/puppet/resource/catalog.rb +111 -173
- data/lib/puppet/resource/status.rb +42 -3
- data/lib/puppet/resource/type.rb +33 -46
- data/lib/puppet/resource/type_collection.rb +19 -15
- data/lib/puppet/run.rb +5 -1
- data/lib/puppet/scheduler/scheduler.rb +14 -15
- data/lib/puppet/settings.rb +78 -41
- data/lib/puppet/settings/boolean_setting.rb +0 -2
- data/lib/puppet/settings/config_file.rb +0 -2
- data/lib/puppet/settings/directory_setting.rb +0 -2
- data/lib/puppet/settings/duration_setting.rb +0 -2
- data/lib/puppet/settings/enum_setting.rb +16 -0
- data/lib/puppet/settings/file_setting.rb +0 -2
- data/lib/puppet/settings/path_setting.rb +0 -2
- data/lib/puppet/settings/string_setting.rb +0 -3
- data/lib/puppet/settings/terminus_setting.rb +0 -2
- data/lib/puppet/ssl/certificate_authority.rb +102 -9
- data/lib/puppet/test/test_helper.rb +1 -0
- data/lib/puppet/transaction.rb +130 -292
- data/lib/puppet/transaction/additional_resource_generator.rb +126 -0
- data/lib/puppet/transaction/event.rb +16 -1
- data/lib/puppet/transaction/report.rb +34 -14
- data/lib/puppet/transaction/resource_harness.rb +16 -19
- data/lib/puppet/type.rb +59 -53
- data/lib/puppet/type/component.rb +0 -2
- data/lib/puppet/type/cron.rb +13 -2
- data/lib/puppet/type/exec.rb +5 -7
- data/lib/puppet/type/file.rb +9 -32
- data/lib/puppet/type/file/content.rb +4 -1
- data/lib/puppet/type/file/ctime.rb +3 -1
- data/lib/puppet/type/file/ensure.rb +1 -1
- data/lib/puppet/type/file/mode.rb +0 -1
- data/lib/puppet/type/file/mtime.rb +2 -1
- data/lib/puppet/type/group.rb +7 -9
- data/lib/puppet/type/host.rb +1 -2
- data/lib/puppet/type/mcx.rb +0 -1
- data/lib/puppet/type/mount.rb +38 -6
- data/lib/puppet/type/package.rb +2 -2
- data/lib/puppet/type/resources.rb +5 -4
- data/lib/puppet/type/schedule.rb +1 -4
- data/lib/puppet/type/selmodule.rb +1 -1
- data/lib/puppet/type/service.rb +1 -3
- data/lib/puppet/type/tidy.rb +3 -3
- data/lib/puppet/type/user.rb +9 -13
- data/lib/puppet/type/yumrepo.rb +11 -7
- data/lib/puppet/util.rb +14 -7
- data/lib/puppet/util/autoload.rb +0 -1
- data/lib/puppet/util/backups.rb +1 -3
- data/lib/puppet/util/classgen.rb +1 -1
- data/lib/puppet/util/command_line/puppet_option_parser.rb +1 -3
- data/lib/puppet/util/command_line/trollop.rb +1 -1
- data/lib/puppet/util/constant_inflector.rb +1 -2
- data/lib/puppet/util/errors.rb +1 -0
- data/lib/puppet/util/file_watcher.rb +28 -0
- data/lib/puppet/util/fileparsing.rb +1 -3
- data/lib/puppet/util/filetype.rb +0 -1
- data/lib/puppet/util/http_proxy.rb +38 -0
- data/lib/puppet/util/ldap/manager.rb +1 -2
- data/lib/puppet/util/log.rb +31 -10
- data/lib/puppet/util/log/destinations.rb +0 -50
- data/lib/puppet/util/metric.rb +8 -1
- data/lib/puppet/util/monkey_patches.rb +14 -148
- data/lib/puppet/util/network_device/cisco/facts.rb +1 -1
- data/lib/puppet/util/network_device/config.rb +6 -9
- data/lib/puppet/util/network_device/transport/ssh.rb +1 -1
- data/lib/puppet/util/pidlock.rb +3 -0
- data/lib/puppet/util/posix.rb +1 -1
- data/lib/puppet/util/profiler.rb +1 -1
- data/lib/puppet/util/rdoc.rb +1 -1
- data/lib/puppet/util/rdoc/generators/puppet_generator.rb +0 -1
- data/lib/puppet/util/rdoc/generators/template/puppet/puppet.rb +50 -42
- data/lib/puppet/util/retryaction.rb +0 -1
- data/lib/puppet/util/symbolic_file_mode.rb +5 -1
- data/lib/puppet/util/tagging.rb +0 -2
- data/lib/puppet/util/warnings.rb +3 -0
- data/lib/puppet/util/watched_file.rb +37 -0
- data/lib/puppet/util/watcher.rb +17 -0
- data/lib/puppet/util/watcher/change_watcher.rb +33 -0
- data/lib/puppet/util/watcher/periodic_watcher.rb +37 -0
- data/lib/puppet/util/watcher/timer.rb +19 -0
- data/lib/puppet/util/windows/user.rb +1 -1
- data/lib/puppet/version.rb +1 -1
- data/lib/puppetx.rb +109 -0
- data/lib/puppetx/puppet/bindings_scheme_handler.rb +130 -0
- data/lib/puppetx/puppet/hiera2_backend.rb +31 -0
- data/lib/puppetx/puppet/syntax_checker.rb +91 -0
- data/lib/puppetx/puppetlabs/syntax_checkers/json.rb +39 -0
- data/lib/semver.rb +1 -1
- data/man/man8/puppet-kick.8 +1 -1
- data/spec/fixtures/integration/provider/cron/crontab/unspecialized +15 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/hiera1config/binder_config.yaml +18 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/hiera1config/hiera.yaml +8 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/hiera1config/modules/good/common.yaml +1 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/hiera1config/modules/good/hiera.yaml +10 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/binder_config.yaml +19 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/common.yaml +1 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/hiera.yaml +11 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/localhost.yaml +1 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/common.yaml +3 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/hiera.yaml +13 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/lib/puppet/bindings/awesome/default.rb +4 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/lib/puppetx/awesome/echo_backend.rb +11 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/lib/puppetx/awesome/echo_scheme_handler.rb +18 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/localhost.yaml +1 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/bad/common.yaml +3 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/bad/hiera_config.yaml +9 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/good/common.yaml +2 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/good/hiera.yaml +11 -0
- data/spec/fixtures/unit/pops/binder/config/binder_config/ok/binder_config.yaml +9 -0
- data/spec/fixtures/unit/pops/binder/hiera2/bindings_provider/ok/hiera.yaml +9 -0
- data/spec/fixtures/unit/pops/binder/hiera2/bindings_provider/ok/node.example.com.json +9 -0
- data/spec/fixtures/unit/pops/binder/hiera2/bindings_provider/ok/node.example.com.yaml +5 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/bad_syntax/hiera.yaml +10 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/malformed_hierarchy/hiera.yaml +8 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/missing/foo.txt +1 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/no_backends/hiera.yaml +7 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/no_hierarchy/hiera.yaml +4 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/not_a_hash/hiera.yaml +2 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/ok/hiera.yaml +8 -0
- data/spec/fixtures/unit/pops/binder/hiera2/yaml_backend/empty/common.yaml +0 -0
- data/spec/fixtures/unit/pops/binder/hiera2/yaml_backend/invalid/common.yaml +1 -0
- data/spec/fixtures/unit/pops/binder/hiera2/yaml_backend/ok/common.yaml +2 -0
- data/spec/fixtures/unit/provider/package/openbsd/pkginfo_flavors.list +2 -0
- data/spec/integration/agent/logging_spec.rb +178 -0
- data/spec/integration/configurer_spec.rb +1 -1
- data/spec/integration/defaults_spec.rb +0 -6
- data/spec/integration/network/authconfig_spec.rb +19 -0
- data/spec/integration/network/server/webrick_spec.rb +10 -11
- data/spec/integration/parser/catalog_spec.rb +85 -0
- data/spec/integration/provider/cron/crontab_spec.rb +11 -0
- data/spec/integration/provider/mount_spec.rb +1 -0
- data/spec/integration/transaction_spec.rb +8 -8
- data/spec/integration/type/file_spec.rb +1 -1
- data/spec/integration/util/settings_spec.rb +58 -11
- data/spec/lib/matchers/include_in_order.rb +21 -0
- data/spec/lib/matchers/include_in_order_spec.rb +30 -0
- data/spec/lib/matchers/relationship_graph_matchers.rb +48 -0
- data/spec/lib/puppet_spec/compiler.rb +24 -0
- data/spec/lib/puppet_spec/pops.rb +16 -0
- data/spec/spec_helper.rb +0 -1
- data/spec/unit/application/agent_spec.rb +145 -145
- data/spec/unit/application/apply_spec.rb +1 -1
- data/spec/unit/application/doc_spec.rb +1 -1
- data/spec/unit/application/face_base_spec.rb +3 -3
- data/spec/unit/application/facts_spec.rb +1 -0
- data/spec/unit/application/master_spec.rb +0 -15
- data/spec/unit/application/queue_spec.rb +6 -12
- data/spec/unit/application/resource_spec.rb +1 -1
- data/spec/unit/configurer/fact_handler_spec.rb +19 -50
- data/spec/unit/configurer_spec.rb +23 -7
- data/spec/unit/daemon_spec.rb +97 -121
- data/spec/unit/defaults_spec.rb +44 -0
- data/spec/unit/face/node_spec.rb +2 -2
- data/spec/unit/file_serving/configuration/parser_spec.rb +23 -33
- data/spec/unit/file_serving/configuration_spec.rb +2 -2
- data/spec/unit/file_serving/mount/file_spec.rb +4 -4
- data/spec/unit/forge/repository_spec.rb +9 -29
- data/spec/unit/graph/key_spec.rb +41 -0
- data/spec/unit/{rb_tree_map_spec.rb → graph/rb_tree_map_spec.rb} +7 -7
- data/spec/unit/graph/relationship_graph_spec.rb +393 -0
- data/spec/unit/graph/sequential_prioritizer_spec.rb +32 -0
- data/spec/unit/{simple_graph_spec.rb → graph/simple_graph.rb} +42 -254
- data/spec/unit/graph/title_hash_prioritizer_spec.rb +49 -0
- data/spec/unit/hiera_puppet_spec.rb +1 -1
- data/spec/unit/indirector/catalog/active_record_spec.rb +4 -2
- data/spec/unit/indirector/catalog/compiler_spec.rb +20 -26
- data/spec/unit/indirector/face_spec.rb +1 -1
- data/spec/unit/indirector/facts/facter_spec.rb +11 -1
- data/spec/unit/indirector/facts/network_device_spec.rb +11 -1
- data/spec/unit/indirector/hiera_spec.rb +1 -1
- data/spec/unit/indirector/instrumentation_data/local_spec.rb +1 -1
- data/spec/unit/indirector/instrumentation_listener/local_spec.rb +1 -1
- data/spec/unit/indirector/request_spec.rb +92 -39
- data/spec/unit/indirector/rest_spec.rb +1 -0
- data/spec/unit/indirector_spec.rb +2 -2
- data/spec/unit/interface/option_builder_spec.rb +1 -0
- data/spec/unit/interface/option_spec.rb +1 -0
- data/spec/unit/interface_spec.rb +2 -2
- data/spec/unit/module_tool/applications/installer_spec.rb +49 -2
- data/spec/unit/module_tool/metadata_spec.rb +13 -0
- data/spec/unit/network/authstore_spec.rb +1 -1
- data/spec/unit/network/format_handler_spec.rb +33 -282
- data/spec/unit/network/format_support_spec.rb +199 -0
- data/spec/unit/network/formats_spec.rb +2 -2
- data/spec/unit/network/http/connection_spec.rb +88 -7
- data/spec/unit/network/http/handler_spec.rb +271 -249
- data/spec/unit/network/http/rack/rest_spec.rb +1 -1
- data/spec/unit/network/http/webrick/rest_spec.rb +73 -22
- data/spec/unit/network/http_pool_spec.rb +40 -0
- data/spec/unit/network/server_spec.rb +18 -207
- data/spec/unit/node/facts_spec.rb +68 -17
- data/spec/unit/other/selinux_spec.rb +24 -20
- data/spec/unit/parameter/boolean_spec.rb +25 -0
- data/spec/unit/parameter/value_collection_spec.rb +7 -7
- data/spec/unit/parameter_spec.rb +10 -13
- data/spec/unit/parser/ast/function_spec.rb +4 -4
- data/spec/unit/parser/ast/leaf_spec.rb +45 -6
- data/spec/unit/parser/collector_spec.rb +3 -3
- data/spec/unit/parser/compiler_spec.rb +4 -3
- data/spec/unit/parser/functions/create_resources_spec.rb +9 -25
- data/spec/unit/parser/functions/extlookup_spec.rb +2 -2
- data/spec/unit/parser/functions/hiera_include_spec.rb +12 -0
- data/spec/unit/parser/functions/lookup_spec.rb +96 -0
- data/spec/unit/parser/functions/regsubst_spec.rb +2 -2
- data/spec/unit/parser/functions/split_spec.rb +2 -2
- data/spec/unit/parser/functions/sprintf_spec.rb +1 -1
- data/spec/unit/parser/functions/versioncmp_spec.rb +2 -2
- data/spec/unit/parser/functions_spec.rb +7 -7
- data/spec/unit/parser/lexer_spec.rb +1 -1
- data/spec/unit/parser/methods/collect_spec.rb +43 -0
- data/spec/unit/parser/resource_spec.rb +9 -9
- data/spec/unit/parser/scope_spec.rb +45 -2
- data/spec/unit/parser/type_loader_spec.rb +159 -175
- data/spec/unit/pops/binder/binder_spec.rb +62 -0
- data/spec/unit/pops/binder/bindings_checker_spec.rb +196 -0
- data/spec/unit/pops/binder/bindings_composer_spec.rb +89 -0
- data/spec/unit/pops/binder/bindings_validator_factory_spec.rb +18 -0
- data/spec/unit/pops/binder/config/binder_config_spec.rb +48 -0
- data/spec/unit/pops/binder/hiera2/bindings_provider_spec.rb +74 -0
- data/spec/unit/pops/binder/hiera2/config_spec.rb +61 -0
- data/spec/unit/pops/binder/hiera2/yaml_backend_spec.rb +33 -0
- data/spec/unit/pops/binder/injector_spec.rb +789 -0
- data/spec/unit/pops/containment_spec.rb +1 -0
- data/spec/unit/pops/issues_spec.rb +1 -1
- data/spec/unit/pops/parser/evaluating_parser_spec.rb +88 -0
- data/spec/unit/pops/parser/lexer_spec.rb +1 -1
- data/spec/unit/pops/parser/parse_calls_spec.rb +4 -0
- data/spec/unit/pops/parser/parser_spec.rb +1 -1
- data/spec/unit/pops/types/type_calculator_spec.rb +484 -0
- data/spec/unit/pops/types/type_factory_spec.rb +65 -0
- data/spec/unit/pops/types/type_parser_spec.rb +93 -0
- data/spec/unit/property/list_spec.rb +1 -1
- data/spec/unit/property/ordered_list_spec.rb +1 -1
- data/spec/unit/provider/aixobject_spec.rb +101 -0
- data/spec/unit/provider/augeas/augeas_spec.rb +14 -3
- data/spec/unit/provider/mcx/mcxcontent_spec.rb +52 -16
- data/spec/unit/provider/mount/parsed_spec.rb +44 -56
- data/spec/unit/provider/mount_spec.rb +11 -2
- data/spec/unit/provider/naginator_spec.rb +8 -0
- data/spec/unit/provider/package/apt_spec.rb +5 -1
- data/spec/unit/provider/package/aptitude_spec.rb +9 -5
- data/spec/unit/provider/package/aptrpm_spec.rb +2 -2
- data/spec/unit/provider/package/dpkg_spec.rb +274 -99
- data/spec/unit/provider/package/openbsd_spec.rb +84 -1
- data/spec/unit/provider/package/opkg_spec.rb +3 -3
- data/spec/unit/provider/package/pip_spec.rb +16 -0
- data/spec/unit/provider/package/pkgdmg_spec.rb +62 -7
- data/spec/unit/provider/package/rpm_spec.rb +112 -21
- data/spec/unit/provider/package/urpmi.rb +80 -0
- data/spec/unit/provider/package/windows/exe_package_spec.rb +1 -1
- data/spec/unit/provider/package/yum_spec.rb +85 -0
- data/spec/unit/provider/package/zypper_spec.rb +25 -6
- data/spec/unit/provider/parsedfile_spec.rb +3 -2
- data/spec/unit/provider/service/init_spec.rb +10 -10
- data/spec/unit/provider/service/openrc_spec.rb +16 -0
- data/spec/unit/provider/service/openwrt_spec.rb +1 -1
- data/spec/unit/provider/service/redhat_spec.rb +7 -0
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +2 -2
- data/spec/unit/provider/user/aix_spec.rb +89 -0
- data/spec/unit/provider/user/directoryservice_spec.rb +11 -4
- data/spec/unit/provider/user/user_role_add_spec.rb +18 -0
- data/spec/unit/provider_spec.rb +2 -13
- data/spec/unit/reports/http_spec.rb +1 -1
- data/spec/unit/resource/catalog_spec.rb +23 -97
- data/spec/unit/resource/resource_type.json +34 -0
- data/spec/unit/resource/status_spec.rb +56 -0
- data/spec/unit/resource/type_collection_spec.rb +6 -6
- data/spec/unit/resource/type_spec.rb +25 -5
- data/spec/unit/resource_spec.rb +68 -24
- data/spec/unit/run_spec.rb +16 -0
- data/spec/unit/scheduler/scheduler_spec.rb +14 -27
- data/spec/unit/semver_spec.rb +5 -0
- data/spec/unit/settings/enum_setting_spec.rb +27 -0
- data/spec/unit/settings_spec.rb +53 -44
- data/spec/unit/ssl/certificate_authority_spec.rb +155 -19
- data/spec/unit/transaction/additional_resource_generator_spec.rb +419 -0
- data/spec/unit/transaction/event_manager_spec.rb +2 -2
- data/spec/unit/transaction/event_spec.rb +57 -0
- data/spec/unit/transaction/report_spec.rb +66 -0
- data/spec/unit/transaction/resource_harness_spec.rb +27 -20
- data/spec/unit/transaction_spec.rb +182 -390
- data/spec/unit/type/augeas_spec.rb +3 -3
- data/spec/unit/type/component_spec.rb +0 -9
- data/spec/unit/type/computer_spec.rb +1 -1
- data/spec/unit/type/cron_spec.rb +2 -2
- data/spec/unit/type/exec_spec.rb +4 -2
- data/spec/unit/type/file/content_spec.rb +11 -0
- data/spec/unit/type/file/group_spec.rb +1 -1
- data/spec/unit/type/file_spec.rb +16 -8
- data/spec/unit/type/mount_spec.rb +445 -259
- data/spec/unit/type/package_spec.rb +4 -4
- data/spec/unit/type/resources_spec.rb +30 -1
- data/spec/unit/type/user_spec.rb +26 -3
- data/spec/unit/type/yumrepo_spec.rb +7 -27
- data/spec/unit/type/zone_spec.rb +4 -1
- data/spec/unit/type_spec.rb +66 -33
- data/spec/unit/util/backups_spec.rb +3 -3
- data/spec/unit/util/http_proxy_spec.rb +83 -0
- data/spec/unit/util/log_spec.rb +79 -8
- data/spec/unit/util/metric_spec.rb +12 -0
- data/spec/unit/util/monkey_patches_spec.rb +6 -0
- data/spec/unit/util/network_device/config_spec.rb +26 -64
- data/spec/unit/util/pidlock_spec.rb +4 -1
- data/spec/unit/util/tagging_spec.rb +5 -9
- data/spec/unit/util/warnings_spec.rb +1 -1
- data/spec/unit/util/watched_file_spec.rb +52 -0
- data/spec/unit/util/watcher/periodic_watcher_spec.rb +52 -0
- data/spec/unit/util/watcher_spec.rb +56 -0
- data/spec/unit/util_spec.rb +16 -0
- metadata +2767 -2576
- data/ext/debian/puppet.manpages +0 -32
- data/ext/osx/PackageInfo.plist +0 -36
- data/ext/osx/createpackage.sh +0 -187
- data/ext/redhat/rundir-perms.patch +0 -28
- data/lib/puppet/external/base64.rb +0 -19
- data/lib/puppet/util/graph.rb +0 -27
- data/lib/puppet/util/loadedfile.rb +0 -61
- data/lib/puppet/util/log_paths.rb +0 -22
- data/lib/puppet/util/subclass_loader.rb +0 -78
- data/spec/monkey_patches/publicize_methods.rb +0 -11
- data/spec/unit/util/loadedfile_spec.rb +0 -71
@@ -0,0 +1,16 @@
|
|
1
|
+
class Puppet::Settings::EnumSetting < Puppet::Settings::BaseSetting
|
2
|
+
attr_accessor :values
|
3
|
+
|
4
|
+
def type
|
5
|
+
:enum
|
6
|
+
end
|
7
|
+
|
8
|
+
def munge(value)
|
9
|
+
if values.include?(value)
|
10
|
+
value
|
11
|
+
else
|
12
|
+
raise Puppet::Settings::ValidationError,
|
13
|
+
"Invalid value '#{value}' for parameter #{@name}. Allowed values are '#{values.join("', '")}'"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -84,7 +84,10 @@ class Puppet::SSL::CertificateAuthority
|
|
84
84
|
store = autosign_store(auto) if auto != true
|
85
85
|
|
86
86
|
Puppet::SSL::CertificateRequest.indirection.search("*").each do |csr|
|
87
|
-
|
87
|
+
if auto == true or store.allowed?(csr.name, "127.1.1.1")
|
88
|
+
Puppet.info "Autosigning #{csr.name}"
|
89
|
+
sign(csr.name)
|
90
|
+
end
|
88
91
|
end
|
89
92
|
end
|
90
93
|
|
@@ -128,16 +131,18 @@ class Puppet::SSL::CertificateAuthority
|
|
128
131
|
end
|
129
132
|
|
130
133
|
# Generate a new certificate.
|
134
|
+
# @return Puppet::SSL::Certificate
|
131
135
|
def generate(name, options = {})
|
132
136
|
raise ArgumentError, "A Certificate already exists for #{name}" if Puppet::SSL::Certificate.indirection.find(name)
|
133
|
-
host = Puppet::SSL::Host.new(name)
|
134
137
|
|
135
138
|
# Pass on any requested subjectAltName field.
|
136
139
|
san = options[:dns_alt_names]
|
137
140
|
|
138
141
|
host = Puppet::SSL::Host.new(name)
|
139
142
|
host.generate_certificate_request(:dns_alt_names => san)
|
140
|
-
|
143
|
+
# CSR may have been implicitly autosigned, generating a certificate
|
144
|
+
# Or sign explicitly
|
145
|
+
host.certificate || sign(name, !!san)
|
141
146
|
end
|
142
147
|
|
143
148
|
# Generate our CA certificate.
|
@@ -192,9 +197,26 @@ class Puppet::SSL::CertificateAuthority
|
|
192
197
|
pass
|
193
198
|
end
|
194
199
|
|
195
|
-
#
|
200
|
+
# Lists the names of all signed certificates.
|
201
|
+
#
|
202
|
+
# @return [Array<String>]
|
196
203
|
def list
|
197
|
-
|
204
|
+
list_certificates.collect { |c| c.name }
|
205
|
+
end
|
206
|
+
|
207
|
+
# Return all the certificate objects as found by the indirector
|
208
|
+
# API for PE license checking.
|
209
|
+
#
|
210
|
+
# Created to prevent the case of reading all certs from disk, getting
|
211
|
+
# just their names and verifying the cert for each name, which then
|
212
|
+
# causes the cert to again be read from disk.
|
213
|
+
#
|
214
|
+
# @author Jeff Weiss <jeff.weiss@puppetlabs.com>
|
215
|
+
# @api Puppet Enterprise Licensing
|
216
|
+
#
|
217
|
+
# @return [Array<Puppet::SSL::Certificate>]
|
218
|
+
def list_certificates
|
219
|
+
Puppet::SSL::Certificate.indirection.search("*")
|
198
220
|
end
|
199
221
|
|
200
222
|
# Read the next serial from the serial file, and increment the
|
@@ -354,16 +376,87 @@ class Puppet::SSL::CertificateAuthority
|
|
354
376
|
return true # good enough for us!
|
355
377
|
end
|
356
378
|
|
357
|
-
#
|
358
|
-
|
359
|
-
|
360
|
-
|
379
|
+
# Utility method for optionally caching the X509 Store for verifying a
|
380
|
+
# large number of certificates in a short amount of time--exactly the
|
381
|
+
# case we have during PE license checking.
|
382
|
+
#
|
383
|
+
# @example Use the cached X509 store
|
384
|
+
# x509store(:cache => true)
|
385
|
+
#
|
386
|
+
# @example Use a freshly create X509 store
|
387
|
+
# x509store
|
388
|
+
# x509store(:cache => false)
|
389
|
+
#
|
390
|
+
# @param [Hash] options the options used for retrieving the X509 Store
|
391
|
+
# @option options [Boolean] :cache whether or not to use a cached version
|
392
|
+
# of the X509 Store
|
393
|
+
#
|
394
|
+
# @return [OpenSSL::X509::Store]
|
395
|
+
def x509_store(options = {})
|
396
|
+
if (options[:cache])
|
397
|
+
return @x509store unless @x509store.nil?
|
398
|
+
@x509store = create_x509_store
|
399
|
+
else
|
400
|
+
create_x509_store
|
361
401
|
end
|
402
|
+
end
|
403
|
+
private :x509_store
|
404
|
+
|
405
|
+
# Creates a brand new OpenSSL::X509::Store with the appropriate
|
406
|
+
# Certificate Revocation List and flags
|
407
|
+
#
|
408
|
+
# @return [OpenSSL::X509::Store]
|
409
|
+
def create_x509_store
|
362
410
|
store = OpenSSL::X509::Store.new
|
363
411
|
store.add_file Puppet[:cacert]
|
364
412
|
store.add_crl crl.content if self.crl
|
365
413
|
store.purpose = OpenSSL::X509::PURPOSE_SSL_CLIENT
|
366
414
|
store.flags = OpenSSL::X509::V_FLAG_CRL_CHECK_ALL|OpenSSL::X509::V_FLAG_CRL_CHECK if Puppet.settings[:certificate_revocation]
|
415
|
+
store
|
416
|
+
end
|
417
|
+
private :create_x509_store
|
418
|
+
|
419
|
+
# Utility method which is API for PE license checking.
|
420
|
+
# This is used rather than `verify` because
|
421
|
+
# 1) We have already read the certificate from disk into memory.
|
422
|
+
# To read the certificate from disk again is just wasteful.
|
423
|
+
# 2) Because we're checking a large number of certificates against
|
424
|
+
# a transient CertificateAuthority, we can relatively safely cache
|
425
|
+
# the X509 Store that actually does the verification.
|
426
|
+
#
|
427
|
+
# Long running instances of CertificateAuthority will certainly
|
428
|
+
# want to use `verify` because it will recreate the X509 Store with
|
429
|
+
# the absolutely latest CRL.
|
430
|
+
#
|
431
|
+
# Additionally, this method explicitly returns a boolean whereas
|
432
|
+
# `verify` will raise an error if the certificate has been revoked.
|
433
|
+
#
|
434
|
+
# @author Jeff Weiss <jeff.weiss@puppetlabs.com>
|
435
|
+
# @api Puppet Enterprise Licensing
|
436
|
+
#
|
437
|
+
# @param cert [Puppet::SSL::Certificate] the certificate to check validity of
|
438
|
+
#
|
439
|
+
# @return [Boolean] true if signed, false if unsigned or revoked
|
440
|
+
def certificate_is_alive?(cert)
|
441
|
+
x509_store(:cache => true).verify(cert.content)
|
442
|
+
end
|
443
|
+
|
444
|
+
# Verify a given host's certificate. The certname is passed in, and
|
445
|
+
# the indirector will be used to locate the actual contents of the
|
446
|
+
# certificate with that name.
|
447
|
+
#
|
448
|
+
# @param name [String] certificate name to verify
|
449
|
+
#
|
450
|
+
# @raise [ArgumentError] if the certificate name cannot be found
|
451
|
+
# (i.e. doesn't exist or is unsigned)
|
452
|
+
# @raise [CertificateVerficationError] if the certificate has been revoked
|
453
|
+
#
|
454
|
+
# @return [Boolean] true if signed, there are no cases where false is returned
|
455
|
+
def verify(name)
|
456
|
+
unless cert = Puppet::SSL::Certificate.indirection.find(name)
|
457
|
+
raise ArgumentError, "Could not find a certificate for #{name}"
|
458
|
+
end
|
459
|
+
store = x509_store
|
367
460
|
|
368
461
|
raise CertificateVerificationError.new(store.error), store.error_string unless store.verify(cert.content)
|
369
462
|
end
|
data/lib/puppet/transaction.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
|
-
# the class that actually walks our resource/property tree, collects the changes,
|
2
|
-
# and performs them
|
3
|
-
|
4
1
|
require 'puppet'
|
5
2
|
require 'puppet/util/tagging'
|
6
3
|
require 'puppet/application'
|
7
4
|
require 'digest/sha1'
|
8
5
|
|
6
|
+
# the class that actually walks our resource/property tree, collects the changes,
|
7
|
+
# and performs them
|
8
|
+
#
|
9
|
+
# @api private
|
9
10
|
class Puppet::Transaction
|
11
|
+
require 'puppet/transaction/additional_resource_generator'
|
10
12
|
require 'puppet/transaction/event'
|
11
13
|
require 'puppet/transaction/event_manager'
|
12
14
|
require 'puppet/transaction/resource_harness'
|
@@ -23,19 +25,93 @@ class Puppet::Transaction
|
|
23
25
|
# Handles most of the actual interacting with resources
|
24
26
|
attr_reader :resource_harness
|
25
27
|
|
28
|
+
attr_reader :prefetched_providers
|
29
|
+
|
26
30
|
include Puppet::Util
|
27
31
|
include Puppet::Util::Tagging
|
28
32
|
|
29
|
-
|
30
|
-
|
31
|
-
|
33
|
+
def initialize(catalog, report, prioritizer)
|
34
|
+
@catalog = catalog
|
35
|
+
|
36
|
+
@report = report || Puppet::Transaction::Report.new("apply", catalog.version, catalog.environment)
|
37
|
+
|
38
|
+
@prioritizer = prioritizer
|
39
|
+
|
40
|
+
@report.add_times(:config_retrieval, @catalog.retrieval_duration || 0)
|
41
|
+
|
42
|
+
@event_manager = Puppet::Transaction::EventManager.new(self)
|
43
|
+
|
44
|
+
@resource_harness = Puppet::Transaction::ResourceHarness.new(self)
|
45
|
+
|
46
|
+
@prefetched_providers = Hash.new { |h,k| h[k] = {} }
|
32
47
|
end
|
33
48
|
|
34
|
-
#
|
35
|
-
|
36
|
-
|
37
|
-
|
49
|
+
# This method does all the actual work of running a transaction. It
|
50
|
+
# collects all of the changes, executes them, and responds to any
|
51
|
+
# necessary events.
|
52
|
+
def evaluate(&block)
|
53
|
+
block ||= method(:eval_resource)
|
54
|
+
generator = AdditionalResourceGenerator.new(@catalog, relationship_graph, @prioritizer)
|
55
|
+
@catalog.vertices.each { |resource| generator.generate_additional_resources(resource) }
|
56
|
+
|
57
|
+
Puppet.info "Applying configuration version '#{catalog.version}'" if catalog.version
|
58
|
+
|
59
|
+
continue_while = lambda { !stop_processing? }
|
60
|
+
|
61
|
+
pre_process = lambda do |resource|
|
62
|
+
prefetch_if_necessary(resource)
|
63
|
+
|
64
|
+
# If we generated resources, we don't know what they are now
|
65
|
+
# blocking, so we opt to recompute it, rather than try to track every
|
66
|
+
# change that would affect the number.
|
67
|
+
relationship_graph.clear_blockers if generator.eval_generate(resource)
|
38
68
|
end
|
69
|
+
|
70
|
+
providerless_types = []
|
71
|
+
overly_deferred_resource_handler = lambda do |resource|
|
72
|
+
# We don't automatically assign unsuitable providers, so if there
|
73
|
+
# is one, it must have been selected by the user.
|
74
|
+
if resource.provider
|
75
|
+
resource.err "Provider #{resource.provider.class.name} is not functional on this host"
|
76
|
+
else
|
77
|
+
providerless_types << resource.type
|
78
|
+
end
|
79
|
+
|
80
|
+
resource_status(resource).failed = true
|
81
|
+
end
|
82
|
+
|
83
|
+
canceled_resource_handler = lambda do |resource|
|
84
|
+
resource_status(resource).skipped = true
|
85
|
+
resource.debug "Transaction canceled, skipping"
|
86
|
+
end
|
87
|
+
|
88
|
+
teardown = lambda do
|
89
|
+
# Just once per type. No need to punish the user.
|
90
|
+
providerless_types.uniq.each do |type|
|
91
|
+
Puppet.err "Could not find a suitable provider for #{type}"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
relationship_graph.traverse(:while => continue_while,
|
96
|
+
:pre_process => pre_process,
|
97
|
+
:overly_deferred_resource_handler => overly_deferred_resource_handler,
|
98
|
+
:canceled_resource_handler => canceled_resource_handler,
|
99
|
+
:teardown => teardown) do |resource|
|
100
|
+
if resource.is_a?(Puppet::Type::Component)
|
101
|
+
Puppet.warning "Somehow left a component in the relationship graph"
|
102
|
+
else
|
103
|
+
resource.info "Starting to evaluate the resource" if Puppet[:evaltrace] and @catalog.host_config?
|
104
|
+
seconds = thinmark { block.call(resource) }
|
105
|
+
resource.info "Evaluated in %0.2f seconds" % seconds if Puppet[:evaltrace] and @catalog.host_config?
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
Puppet.debug "Finishing transaction #{object_id}"
|
110
|
+
end
|
111
|
+
|
112
|
+
# Wraps application run state check to flag need to interrupt processing
|
113
|
+
def stop_processing?
|
114
|
+
Puppet::Application.stop_requested? && catalog.host_config?
|
39
115
|
end
|
40
116
|
|
41
117
|
# Are there any failed resources in this transaction?
|
@@ -43,35 +119,50 @@ class Puppet::Transaction
|
|
43
119
|
report.resource_statuses.values.detect { |status| status.failed? }
|
44
120
|
end
|
45
121
|
|
46
|
-
# Apply all changes for a resource
|
47
|
-
def apply(resource, ancestor = nil)
|
48
|
-
status = resource_harness.evaluate(resource)
|
49
|
-
add_resource_status(status)
|
50
|
-
event_manager.queue_events(ancestor || resource, status.events) unless status.failed?
|
51
|
-
rescue => detail
|
52
|
-
resource.err "Could not evaluate: #{detail}"
|
53
|
-
end
|
54
|
-
|
55
122
|
# Find all of the changed resources.
|
56
123
|
def changed?
|
57
124
|
report.resource_statuses.values.find_all { |status| status.changed }.collect { |status| catalog.resource(status.resource) }
|
58
125
|
end
|
59
126
|
|
60
|
-
|
61
|
-
|
62
|
-
report.resource_statuses.values.collect { |status| catalog.resource(status.resource) }
|
127
|
+
def relationship_graph
|
128
|
+
catalog.relationship_graph
|
63
129
|
end
|
64
130
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
131
|
+
def resource_status(resource)
|
132
|
+
report.resource_statuses[resource.to_s] || add_resource_status(Puppet::Resource::Status.new(resource))
|
133
|
+
end
|
134
|
+
|
135
|
+
# The tags we should be checking.
|
136
|
+
def tags
|
137
|
+
self.tags = Puppet[:tags] unless defined?(@tags)
|
138
|
+
|
139
|
+
super
|
140
|
+
end
|
141
|
+
|
142
|
+
def prefetch_if_necessary(resource)
|
143
|
+
provider_class = resource.provider.class
|
144
|
+
return unless provider_class.respond_to?(:prefetch) and !prefetched_providers[resource.type][provider_class.name]
|
145
|
+
|
146
|
+
resources = resources_by_provider(resource.type, provider_class.name)
|
147
|
+
|
148
|
+
if provider_class == resource.class.defaultprovider
|
149
|
+
providerless_resources = resources_by_provider(resource.type, nil)
|
150
|
+
providerless_resources.values.each {|res| res.provider = provider_class.name}
|
151
|
+
resources.merge! providerless_resources
|
74
152
|
end
|
153
|
+
|
154
|
+
prefetch(provider_class, resources)
|
155
|
+
end
|
156
|
+
|
157
|
+
private
|
158
|
+
|
159
|
+
# Apply all changes for a resource
|
160
|
+
def apply(resource, ancestor = nil)
|
161
|
+
status = resource_harness.evaluate(resource)
|
162
|
+
add_resource_status(status)
|
163
|
+
event_manager.queue_events(ancestor || resource, status.events) unless status.failed?
|
164
|
+
rescue => detail
|
165
|
+
resource.err "Could not evaluate: #{detail}"
|
75
166
|
end
|
76
167
|
|
77
168
|
# Evaluate a single resource.
|
@@ -87,31 +178,6 @@ class Puppet::Transaction
|
|
87
178
|
event_manager.process_events(resource)
|
88
179
|
end
|
89
180
|
|
90
|
-
# This method does all the actual work of running a transaction. It
|
91
|
-
# collects all of the changes, executes them, and responds to any
|
92
|
-
# necessary events.
|
93
|
-
def evaluate
|
94
|
-
add_dynamically_generated_resources
|
95
|
-
|
96
|
-
Puppet.info "Applying configuration version '#{catalog.version}'" if catalog.version
|
97
|
-
|
98
|
-
relationship_graph.traverse do |resource|
|
99
|
-
if resource.is_a?(Puppet::Type::Component)
|
100
|
-
Puppet.warning "Somehow left a component in the relationship graph"
|
101
|
-
else
|
102
|
-
resource.info "Starting to evaluate the resource" if Puppet[:evaltrace] and @catalog.host_config?
|
103
|
-
seconds = thinmark { eval_resource(resource) }
|
104
|
-
resource.info "Evaluated in %0.2f seconds" % seconds if Puppet[:evaltrace] and @catalog.host_config?
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
Puppet.debug "Finishing transaction #{object_id}"
|
109
|
-
end
|
110
|
-
|
111
|
-
def events
|
112
|
-
event_manager.events
|
113
|
-
end
|
114
|
-
|
115
181
|
def failed?(resource)
|
116
182
|
s = resource_status(resource) and s.failed?
|
117
183
|
end
|
@@ -144,56 +210,6 @@ class Puppet::Transaction
|
|
144
210
|
found_failed
|
145
211
|
end
|
146
212
|
|
147
|
-
def eval_generate(resource)
|
148
|
-
return false unless resource.respond_to?(:eval_generate)
|
149
|
-
raise Puppet::DevError,"Depthfirst resources are not supported by eval_generate" if resource.depthfirst?
|
150
|
-
begin
|
151
|
-
made = resource.eval_generate.uniq
|
152
|
-
return false if made.empty?
|
153
|
-
made = Hash[made.map(&:name).zip(made)]
|
154
|
-
rescue => detail
|
155
|
-
resource.log_exception(detail, "Failed to generate additional resources using 'eval_generate: #{detail}")
|
156
|
-
return false
|
157
|
-
end
|
158
|
-
made.values.each do |res|
|
159
|
-
begin
|
160
|
-
res.tag(*resource.tags)
|
161
|
-
@catalog.add_resource(res)
|
162
|
-
res.finish
|
163
|
-
rescue Puppet::Resource::Catalog::DuplicateResourceError
|
164
|
-
res.info "Duplicate generated resource; skipping"
|
165
|
-
end
|
166
|
-
end
|
167
|
-
sentinel = Puppet::Type.type(:whit).new(:name => "completed_#{resource.title}", :catalog => resource.catalog)
|
168
|
-
|
169
|
-
# The completed whit is now the thing that represents the resource is done
|
170
|
-
relationship_graph.adjacent(resource,:direction => :out,:type => :edges).each { |e|
|
171
|
-
# But children run as part of the resource, not after it
|
172
|
-
next if made[e.target.name]
|
173
|
-
|
174
|
-
add_conditional_directed_dependency(sentinel, e.target, e.label)
|
175
|
-
relationship_graph.remove_edge! e
|
176
|
-
}
|
177
|
-
|
178
|
-
default_label = Puppet::Resource::Catalog::Default_label
|
179
|
-
made.values.each do |res|
|
180
|
-
# Depend on the nearest ancestor we generated, falling back to the
|
181
|
-
# resource if we have none
|
182
|
-
parent_name = res.ancestors.find { |a| made[a] and made[a] != res }
|
183
|
-
parent = made[parent_name] || resource
|
184
|
-
|
185
|
-
add_conditional_directed_dependency(parent, res)
|
186
|
-
|
187
|
-
# This resource isn't 'completed' until each child has run
|
188
|
-
add_conditional_directed_dependency(res, sentinel, default_label)
|
189
|
-
end
|
190
|
-
|
191
|
-
# This edge allows the resource's events to propagate, though it isn't
|
192
|
-
# strictly necessary for ordering purposes
|
193
|
-
add_conditional_directed_dependency(resource, sentinel, default_label)
|
194
|
-
true
|
195
|
-
end
|
196
|
-
|
197
213
|
# A general method for recursively generating new resources from a
|
198
214
|
# resource.
|
199
215
|
def generate_additional_resources(resource)
|
@@ -218,29 +234,11 @@ class Puppet::Transaction
|
|
218
234
|
end
|
219
235
|
end
|
220
236
|
|
221
|
-
def add_dynamically_generated_resources
|
222
|
-
@catalog.vertices.each { |resource| generate_additional_resources(resource) }
|
223
|
-
end
|
224
|
-
|
225
237
|
# Should we ignore tags?
|
226
238
|
def ignore_tags?
|
227
239
|
! @catalog.host_config?
|
228
240
|
end
|
229
241
|
|
230
|
-
# this should only be called by a Puppet::Type::Component resource now
|
231
|
-
# and it should only receive an array
|
232
|
-
def initialize(catalog, report = nil)
|
233
|
-
@catalog = catalog
|
234
|
-
|
235
|
-
@report = report || Puppet::Transaction::Report.new("apply", catalog.version, catalog.environment)
|
236
|
-
|
237
|
-
@event_manager = Puppet::Transaction::EventManager.new(self)
|
238
|
-
|
239
|
-
@resource_harness = Puppet::Transaction::ResourceHarness.new(self)
|
240
|
-
|
241
|
-
@prefetched_providers = Hash.new { |h,k| h[k] = {} }
|
242
|
-
end
|
243
|
-
|
244
242
|
def resources_by_provider(type_name, provider_name)
|
245
243
|
unless @resources_by_provider
|
246
244
|
@resources_by_provider = Hash.new { |h, k| h[k] = Hash.new { |h, k| h[k] = {} } }
|
@@ -256,23 +254,6 @@ class Puppet::Transaction
|
|
256
254
|
@resources_by_provider[type_name][provider_name] || {}
|
257
255
|
end
|
258
256
|
|
259
|
-
def prefetch_if_necessary(resource)
|
260
|
-
provider_class = resource.provider.class
|
261
|
-
return unless provider_class.respond_to?(:prefetch) and !prefetched_providers[resource.type][provider_class.name]
|
262
|
-
|
263
|
-
resources = resources_by_provider(resource.type, provider_class.name)
|
264
|
-
|
265
|
-
if provider_class == resource.class.defaultprovider
|
266
|
-
providerless_resources = resources_by_provider(resource.type, nil)
|
267
|
-
providerless_resources.values.each {|res| res.provider = provider_class.name}
|
268
|
-
resources.merge! providerless_resources
|
269
|
-
end
|
270
|
-
|
271
|
-
prefetch(provider_class, resources)
|
272
|
-
end
|
273
|
-
|
274
|
-
attr_reader :prefetched_providers
|
275
|
-
|
276
257
|
# Prefetch any providers that support it, yo. We don't support prefetching
|
277
258
|
# types, just providers.
|
278
259
|
def prefetch(provider_class, resources)
|
@@ -287,155 +268,13 @@ class Puppet::Transaction
|
|
287
268
|
@prefetched_providers[type_name][provider_class.name] = true
|
288
269
|
end
|
289
270
|
|
290
|
-
# We want to monitor changes in the relationship graph of our
|
291
|
-
# catalog but this is complicated by the fact that the catalog
|
292
|
-
# both is_a graph and has_a graph, by the fact that changes to
|
293
|
-
# the structure of the object can have adverse serialization
|
294
|
-
# effects, by threading issues, by order-of-initialization issues,
|
295
|
-
# etc.
|
296
|
-
#
|
297
|
-
# Since the proper lifetime/scope of the monitoring is a transaction
|
298
|
-
# and the transaction is already commiting a mild law-of-demeter
|
299
|
-
# transgression, we cut the Gordian knot here by simply wrapping the
|
300
|
-
# transaction's view of the resource graph to capture and maintain
|
301
|
-
# the information we need. Nothing outside the transaction needs
|
302
|
-
# this information, and nothing outside the transaction can see it
|
303
|
-
# except via the Transaction#relationship_graph
|
304
|
-
|
305
|
-
class Relationship_graph_wrapper
|
306
|
-
require 'puppet/rb_tree_map'
|
307
|
-
attr_reader :real_graph,:transaction,:ready,:generated,:done,:blockers,:unguessable_deterministic_key
|
308
|
-
def initialize(real_graph,transaction)
|
309
|
-
@real_graph = real_graph
|
310
|
-
@transaction = transaction
|
311
|
-
@ready = Puppet::RbTreeMap.new
|
312
|
-
@generated = {}
|
313
|
-
@done = {}
|
314
|
-
@blockers = {}
|
315
|
-
@unguessable_deterministic_key = Hash.new { |h,k| h[k] = Digest::SHA1.hexdigest("NaCl, MgSO4 (salts) and then #{k.ref}") }
|
316
|
-
@providerless_types = []
|
317
|
-
end
|
318
|
-
def method_missing(*args,&block)
|
319
|
-
real_graph.send(*args,&block)
|
320
|
-
end
|
321
|
-
def add_vertex(v)
|
322
|
-
real_graph.add_vertex(v)
|
323
|
-
end
|
324
|
-
def add_edge(f,t,label=nil)
|
325
|
-
key = unguessable_deterministic_key[t]
|
326
|
-
|
327
|
-
ready.delete(key)
|
328
|
-
|
329
|
-
real_graph.add_edge(f,t,label)
|
330
|
-
end
|
331
|
-
# Enqueue the initial set of resources, those with no dependencies.
|
332
|
-
def enqueue_roots
|
333
|
-
vertices.each do |v|
|
334
|
-
blockers[v] = direct_dependencies_of(v).length
|
335
|
-
enqueue(v) if blockers[v] == 0
|
336
|
-
end
|
337
|
-
end
|
338
|
-
# Decrement the blocker count for the resource by 1. If the number of
|
339
|
-
# blockers is unknown, count them and THEN decrement by 1.
|
340
|
-
def unblock(resource)
|
341
|
-
blockers[resource] ||= direct_dependencies_of(resource).select { |r2| !done[r2] }.length
|
342
|
-
if blockers[resource] > 0
|
343
|
-
blockers[resource] -= 1
|
344
|
-
else
|
345
|
-
resource.warning "appears to have a negative number of dependencies"
|
346
|
-
end
|
347
|
-
blockers[resource] <= 0
|
348
|
-
end
|
349
|
-
def enqueue(*resources)
|
350
|
-
resources.each do |resource|
|
351
|
-
key = unguessable_deterministic_key[resource]
|
352
|
-
ready[key] = resource
|
353
|
-
end
|
354
|
-
end
|
355
|
-
def finish(resource)
|
356
|
-
direct_dependents_of(resource).each do |v|
|
357
|
-
enqueue(v) if unblock(v)
|
358
|
-
end
|
359
|
-
done[resource] = true
|
360
|
-
end
|
361
|
-
def next_resource
|
362
|
-
ready.delete_min
|
363
|
-
end
|
364
|
-
def traverse(&block)
|
365
|
-
real_graph.report_cycles_in_graph
|
366
|
-
|
367
|
-
enqueue_roots
|
368
|
-
|
369
|
-
deferred_resources = []
|
370
|
-
|
371
|
-
while (resource = next_resource) && !transaction.stop_processing?
|
372
|
-
if resource.suitable?
|
373
|
-
made_progress = true
|
374
|
-
|
375
|
-
transaction.prefetch_if_necessary(resource)
|
376
|
-
|
377
|
-
# If we generated resources, we don't know what they are now
|
378
|
-
# blocking, so we opt to recompute it, rather than try to track every
|
379
|
-
# change that would affect the number.
|
380
|
-
blockers.clear if transaction.eval_generate(resource)
|
381
|
-
|
382
|
-
yield resource
|
383
|
-
|
384
|
-
finish(resource)
|
385
|
-
else
|
386
|
-
deferred_resources << resource
|
387
|
-
end
|
388
|
-
|
389
|
-
if ready.empty? and deferred_resources.any?
|
390
|
-
if made_progress
|
391
|
-
enqueue(*deferred_resources)
|
392
|
-
else
|
393
|
-
fail_unsuitable_resources(deferred_resources)
|
394
|
-
end
|
395
|
-
|
396
|
-
made_progress = false
|
397
|
-
deferred_resources = []
|
398
|
-
end
|
399
|
-
end
|
400
|
-
|
401
|
-
# Just once per type. No need to punish the user.
|
402
|
-
@providerless_types.uniq.each do |type|
|
403
|
-
Puppet.err "Could not find a suitable provider for #{type}"
|
404
|
-
end
|
405
|
-
end
|
406
|
-
|
407
|
-
def fail_unsuitable_resources(resources)
|
408
|
-
resources.each do |resource|
|
409
|
-
# We don't automatically assign unsuitable providers, so if there
|
410
|
-
# is one, it must have been selected by the user.
|
411
|
-
if resource.provider
|
412
|
-
resource.err "Provider #{resource.provider.class.name} is not functional on this host"
|
413
|
-
else
|
414
|
-
@providerless_types << resource.type
|
415
|
-
end
|
416
|
-
|
417
|
-
transaction.resource_status(resource).failed = true
|
418
|
-
|
419
|
-
finish(resource)
|
420
|
-
end
|
421
|
-
end
|
422
|
-
end
|
423
|
-
|
424
|
-
def relationship_graph
|
425
|
-
@relationship_graph ||= Relationship_graph_wrapper.new(catalog.relationship_graph,self)
|
426
|
-
end
|
427
|
-
|
428
271
|
def add_resource_status(status)
|
429
|
-
report.add_resource_status
|
430
|
-
end
|
431
|
-
|
432
|
-
def resource_status(resource)
|
433
|
-
report.resource_statuses[resource.to_s] || add_resource_status(Puppet::Resource::Status.new(resource))
|
272
|
+
report.add_resource_status(status)
|
434
273
|
end
|
435
274
|
|
436
275
|
# Is the resource currently scheduled?
|
437
276
|
def scheduled?(resource)
|
438
|
-
self.ignoreschedules or resource_harness.scheduled?(
|
277
|
+
self.ignoreschedules or resource_harness.scheduled?(resource)
|
439
278
|
end
|
440
279
|
|
441
280
|
# Should this resource be skipped?
|
@@ -454,19 +293,18 @@ class Puppet::Transaction
|
|
454
293
|
end
|
455
294
|
elsif resource.virtual?
|
456
295
|
resource.debug "Skipping because virtual"
|
457
|
-
elsif resource.
|
458
|
-
resource.debug "Skipping
|
296
|
+
elsif !host_and_device_resource?(resource) && resource.appliable_to_host? && for_network_device
|
297
|
+
resource.debug "Skipping host resources because running on a device"
|
298
|
+
elsif !host_and_device_resource?(resource) && resource.appliable_to_device? && !for_network_device
|
299
|
+
resource.debug "Skipping device resources because running on a posix host"
|
459
300
|
else
|
460
301
|
return false
|
461
302
|
end
|
462
303
|
true
|
463
304
|
end
|
464
305
|
|
465
|
-
|
466
|
-
|
467
|
-
self.tags = Puppet[:tags] unless defined?(@tags)
|
468
|
-
|
469
|
-
super
|
306
|
+
def host_and_device_resource?(resource)
|
307
|
+
resource.appliable_to_host? && resource.appliable_to_device?
|
470
308
|
end
|
471
309
|
|
472
310
|
def handle_qualified_tags( qualified )
|