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,126 @@
|
|
1
|
+
# Adds additional resources to the catalog and relationship graph that are
|
2
|
+
# generated by existing resources. There are two ways that a resource can
|
3
|
+
# generate additional resources, either through the #generate method or the
|
4
|
+
# #eval_generate method.
|
5
|
+
#
|
6
|
+
# @api private
|
7
|
+
class Puppet::Transaction::AdditionalResourceGenerator
|
8
|
+
def initialize(catalog, relationship_graph, prioritizer)
|
9
|
+
@catalog = catalog
|
10
|
+
@relationship_graph = relationship_graph
|
11
|
+
@prioritizer = prioritizer
|
12
|
+
end
|
13
|
+
|
14
|
+
def generate_additional_resources(resource)
|
15
|
+
return unless resource.respond_to?(:generate)
|
16
|
+
begin
|
17
|
+
generated = resource.generate
|
18
|
+
rescue => detail
|
19
|
+
resource.log_exception(detail, "Failed to generate additional resources using 'generate': #{detail}")
|
20
|
+
end
|
21
|
+
return unless generated
|
22
|
+
generated = [generated] unless generated.is_a?(Array)
|
23
|
+
generated.collect do |res|
|
24
|
+
@catalog.resource(res.ref) || res
|
25
|
+
end.each do |res|
|
26
|
+
priority = @prioritizer.generate_priority_contained_in(resource, res)
|
27
|
+
add_resource(res, resource, priority)
|
28
|
+
|
29
|
+
add_conditional_directed_dependency(resource, res)
|
30
|
+
generate_additional_resources(res)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def eval_generate(resource)
|
35
|
+
return false unless resource.respond_to?(:eval_generate)
|
36
|
+
raise Puppet::DevError,"Depthfirst resources are not supported by eval_generate" if resource.depthfirst?
|
37
|
+
begin
|
38
|
+
generated = replace_duplicates_with_catalog_resources(resource.eval_generate)
|
39
|
+
return false if generated.empty?
|
40
|
+
rescue => detail
|
41
|
+
resource.log_exception(detail, "Failed to generate additional resources using 'eval_generate: #{detail}")
|
42
|
+
return false
|
43
|
+
end
|
44
|
+
add_resources(generated, resource)
|
45
|
+
|
46
|
+
made = Hash[generated.map(&:name).zip(generated)]
|
47
|
+
contain_generated_resources_in(resource, made)
|
48
|
+
connect_resources_to_ancestors(resource, made)
|
49
|
+
|
50
|
+
true
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def replace_duplicates_with_catalog_resources(generated)
|
56
|
+
generated.collect do |generated_resource|
|
57
|
+
@catalog.resource(generated_resource.ref) || generated_resource
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def contain_generated_resources_in(resource, made)
|
62
|
+
sentinel = Puppet::Type.type(:whit).new(:name => "completed_#{resource.title}", :catalog => resource.catalog)
|
63
|
+
priority = @prioritizer.generate_priority_contained_in(resource, sentinel)
|
64
|
+
@relationship_graph.add_vertex(sentinel, priority)
|
65
|
+
|
66
|
+
redirect_edges_to_sentinel(resource, sentinel, made)
|
67
|
+
|
68
|
+
made.values.each do |res|
|
69
|
+
# This resource isn't 'completed' until each child has run
|
70
|
+
add_conditional_directed_dependency(res, sentinel, Puppet::Graph::RelationshipGraph::Default_label)
|
71
|
+
end
|
72
|
+
|
73
|
+
# This edge allows the resource's events to propagate, though it isn't
|
74
|
+
# strictly necessary for ordering purposes
|
75
|
+
add_conditional_directed_dependency(resource, sentinel, Puppet::Graph::RelationshipGraph::Default_label)
|
76
|
+
end
|
77
|
+
|
78
|
+
def redirect_edges_to_sentinel(resource, sentinel, made)
|
79
|
+
@relationship_graph.adjacent(resource, :direction => :out, :type => :edges).each do |e|
|
80
|
+
next if made[e.target.name]
|
81
|
+
|
82
|
+
@relationship_graph.add_relationship(sentinel, e.target, e.label)
|
83
|
+
@relationship_graph.remove_edge! e
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def connect_resources_to_ancestors(resource, made)
|
88
|
+
made.values.each do |res|
|
89
|
+
# Depend on the nearest ancestor we generated, falling back to the
|
90
|
+
# resource if we have none
|
91
|
+
parent_name = res.ancestors.find { |a| made[a] and made[a] != res }
|
92
|
+
parent = made[parent_name] || resource
|
93
|
+
|
94
|
+
add_conditional_directed_dependency(parent, res)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def add_resources(generated, resource)
|
99
|
+
generated.each do |res|
|
100
|
+
priority = @prioritizer.generate_priority_contained_in(resource, res)
|
101
|
+
add_resource(res, resource, priority)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def add_resource(res, parent_resource, priority)
|
106
|
+
if @catalog.resource(res.ref).nil?
|
107
|
+
res.tag(*parent_resource.tags)
|
108
|
+
@catalog.add_resource(res)
|
109
|
+
@relationship_graph.add_vertex(res, priority)
|
110
|
+
@catalog.add_edge(@catalog.container_of(parent_resource), res)
|
111
|
+
res.finish
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
# Copy an important relationships from the parent to the newly-generated
|
116
|
+
# child resource.
|
117
|
+
def add_conditional_directed_dependency(parent, child, label=nil)
|
118
|
+
@relationship_graph.add_vertex(child)
|
119
|
+
edge = parent.depthfirst? ? [child, parent] : [parent, child]
|
120
|
+
if @relationship_graph.edge?(*edge.reverse)
|
121
|
+
parent.debug "Skipping automatic relationship to #{child}"
|
122
|
+
else
|
123
|
+
@relationship_graph.add_relationship(edge[0],edge[1],label)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
@@ -26,6 +26,7 @@ class Puppet::Transaction::Event
|
|
26
26
|
|
27
27
|
def initialize(options = {})
|
28
28
|
@audited = false
|
29
|
+
|
29
30
|
set_options(options)
|
30
31
|
@time = Time.now
|
31
32
|
end
|
@@ -37,12 +38,26 @@ class Puppet::Transaction::Event
|
|
37
38
|
@desired_value = data['desired_value']
|
38
39
|
@historical_value = data['historical_value']
|
39
40
|
@message = data['message']
|
40
|
-
@name = data['name'].intern
|
41
|
+
@name = data['name'].intern if data['name']
|
41
42
|
@status = data['status']
|
42
43
|
@time = data['time']
|
43
44
|
@time = Time.parse(@time) if @time.is_a? String
|
44
45
|
end
|
45
46
|
|
47
|
+
def to_pson
|
48
|
+
{
|
49
|
+
'audited' => @audited,
|
50
|
+
'property' => @property,
|
51
|
+
'previous_value' => @previous_value,
|
52
|
+
'desired_value' => @desired_value,
|
53
|
+
'historical_value' => @historical_value,
|
54
|
+
'message' => @message,
|
55
|
+
'name' => @name,
|
56
|
+
'status' => @status,
|
57
|
+
'time' => @time.iso8601(9),
|
58
|
+
}.to_pson
|
59
|
+
end
|
60
|
+
|
46
61
|
def property=(prop)
|
47
62
|
@property = prop.to_s
|
48
63
|
end
|
@@ -44,6 +44,10 @@ class Puppet::Transaction::Report
|
|
44
44
|
# @return [???] the configuration version
|
45
45
|
attr_accessor :configuration_version
|
46
46
|
|
47
|
+
# An agent generated transaction uuid, useful for connecting catalog and report
|
48
|
+
# @return [String] uuid
|
49
|
+
attr_accessor :transaction_uuid
|
50
|
+
|
47
51
|
# The host name for which the report is generated
|
48
52
|
# @return [String] the host name
|
49
53
|
attr_accessor :host
|
@@ -58,7 +62,7 @@ class Puppet::Transaction::Report
|
|
58
62
|
attr_reader :resource_statuses
|
59
63
|
|
60
64
|
# A list of log messages.
|
61
|
-
# @return [Array<
|
65
|
+
# @return [Array<Puppet::Util::Log>] logged messages
|
62
66
|
attr_reader :logs
|
63
67
|
|
64
68
|
# A hash of metric name to metric value.
|
@@ -88,26 +92,22 @@ class Puppet::Transaction::Report
|
|
88
92
|
#
|
89
93
|
attr_reader :puppet_version
|
90
94
|
|
91
|
-
# @return [Integer]
|
92
|
-
#
|
95
|
+
# @return [Integer] report format version number. This value is constant for
|
96
|
+
# a given version of Puppet; it is incremented when a new release of Puppet
|
97
|
+
# changes the API for the various objects that make up a report.
|
93
98
|
#
|
94
99
|
attr_reader :report_format
|
95
100
|
|
96
|
-
# This is necessary since Marshal doesn't know how to
|
97
|
-
# dump hash with default proc (see below "@records") ?
|
98
|
-
# @todo there is no "@records" to see below, uncertain what this is for.
|
99
|
-
# @api private
|
100
|
-
#
|
101
|
-
def self.default_format
|
102
|
-
:yaml
|
103
|
-
end
|
104
|
-
|
105
101
|
def self.from_pson(data)
|
106
102
|
obj = self.allocate
|
107
103
|
obj.initialize_from_hash(data)
|
108
104
|
obj
|
109
105
|
end
|
110
106
|
|
107
|
+
def as_logging_destination(&block)
|
108
|
+
Puppet::Util::Log.with_destination(self, &block)
|
109
|
+
end
|
110
|
+
|
111
111
|
# @api private
|
112
112
|
def <<(msg)
|
113
113
|
@logs << msg
|
@@ -165,7 +165,7 @@ class Puppet::Transaction::Report
|
|
165
165
|
end
|
166
166
|
|
167
167
|
# @api private
|
168
|
-
def initialize(kind, configuration_version=nil, environment=nil)
|
168
|
+
def initialize(kind, configuration_version=nil, environment=nil, transaction_uuid=nil)
|
169
169
|
@metrics = {}
|
170
170
|
@logs = []
|
171
171
|
@resource_statuses = {}
|
@@ -173,9 +173,10 @@ class Puppet::Transaction::Report
|
|
173
173
|
@host = Puppet[:node_name_value]
|
174
174
|
@time = Time.now
|
175
175
|
@kind = kind
|
176
|
-
@report_format =
|
176
|
+
@report_format = 4
|
177
177
|
@puppet_version = Puppet.version
|
178
178
|
@configuration_version = configuration_version
|
179
|
+
@transaction_uuid = transaction_uuid
|
179
180
|
@environment = environment
|
180
181
|
@status = 'failed' # assume failed until the report is finalized
|
181
182
|
end
|
@@ -185,6 +186,7 @@ class Puppet::Transaction::Report
|
|
185
186
|
@puppet_version = data['puppet_version']
|
186
187
|
@report_format = data['report_format']
|
187
188
|
@configuration_version = data['configuration_version']
|
189
|
+
@transaction_uuid = data['transaction_uuid']
|
188
190
|
@environment = data['environment']
|
189
191
|
@status = data['status']
|
190
192
|
@host = data['host']
|
@@ -214,6 +216,24 @@ class Puppet::Transaction::Report
|
|
214
216
|
end
|
215
217
|
end
|
216
218
|
|
219
|
+
def to_pson
|
220
|
+
{
|
221
|
+
'host' => @host,
|
222
|
+
'time' => @time.iso8601(9),
|
223
|
+
'configuration_version' => @configuration_version,
|
224
|
+
'transaction_uuid' => @transaction_uuid,
|
225
|
+
'report_format' => @report_format,
|
226
|
+
'puppet_version' => @puppet_version,
|
227
|
+
'kind' => @kind,
|
228
|
+
'status' => @status,
|
229
|
+
'environment' => @environment,
|
230
|
+
|
231
|
+
'logs' => @logs,
|
232
|
+
'metrics' => @metrics,
|
233
|
+
'resource_statuses' => @resource_statuses,
|
234
|
+
}.to_pson
|
235
|
+
end
|
236
|
+
|
217
237
|
# @return [String] the host name
|
218
238
|
# @api public
|
219
239
|
#
|
@@ -29,13 +29,12 @@ class Puppet::Transaction::ResourceHarness
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def perform_changes(resource)
|
32
|
-
|
32
|
+
current_values = resource.retrieve_resource.to_hash
|
33
33
|
|
34
|
-
cache
|
34
|
+
cache(resource, :checked, Time.now)
|
35
35
|
|
36
36
|
return [] if ! allow_changes?(resource)
|
37
37
|
|
38
|
-
current_values = current.to_hash
|
39
38
|
historical_values = Puppet::Util::Storage.cache(resource).dup
|
40
39
|
desired_values = {}
|
41
40
|
resource.properties.each do |property|
|
@@ -133,33 +132,31 @@ class Puppet::Transaction::ResourceHarness
|
|
133
132
|
end
|
134
133
|
|
135
134
|
def evaluate(resource)
|
136
|
-
start = Time.now
|
137
135
|
status = Puppet::Resource::Status.new(resource)
|
138
136
|
|
139
|
-
|
140
|
-
|
141
|
-
|
137
|
+
begin
|
138
|
+
perform_changes(resource).each do |event|
|
139
|
+
status << event
|
140
|
+
end
|
142
141
|
|
143
|
-
|
144
|
-
|
145
|
-
|
142
|
+
if status.changed? && ! resource.noop?
|
143
|
+
cache(resource, :synced, Time.now)
|
144
|
+
resource.flush if resource.respond_to?(:flush)
|
145
|
+
end
|
146
|
+
rescue => detail
|
147
|
+
status.failed_because(detail)
|
148
|
+
ensure
|
149
|
+
status.evaluation_time = Time.now - status.time
|
146
150
|
end
|
147
151
|
|
148
|
-
|
149
|
-
rescue => detail
|
150
|
-
resource.fail "Could not create resource status: #{detail}" unless status
|
151
|
-
resource.log_exception(detail, "Could not evaluate: #{detail}")
|
152
|
-
status.failed = true
|
153
|
-
return status
|
154
|
-
ensure
|
155
|
-
(status.evaluation_time = Time.now - start) if status
|
152
|
+
status
|
156
153
|
end
|
157
154
|
|
158
155
|
def initialize(transaction)
|
159
156
|
@transaction = transaction
|
160
157
|
end
|
161
158
|
|
162
|
-
def scheduled?(
|
159
|
+
def scheduled?(resource)
|
163
160
|
return true if Puppet[:ignoreschedules]
|
164
161
|
return true unless schedule = schedule(resource)
|
165
162
|
|
data/lib/puppet/type.rb
CHANGED
@@ -7,7 +7,6 @@ require 'puppet/util'
|
|
7
7
|
require 'puppet/util/autoload'
|
8
8
|
require 'puppet/metatype/manager'
|
9
9
|
require 'puppet/util/errors'
|
10
|
-
require 'puppet/util/log_paths'
|
11
10
|
require 'puppet/util/logging'
|
12
11
|
require 'puppet/util/tagging'
|
13
12
|
|
@@ -77,7 +76,6 @@ module Puppet
|
|
77
76
|
class Type
|
78
77
|
include Puppet::Util
|
79
78
|
include Puppet::Util::Errors
|
80
|
-
include Puppet::Util::LogPaths
|
81
79
|
include Puppet::Util::Logging
|
82
80
|
include Puppet::Util::Tagging
|
83
81
|
|
@@ -303,7 +301,7 @@ class Type
|
|
303
301
|
# @param metaparam [??? Puppet::Parameter] the meta-parameter to get documentation for.
|
304
302
|
# @return [String] the documentation associated with the given meta-parameter, or nil of not such documentation
|
305
303
|
# exists.
|
306
|
-
# @
|
304
|
+
# @raise if the given metaparam is not a meta-parameter in this type
|
307
305
|
#
|
308
306
|
def self.metaparamdoc(metaparam)
|
309
307
|
@@metaparamhash[metaparam].doc
|
@@ -354,11 +352,10 @@ class Type
|
|
354
352
|
# Returns parameters that act as a key.
|
355
353
|
# All parameters that return true from #isnamevar? or is named `:name` are included in the returned result.
|
356
354
|
# @todo would like a better explanation
|
357
|
-
# @return Array
|
358
|
-
#
|
355
|
+
# @return [Array<Puppet::Parameter>] WARNING: this return type is uncertain
|
359
356
|
def self.key_attribute_parameters
|
360
357
|
@key_attribute_parameters ||= (
|
361
|
-
|
358
|
+
@parameters.find_all { |param|
|
362
359
|
param.isnamevar? or param.name == :name
|
363
360
|
}
|
364
361
|
)
|
@@ -748,6 +745,13 @@ class Type
|
|
748
745
|
@parameters[name] = klass.new(:resource => self)
|
749
746
|
end
|
750
747
|
|
748
|
+
# Returns a string representation of the resource's containment path in
|
749
|
+
# the catalog.
|
750
|
+
# @return [String]
|
751
|
+
def path
|
752
|
+
@path ||= '/' + pathbuilder.join('/')
|
753
|
+
end
|
754
|
+
|
751
755
|
# Returns the value of this object's parameter given by name
|
752
756
|
# @param name [String] the name of the parameter
|
753
757
|
# @return [Object] the value
|
@@ -1003,7 +1007,7 @@ class Type
|
|
1003
1007
|
# Parameters and meta-parameters are not included in the result.
|
1004
1008
|
# @todo As oposed to all non contained properties? How is this different than any of the other
|
1005
1009
|
# methods that also "gets" properties/parameters/etc. ?
|
1006
|
-
# @return [
|
1010
|
+
# @return [Puppet::Resource] array of all property values (mix of types)
|
1007
1011
|
# @raise [fail???] if there is a provider and it is not suitable for the host this is evaluated for.
|
1008
1012
|
def retrieve
|
1009
1013
|
fail "Provider #{provider.class.name} is not functional on this host" if self.provider.is_a?(Puppet::Provider) and ! provider.class.suitable?
|
@@ -1031,12 +1035,16 @@ class Type
|
|
1031
1035
|
result
|
1032
1036
|
end
|
1033
1037
|
|
1034
|
-
#
|
1035
|
-
#
|
1036
|
-
#
|
1037
|
-
#
|
1038
|
-
#
|
1038
|
+
# Retrieve the current state of the system as a Puppet::Resource. For
|
1039
|
+
# the base Puppet::Type this does the same thing as #retrieve, but
|
1040
|
+
# specific types are free to implement #retrieve as returning a hash,
|
1041
|
+
# and this will call #retrieve and convert the hash to a resource.
|
1042
|
+
# This is used when determining when syncing a resource.
|
1043
|
+
#
|
1044
|
+
# @return [Puppet::Resource] A resource representing the current state
|
1045
|
+
# of the system.
|
1039
1046
|
#
|
1047
|
+
# @api private
|
1040
1048
|
def retrieve_resource
|
1041
1049
|
resource = retrieve
|
1042
1050
|
resource = Resource.new(type, title, :parameters => resource) if resource.is_a? Hash
|
@@ -1044,7 +1052,7 @@ class Type
|
|
1044
1052
|
end
|
1045
1053
|
|
1046
1054
|
# Returns a hash of the current properties and their values.
|
1047
|
-
# If a resource is absent,
|
1055
|
+
# If a resource is absent, its value is the symbol `:absent`
|
1048
1056
|
# @return [Hash{Puppet::Property => Object}] mapping of property instance to its value
|
1049
1057
|
#
|
1050
1058
|
def currentpropvalues
|
@@ -1097,7 +1105,7 @@ class Type
|
|
1097
1105
|
# Put the default provider first, then the rest of the suitable providers.
|
1098
1106
|
provider_instances = {}
|
1099
1107
|
providers_by_source.collect do |provider|
|
1100
|
-
|
1108
|
+
self.properties.find_all do |property|
|
1101
1109
|
provider.supports_parameter?(property)
|
1102
1110
|
end.collect do |property|
|
1103
1111
|
property.name
|
@@ -1138,7 +1146,7 @@ class Type
|
|
1138
1146
|
|
1139
1147
|
# Converts a simple hash into a Resource instance.
|
1140
1148
|
# @todo as opposed to a complex hash? Other raised exceptions?
|
1141
|
-
# @param [Hash{Symbol, String => Object}] resource attribute to value map to initialize the created resource from
|
1149
|
+
# @param [Hash{Symbol, String => Object}] hash resource attribute to value map to initialize the created resource from
|
1142
1150
|
# @return [Puppet::Resource] the resource created from the hash
|
1143
1151
|
# @raise [Puppet::Error] if a title is missing in the given hash
|
1144
1152
|
def self.hash2resource(hash)
|
@@ -1152,12 +1160,7 @@ class Type
|
|
1152
1160
|
|
1153
1161
|
# Now create our resource.
|
1154
1162
|
resource = Puppet::Resource.new(self.name, title)
|
1155
|
-
|
1156
|
-
if value = hash[attribute]
|
1157
|
-
hash.delete(attribute)
|
1158
|
-
resource.send(attribute.to_s + "=", value)
|
1159
|
-
end
|
1160
|
-
end
|
1163
|
+
resource.catalog = hash.delete(:catalog)
|
1161
1164
|
|
1162
1165
|
hash.each do |param, value|
|
1163
1166
|
resource[param] = value
|
@@ -1165,10 +1168,12 @@ class Type
|
|
1165
1168
|
resource
|
1166
1169
|
end
|
1167
1170
|
|
1168
|
-
|
1169
|
-
#
|
1170
|
-
#
|
1171
|
+
|
1172
|
+
# Returns an array of strings representing the containment heirarchy
|
1173
|
+
# (types/classes) that make up the path to the resource from the root
|
1174
|
+
# of the catalog. This is mostly used for logging purposes.
|
1171
1175
|
#
|
1176
|
+
# @api private
|
1172
1177
|
def pathbuilder
|
1173
1178
|
if p = parent
|
1174
1179
|
[p.pathbuilder, self.ref].flatten
|
@@ -1284,43 +1289,43 @@ class Type
|
|
1284
1289
|
end
|
1285
1290
|
|
1286
1291
|
newmetaparam(:alias) do
|
1287
|
-
desc
|
1288
|
-
provide a symbolic title:
|
1292
|
+
desc %q{Creates an alias for the resource. Puppet uses this internally when you
|
1293
|
+
provide a symbolic title and an explicit namevar value:
|
1289
1294
|
|
1290
1295
|
file { 'sshdconfig':
|
1291
1296
|
path => $operatingsystem ? {
|
1292
|
-
solaris =>
|
1293
|
-
default =>
|
1297
|
+
solaris => '/usr/local/etc/ssh/sshd_config',
|
1298
|
+
default => '/etc/ssh/sshd_config',
|
1294
1299
|
},
|
1295
|
-
source =>
|
1300
|
+
source => '...'
|
1296
1301
|
}
|
1297
1302
|
|
1298
1303
|
service { 'sshd':
|
1299
|
-
subscribe => File['sshdconfig']
|
1304
|
+
subscribe => File['sshdconfig'],
|
1300
1305
|
}
|
1301
1306
|
|
1302
1307
|
When you use this feature, the parser sets `sshdconfig` as the title,
|
1303
1308
|
and the library sets that as an alias for the file so the dependency
|
1304
1309
|
lookup in `Service['sshd']` works. You can use this metaparameter yourself,
|
1305
|
-
but note that
|
1306
|
-
|
1310
|
+
but note that aliases generally only work for creating relationships; anything
|
1311
|
+
else that refers to an existing resource (such as amending or overriding
|
1312
|
+
resource attributes in an inherited class) must use the resource's exact
|
1313
|
+
title. For example, the following code will not work:
|
1307
1314
|
|
1308
|
-
file {
|
1315
|
+
file { '/etc/ssh/sshd_config':
|
1309
1316
|
owner => root,
|
1310
1317
|
group => root,
|
1311
|
-
alias => 'sshdconfig'
|
1318
|
+
alias => 'sshdconfig',
|
1312
1319
|
}
|
1313
1320
|
|
1314
|
-
|
1315
|
-
mode => 644
|
1321
|
+
File['sshdconfig'] {
|
1322
|
+
mode => 644,
|
1316
1323
|
}
|
1317
1324
|
|
1318
1325
|
There's no way here for the Puppet parser to know that these two stanzas
|
1319
1326
|
should be affecting the same file.
|
1320
1327
|
|
1321
|
-
|
1322
|
-
|
1323
|
-
"
|
1328
|
+
}
|
1324
1329
|
|
1325
1330
|
munge do |aliases|
|
1326
1331
|
aliases = [aliases] unless aliases.is_a?(Array)
|
@@ -1408,7 +1413,7 @@ class Type
|
|
1408
1413
|
@value.each do |ref|
|
1409
1414
|
unless @resource.catalog.resource(ref.to_s)
|
1410
1415
|
description = self.class.direction == :in ? "dependency" : "dependent"
|
1411
|
-
fail "Could not find #{description} #{ref} for #{resource.ref}"
|
1416
|
+
fail ResourceError, "Could not find #{description} #{ref} for #{resource.ref}"
|
1412
1417
|
end
|
1413
1418
|
end
|
1414
1419
|
end
|
@@ -1459,7 +1464,7 @@ class Type
|
|
1459
1464
|
self.debug("requires #{related_resource.ref}")
|
1460
1465
|
end
|
1461
1466
|
|
1462
|
-
|
1467
|
+
Puppet::Relationship.new(source, target, subargs)
|
1463
1468
|
end
|
1464
1469
|
end
|
1465
1470
|
end
|
@@ -1809,7 +1814,7 @@ class Type
|
|
1809
1814
|
end
|
1810
1815
|
|
1811
1816
|
# @todo this does what? where and how?
|
1812
|
-
# @
|
1817
|
+
# @return [String] the name of the provider
|
1813
1818
|
defaultto {
|
1814
1819
|
prov = @resource.class.defaultprovider
|
1815
1820
|
prov.name if prov
|
@@ -1819,7 +1824,7 @@ class Type
|
|
1819
1824
|
provider_class = provider_class[0] if provider_class.is_a? Array
|
1820
1825
|
provider_class = provider_class.class.name if provider_class.is_a?(Puppet::Provider)
|
1821
1826
|
|
1822
|
-
unless
|
1827
|
+
unless @resource.class.provider(provider_class)
|
1823
1828
|
raise ArgumentError, "Invalid #{@resource.class.name} provider '#{provider_class}'"
|
1824
1829
|
end
|
1825
1830
|
end
|
@@ -1942,8 +1947,9 @@ class Type
|
|
1942
1947
|
# Adds dependencies to the catalog from added autorequirements.
|
1943
1948
|
# See {autorequire} for how to add an auto-requirement.
|
1944
1949
|
# @todo needs details - see the param rel_catalog, and type of this param
|
1945
|
-
# @param rel_catalog [Puppet::Catalog, nil] the catalog to
|
1946
|
-
#
|
1950
|
+
# @param rel_catalog [Puppet::Resource::Catalog, nil] the catalog to
|
1951
|
+
# add dependencies to. Defaults to the current catalog (set when the
|
1952
|
+
# type instance was added to a catalog)
|
1947
1953
|
# @raise [Puppet::DevError] if there is no catalog
|
1948
1954
|
#
|
1949
1955
|
def autorequire(rel_catalog = nil)
|
@@ -1953,7 +1959,7 @@ class Type
|
|
1953
1959
|
reqs = []
|
1954
1960
|
self.class.eachautorequire { |type, block|
|
1955
1961
|
# Ignore any types we can't find, although that would be a bit odd.
|
1956
|
-
next unless
|
1962
|
+
next unless Puppet::Type.type(type)
|
1957
1963
|
|
1958
1964
|
# Retrieve the list of names from the block.
|
1959
1965
|
next unless list = self.instance_eval(&block)
|
@@ -2104,7 +2110,6 @@ class Type
|
|
2104
2110
|
#
|
2105
2111
|
def self.validate(&block)
|
2106
2112
|
define_method(:validate, &block)
|
2107
|
-
#@validate = block
|
2108
2113
|
end
|
2109
2114
|
|
2110
2115
|
# @return [String] The file from which this type originates from
|
@@ -2157,8 +2162,8 @@ class Type
|
|
2157
2162
|
# resources; one that causes the title to be set to resource.title, and one that
|
2158
2163
|
# causes the title to be resource.ref ("for components") - what is a component?
|
2159
2164
|
#
|
2160
|
-
# @
|
2161
|
-
# @param
|
2165
|
+
# @overload initialize(hash)
|
2166
|
+
# @param [Hash] hash
|
2162
2167
|
# @raise [Puppet::ResourceError] when the type validation raises
|
2163
2168
|
# Puppet::Error or ArgumentError
|
2164
2169
|
# @overload initialize(resource)
|
@@ -2351,14 +2356,14 @@ class Type
|
|
2351
2356
|
end
|
2352
2357
|
end
|
2353
2358
|
|
2354
|
-
# Returns the title of this object, or
|
2359
|
+
# Returns the title of this object, or its name if title was not explicetly set.
|
2355
2360
|
# If the title is not already set, it will be computed by looking up the {#name_var} and using
|
2356
2361
|
# that value as the title.
|
2357
2362
|
# @todo it is somewhat confusing that if the name_var is a valid parameter, it is assumed to
|
2358
2363
|
# be the name_var called :name, but if it is a property, it uses the name_var.
|
2359
2364
|
# It is further confusing as Type in some respects supports multiple namevars.
|
2360
2365
|
#
|
2361
|
-
# @return [String] Returns the title of this object, or
|
2366
|
+
# @return [String] Returns the title of this object, or its name if title was not explicetly set.
|
2362
2367
|
# @raise [??? devfail] if title is not set, and name_var can not be found.
|
2363
2368
|
def title
|
2364
2369
|
unless @title
|
@@ -2406,14 +2411,15 @@ class Type
|
|
2406
2411
|
def exported?; !!@exported; end
|
2407
2412
|
|
2408
2413
|
# @return [Boolean] Returns whether the resource is applicable to `:device`
|
2409
|
-
#
|
2414
|
+
# Returns true if a resource of this type can be evaluated on a 'network device' kind
|
2415
|
+
# of hosts.
|
2410
2416
|
# @api private
|
2411
2417
|
def appliable_to_device?
|
2412
2418
|
self.class.can_apply_to(:device)
|
2413
2419
|
end
|
2414
2420
|
|
2415
2421
|
# @return [Boolean] Returns whether the resource is applicable to `:host`
|
2416
|
-
#
|
2422
|
+
# Returns true if a resource of this type can be evaluated on a regular generalized computer (ie not an appliance like a network device)
|
2417
2423
|
# @api private
|
2418
2424
|
def appliable_to_host?
|
2419
2425
|
self.class.can_apply_to(:host)
|