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
@@ -23,8 +23,7 @@ Puppet::Type.type(:zone).provide(:solaris) do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def self.instances
|
26
|
-
|
27
|
-
x = adm(:list, "-cp").split("\n").collect do |line|
|
26
|
+
adm(:list, "-cp").split("\n").collect do |line|
|
28
27
|
new(line2hash(line))
|
29
28
|
end
|
30
29
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
Puppet::Util::Reference.newreference :metaparameter, :doc => "All Puppet metaparameters and all their details" do
|
2
2
|
types = {}
|
3
3
|
Puppet::Type.loadall
|
4
4
|
|
@@ -3,7 +3,7 @@ Puppet::Reports.register_report(:rrdgraph) do
|
|
3
3
|
must have the Ruby RRDtool library installed to use this report, which
|
4
4
|
you can get from
|
5
5
|
[the RubyRRDTool RubyForge page](http://rubyforge.org/projects/rubyrrdtool/).
|
6
|
-
This package may also be available as `ruby-rrd
|
6
|
+
This package may also be available as `librrd-ruby`, `ruby-rrd`, or `rrdtool-ruby` in your
|
7
7
|
distribution's package management system. The library and/or package will both
|
8
8
|
require the binary `rrdtool` package from your distribution to be installed.
|
9
9
|
|
@@ -133,7 +133,7 @@ Puppet::Reports.register_report(:tagmail) do
|
|
133
133
|
pid = Puppet::Util.safe_posix_fork do
|
134
134
|
if Puppet[:smtpserver] != "none"
|
135
135
|
begin
|
136
|
-
Net::SMTP.start(Puppet[:smtpserver]) do |smtp|
|
136
|
+
Net::SMTP.start(Puppet[:smtpserver], Puppet[:smtpport], Puppet[:smtphelo]) do |smtp|
|
137
137
|
reports.each do |emails, messages|
|
138
138
|
smtp.open_message_stream(Puppet[:reportfrom], *emails) do |p|
|
139
139
|
p.puts "From: #{Puppet[:reportfrom]}"
|
data/lib/puppet/resource.rb
CHANGED
@@ -5,6 +5,8 @@ require 'puppet/parameter'
|
|
5
5
|
|
6
6
|
# The simplest resource class. Eventually it will function as the
|
7
7
|
# base class for all resource-like behaviour.
|
8
|
+
#
|
9
|
+
# @api public
|
8
10
|
class Puppet::Resource
|
9
11
|
# This stub class is only needed for serialization compatibility with 0.25.x.
|
10
12
|
# Specifically, it exists to provide a compatibility API when using YAML
|
@@ -316,15 +318,25 @@ class Puppet::Resource
|
|
316
318
|
# We make a request to the backend for the key 'foo::port' not 'foo'
|
317
319
|
#
|
318
320
|
def lookup_external_default_for(param, scope)
|
319
|
-
|
321
|
+
# Only lookup parameters for host classes
|
322
|
+
return nil unless resource_type.type == :hostclass
|
323
|
+
|
324
|
+
name = "#{resource_type.name}::#{param}"
|
325
|
+
# Lookup with injector (optionally), and if no value bound, lookup with "classic hiera"
|
326
|
+
result = nil
|
327
|
+
if scope.compiler.is_binder_active?
|
328
|
+
result = scope.compiler.injector.lookup(scope, name)
|
329
|
+
end
|
330
|
+
if result.nil?
|
320
331
|
Puppet::DataBinding.indirection.find(
|
321
|
-
|
332
|
+
name,
|
322
333
|
:environment => scope.environment.to_s,
|
323
334
|
:variables => Puppet::DataBinding::Variables.new(scope))
|
324
335
|
else
|
325
|
-
|
336
|
+
result
|
326
337
|
end
|
327
338
|
end
|
339
|
+
|
328
340
|
private :lookup_external_default_for
|
329
341
|
|
330
342
|
def set_default_parameters(scope)
|
@@ -396,7 +408,7 @@ class Puppet::Resource
|
|
396
408
|
# Produce a canonical method name.
|
397
409
|
def parameter_name(param)
|
398
410
|
param = param.to_s.downcase.to_sym
|
399
|
-
if param == :name and
|
411
|
+
if param == :name and namevar
|
400
412
|
param = namevar
|
401
413
|
end
|
402
414
|
param
|
@@ -1,17 +1,17 @@
|
|
1
1
|
require 'puppet/node'
|
2
2
|
require 'puppet/indirector'
|
3
|
-
require 'puppet/simple_graph'
|
4
3
|
require 'puppet/transaction'
|
5
|
-
|
6
4
|
require 'puppet/util/pson'
|
7
|
-
|
8
5
|
require 'puppet/util/tagging'
|
6
|
+
require 'puppet/graph'
|
9
7
|
|
10
|
-
# This class models a node catalog. It is the thing
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
|
8
|
+
# This class models a node catalog. It is the thing meant to be passed
|
9
|
+
# from server to client, and it contains all of the information in the
|
10
|
+
# catalog, including the resources and the relationships between them.
|
11
|
+
#
|
12
|
+
# @api public
|
13
|
+
|
14
|
+
class Puppet::Resource::Catalog < Puppet::Graph::SimpleGraph
|
15
15
|
class DuplicateResourceError < Puppet::Error
|
16
16
|
include Puppet::ExternalFileError
|
17
17
|
end
|
@@ -64,33 +64,49 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
64
64
|
[$1, $2]
|
65
65
|
end
|
66
66
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
# * Add the resource to the relationship graph
|
73
|
-
# * Add any aliases that make sense for the resource (e.g., name != title)
|
74
|
-
def add_resource(*resource)
|
75
|
-
add_resource(*resource[0..-2]) if resource.length > 1
|
76
|
-
resource = resource.pop
|
77
|
-
raise ArgumentError, "Can only add objects that respond to :ref, not instances of #{resource.class}" unless resource.respond_to?(:ref)
|
78
|
-
fail_on_duplicate_type_and_title(resource)
|
79
|
-
title_key = title_key_for_ref(resource.ref)
|
67
|
+
def add_resource(*resources)
|
68
|
+
resources.each do |resource|
|
69
|
+
add_one_resource(resource)
|
70
|
+
end
|
71
|
+
end
|
80
72
|
|
81
|
-
|
82
|
-
|
73
|
+
# @param resource [A Resource] a resource in the catalog
|
74
|
+
# @return [A Resource, nil] the resource that contains the given resource
|
75
|
+
# @api public
|
76
|
+
def container_of(resource)
|
77
|
+
adjacent(resource, :direction => :in)[0]
|
78
|
+
end
|
83
79
|
|
84
|
-
|
80
|
+
def add_one_resource(resource)
|
81
|
+
fail_on_duplicate_type_and_title(resource)
|
85
82
|
|
86
|
-
|
87
|
-
|
88
|
-
end
|
83
|
+
add_resource_to_table(resource)
|
84
|
+
create_resource_aliases(resource)
|
89
85
|
|
90
86
|
resource.catalog = self if resource.respond_to?(:catalog=)
|
87
|
+
add_resource_to_graph(resource)
|
88
|
+
end
|
89
|
+
private :add_one_resource
|
90
|
+
|
91
|
+
def add_resource_to_table(resource)
|
92
|
+
title_key = title_key_for_ref(resource.ref)
|
93
|
+
@resource_table[title_key] = resource
|
94
|
+
@resources << title_key
|
95
|
+
end
|
96
|
+
private :add_resource_to_table
|
97
|
+
|
98
|
+
def add_resource_to_graph(resource)
|
91
99
|
add_vertex(resource)
|
92
100
|
@relationship_graph.add_vertex(resource) if @relationship_graph
|
93
101
|
end
|
102
|
+
private :add_resource_to_graph
|
103
|
+
|
104
|
+
def create_resource_aliases(resource)
|
105
|
+
if resource.respond_to?(:isomorphic?) and resource.isomorphic? and resource.name != resource.title
|
106
|
+
self.alias(resource, resource.uniqueness_key)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
private :create_resource_aliases
|
94
110
|
|
95
111
|
# Create an alias for a resource.
|
96
112
|
def alias(resource, key)
|
@@ -120,32 +136,32 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
120
136
|
@aliases[resource.ref] << newref
|
121
137
|
end
|
122
138
|
|
123
|
-
# Apply our catalog to the local host.
|
124
|
-
#
|
125
|
-
#
|
126
|
-
#
|
127
|
-
#
|
128
|
-
#
|
139
|
+
# Apply our catalog to the local host.
|
140
|
+
# @param options [Hash{Symbol => Object}] a hash of options
|
141
|
+
# @option options [Puppet::Transaction::Report] :report
|
142
|
+
# The report object to log this transaction to. This is optional,
|
143
|
+
# and the resulting transaction will create a report if not
|
144
|
+
# supplied.
|
145
|
+
# @option options [Array[String]] :tags
|
146
|
+
# Tags used to filter the transaction. If supplied then only
|
147
|
+
# resources tagged with any of these tags will be evaluated.
|
148
|
+
# @option options [Boolean] :ignoreschedules
|
149
|
+
# Ignore schedules when evaluating resources
|
150
|
+
# @option options [Boolean] :for_network_device
|
151
|
+
# Whether this catalog is for a network device
|
152
|
+
#
|
153
|
+
# @return [Puppet::Transaction] the transaction created for this
|
154
|
+
# application
|
155
|
+
#
|
156
|
+
# @api public
|
129
157
|
def apply(options = {})
|
130
|
-
@applying = true
|
131
|
-
|
132
158
|
Puppet::Util::Storage.load if host_config?
|
133
159
|
|
134
|
-
transaction =
|
135
|
-
register_report = options[:report].nil?
|
136
|
-
|
137
|
-
transaction.tags = options[:tags] if options[:tags]
|
138
|
-
transaction.ignoreschedules = true if options[:ignoreschedules]
|
139
|
-
transaction.for_network_device = options[:network_device]
|
140
|
-
|
141
|
-
transaction.add_times :config_retrieval => self.retrieval_duration || 0
|
160
|
+
transaction = create_transaction(options)
|
142
161
|
|
143
162
|
begin
|
144
|
-
|
145
|
-
begin
|
163
|
+
transaction.report.as_logging_destination do
|
146
164
|
transaction.evaluate
|
147
|
-
ensure
|
148
|
-
Puppet::Util::Log.close(transaction.report) if register_report
|
149
165
|
end
|
150
166
|
rescue Puppet::Error => detail
|
151
167
|
Puppet.log_exception(detail, "Could not apply complete catalog: #{detail}")
|
@@ -159,14 +175,20 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
159
175
|
|
160
176
|
yield transaction if block_given?
|
161
177
|
|
162
|
-
|
163
|
-
ensure
|
164
|
-
@applying = false
|
178
|
+
transaction
|
165
179
|
end
|
166
180
|
|
167
|
-
#
|
168
|
-
|
169
|
-
|
181
|
+
# The relationship_graph form of the catalog. This contains all of the
|
182
|
+
# dependency edges that are used for determining order.
|
183
|
+
#
|
184
|
+
# @return [Puppet::Graph::RelationshipGraph]
|
185
|
+
# @api public
|
186
|
+
def relationship_graph
|
187
|
+
if @relationship_graph.nil?
|
188
|
+
@relationship_graph = Puppet::Graph::RelationshipGraph.new(prioritizer)
|
189
|
+
@relationship_graph.populate_from(self)
|
190
|
+
end
|
191
|
+
@relationship_graph
|
170
192
|
end
|
171
193
|
|
172
194
|
def clear(remove_resources = true)
|
@@ -174,6 +196,7 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
174
196
|
# We have to do this so that the resources clean themselves up.
|
175
197
|
@resource_table.values.each { |resource| resource.remove } if remove_resources
|
176
198
|
@resource_table.clear
|
199
|
+
@resources = []
|
177
200
|
|
178
201
|
if @relationship_graph
|
179
202
|
@relationship_graph.clear
|
@@ -214,8 +237,7 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
214
237
|
@name = name if name
|
215
238
|
@classes = []
|
216
239
|
@resource_table = {}
|
217
|
-
@
|
218
|
-
@applying = false
|
240
|
+
@resources = []
|
219
241
|
@relationship_graph = nil
|
220
242
|
|
221
243
|
@host_config = true
|
@@ -242,109 +264,6 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
242
264
|
end
|
243
265
|
end
|
244
266
|
|
245
|
-
# Create a graph of all of the relationships in our catalog.
|
246
|
-
def relationship_graph
|
247
|
-
unless @relationship_graph
|
248
|
-
# It's important that we assign the graph immediately, because
|
249
|
-
# the debug messages below use the relationships in the
|
250
|
-
# relationship graph to determine the path to the resources
|
251
|
-
# spitting out the messages. If this is not set,
|
252
|
-
# then we get into an infinite loop.
|
253
|
-
@relationship_graph = Puppet::SimpleGraph.new
|
254
|
-
|
255
|
-
# First create the dependency graph
|
256
|
-
self.vertices.each do |vertex|
|
257
|
-
@relationship_graph.add_vertex vertex
|
258
|
-
vertex.builddepends.each do |edge|
|
259
|
-
@relationship_graph.add_edge(edge)
|
260
|
-
end
|
261
|
-
end
|
262
|
-
|
263
|
-
# Lastly, add in any autorequires
|
264
|
-
@relationship_graph.vertices.each do |vertex|
|
265
|
-
vertex.autorequire(self).each do |edge|
|
266
|
-
unless @relationship_graph.edge?(edge.source, edge.target) # don't let automatic relationships conflict with manual ones.
|
267
|
-
unless @relationship_graph.edge?(edge.target, edge.source)
|
268
|
-
vertex.debug "Autorequiring #{edge.source}"
|
269
|
-
@relationship_graph.add_edge(edge)
|
270
|
-
else
|
271
|
-
vertex.debug "Skipping automatic relationship with #{(edge.source == vertex ? edge.target : edge.source)}"
|
272
|
-
end
|
273
|
-
end
|
274
|
-
end
|
275
|
-
end
|
276
|
-
@relationship_graph.write_graph(:relationships) if host_config?
|
277
|
-
|
278
|
-
# Then splice in the container information
|
279
|
-
splice!(@relationship_graph)
|
280
|
-
|
281
|
-
@relationship_graph.write_graph(:expanded_relationships) if host_config?
|
282
|
-
end
|
283
|
-
@relationship_graph
|
284
|
-
end
|
285
|
-
|
286
|
-
# Impose our container information on another graph by using it
|
287
|
-
# to replace any container vertices X with a pair of verticies
|
288
|
-
# { admissible_X and completed_X } such that that
|
289
|
-
#
|
290
|
-
# 0) completed_X depends on admissible_X
|
291
|
-
# 1) contents of X each depend on admissible_X
|
292
|
-
# 2) completed_X depends on each on the contents of X
|
293
|
-
# 3) everything which depended on X depens on completed_X
|
294
|
-
# 4) admissible_X depends on everything X depended on
|
295
|
-
# 5) the containers and their edges must be removed
|
296
|
-
#
|
297
|
-
# Note that this requires attention to the possible case of containers
|
298
|
-
# which contain or depend on other containers, but has the advantage
|
299
|
-
# that the number of new edges created scales linearly with the number
|
300
|
-
# of contained verticies regardless of how containers are related;
|
301
|
-
# alternatives such as replacing container-edges with content-edges
|
302
|
-
# scale as the product of the number of external dependences, which is
|
303
|
-
# to say geometrically in the case of nested / chained containers.
|
304
|
-
#
|
305
|
-
Default_label = { :callback => :refresh, :event => :ALL_EVENTS }
|
306
|
-
def splice!(other)
|
307
|
-
stage_class = Puppet::Type.type(:stage)
|
308
|
-
whit_class = Puppet::Type.type(:whit)
|
309
|
-
component_class = Puppet::Type.type(:component)
|
310
|
-
containers = vertices.find_all { |v| (v.is_a?(component_class) or v.is_a?(stage_class)) and vertex?(v) }
|
311
|
-
#
|
312
|
-
# These two hashes comprise the aforementioned attention to the possible
|
313
|
-
# case of containers that contain / depend on other containers; they map
|
314
|
-
# containers to their sentinels but pass other verticies through. Thus we
|
315
|
-
# can "do the right thing" for references to other verticies that may or
|
316
|
-
# may not be containers.
|
317
|
-
#
|
318
|
-
admissible = Hash.new { |h,k| k }
|
319
|
-
completed = Hash.new { |h,k| k }
|
320
|
-
containers.each { |x|
|
321
|
-
admissible[x] = whit_class.new(:name => "admissible_#{x.ref}", :catalog => self)
|
322
|
-
completed[x] = whit_class.new(:name => "completed_#{x.ref}", :catalog => self)
|
323
|
-
}
|
324
|
-
#
|
325
|
-
# Implement the six requierments listed above
|
326
|
-
#
|
327
|
-
containers.each { |x|
|
328
|
-
contents = adjacent(x, :direction => :out)
|
329
|
-
other.add_edge(admissible[x],completed[x]) if contents.empty? # (0)
|
330
|
-
contents.each { |v|
|
331
|
-
other.add_edge(admissible[x],admissible[v],Default_label) # (1)
|
332
|
-
other.add_edge(completed[v], completed[x], Default_label) # (2)
|
333
|
-
}
|
334
|
-
# (3) & (5)
|
335
|
-
other.adjacent(x,:direction => :in,:type => :edges).each { |e|
|
336
|
-
other.add_edge(completed[e.source],admissible[x],e.label)
|
337
|
-
other.remove_edge! e
|
338
|
-
}
|
339
|
-
# (4) & (5)
|
340
|
-
other.adjacent(x,:direction => :out,:type => :edges).each { |e|
|
341
|
-
other.add_edge(completed[x],admissible[e.target],e.label)
|
342
|
-
other.remove_edge! e
|
343
|
-
}
|
344
|
-
}
|
345
|
-
containers.each { |x| other.remove_vertex! x } # (5)
|
346
|
-
end
|
347
|
-
|
348
267
|
# Remove the resource from our catalog. Notice that we also call
|
349
268
|
# 'remove' on the resource, at least until resource classes no longer maintain
|
350
269
|
# references to the resource instances.
|
@@ -358,20 +277,21 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
358
277
|
end
|
359
278
|
remove_vertex!(resource) if vertex?(resource)
|
360
279
|
@relationship_graph.remove_vertex!(resource) if @relationship_graph and @relationship_graph.vertex?(resource)
|
280
|
+
@resources.delete(title_key)
|
361
281
|
resource.remove
|
362
282
|
end
|
363
283
|
end
|
364
284
|
|
365
285
|
# Look a resource up by its reference (e.g., File[/etc/passwd]).
|
366
286
|
def resource(type, title = nil)
|
367
|
-
# Always create a resource reference, so that it always
|
368
|
-
# are referring to them.
|
287
|
+
# Always create a resource reference, so that it always
|
288
|
+
# canonicalizes how we are referring to them.
|
369
289
|
if title
|
370
290
|
res = Puppet::Resource.new(type, title)
|
371
291
|
else
|
372
292
|
# If they didn't provide a title, then we expect the first
|
373
293
|
# argument to be of the form 'Class[name]', which our
|
374
|
-
# Reference class
|
294
|
+
# Reference class canonicalizes for us.
|
375
295
|
res = Puppet::Resource.new(nil, type)
|
376
296
|
end
|
377
297
|
title_key = [res.type, res.title.to_s]
|
@@ -388,7 +308,9 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
388
308
|
end
|
389
309
|
|
390
310
|
def resources
|
391
|
-
@
|
311
|
+
@resources.collect do |key|
|
312
|
+
@resource_table[key]
|
313
|
+
end
|
392
314
|
end
|
393
315
|
|
394
316
|
def self.from_pson(data)
|
@@ -407,10 +329,9 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
407
329
|
end
|
408
330
|
|
409
331
|
if resources = data['resources']
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
end
|
332
|
+
result.add_resource(*resources.collect do |res|
|
333
|
+
Puppet::Resource.from_pson(res)
|
334
|
+
end)
|
414
335
|
end
|
415
336
|
|
416
337
|
if edges = data['edges']
|
@@ -444,11 +365,6 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
444
365
|
result.add_edge(edge)
|
445
366
|
end
|
446
367
|
|
447
|
-
def self.resource_from_pson(result, res)
|
448
|
-
res = Puppet::Resource.from_pson(res) if res.is_a? Hash
|
449
|
-
result.add_resource(res)
|
450
|
-
end
|
451
|
-
|
452
368
|
PSON.register_document_type('Catalog',self)
|
453
369
|
def to_pson_data_hash
|
454
370
|
{
|
@@ -458,7 +374,7 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
458
374
|
'name' => name,
|
459
375
|
'version' => version,
|
460
376
|
'environment' => environment.to_s,
|
461
|
-
'resources' =>
|
377
|
+
'resources' => @resources.collect { |v| @resource_table[v].to_pson_data_hash },
|
462
378
|
'edges' => edges. collect { |e| e.to_pson_data_hash },
|
463
379
|
'classes' => classes
|
464
380
|
},
|
@@ -525,6 +441,28 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
525
441
|
|
526
442
|
private
|
527
443
|
|
444
|
+
def prioritizer
|
445
|
+
@prioritizer ||= case Puppet[:ordering]
|
446
|
+
when "title-hash"
|
447
|
+
Puppet::Graph::TitleHashPrioritizer.new
|
448
|
+
when "manifest"
|
449
|
+
Puppet::Graph::SequentialPrioritizer.new
|
450
|
+
when "random"
|
451
|
+
Puppet::Graph::RandomPrioritizer.new
|
452
|
+
else
|
453
|
+
raise Puppet::DevError, "Unknown ordering type #{Puppet[:ordering]}"
|
454
|
+
end
|
455
|
+
end
|
456
|
+
|
457
|
+
def create_transaction(options)
|
458
|
+
transaction = Puppet::Transaction.new(self, options[:report], prioritizer)
|
459
|
+
transaction.tags = options[:tags] if options[:tags]
|
460
|
+
transaction.ignoreschedules = true if options[:ignoreschedules]
|
461
|
+
transaction.for_network_device = options[:network_device]
|
462
|
+
|
463
|
+
transaction
|
464
|
+
end
|
465
|
+
|
528
466
|
# Verify that the given resource isn't declared elsewhere.
|
529
467
|
def fail_on_duplicate_type_and_title(resource)
|
530
468
|
# Short-curcuit the common case,
|
@@ -550,7 +488,7 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
|
|
550
488
|
result.environment = self.environment
|
551
489
|
|
552
490
|
map = {}
|
553
|
-
|
491
|
+
resources.each do |resource|
|
554
492
|
next if virtual_not_exported?(resource)
|
555
493
|
next if block_given? and yield resource
|
556
494
|
|