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
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'time'
|
2
|
+
|
1
3
|
module Puppet
|
2
4
|
class Resource
|
3
5
|
class Status
|
@@ -9,12 +11,14 @@ module Puppet
|
|
9
11
|
STATES = [:skipped, :failed, :failed_to_restart, :restarted, :changed, :out_of_sync, :scheduled]
|
10
12
|
attr_accessor *STATES
|
11
13
|
|
12
|
-
attr_reader :source_description, :
|
13
|
-
|
14
|
+
attr_reader :source_description, :containment_path,
|
15
|
+
:default_log_level, :time, :resource, :change_count,
|
16
|
+
:out_of_sync_count, :resource_type, :title
|
14
17
|
|
15
18
|
YAML_ATTRIBUTES = %w{@resource @file @line @evaluation_time @change_count
|
16
19
|
@out_of_sync_count @tags @time @events @out_of_sync
|
17
|
-
@changed @resource_type @title @skipped @failed
|
20
|
+
@changed @resource_type @title @skipped @failed
|
21
|
+
@containment_path}.
|
18
22
|
map(&:to_sym)
|
19
23
|
|
20
24
|
|
@@ -54,8 +58,20 @@ module Puppet
|
|
54
58
|
@events
|
55
59
|
end
|
56
60
|
|
61
|
+
def failed_because(detail)
|
62
|
+
@real_resource.log_exception(detail, "Could not evaluate: #{detail}")
|
63
|
+
failed = true
|
64
|
+
# There's a contract (implicit unfortunately) that a status of failed
|
65
|
+
# will always be accompanied by an event with some explanatory power. This
|
66
|
+
# is useful for reporting/diagnostics/etc. So synthesize an event here
|
67
|
+
# with the exception detail as the message.
|
68
|
+
add_event(@real_resource.event(:status => "failure", :message => detail.to_s))
|
69
|
+
end
|
70
|
+
|
57
71
|
def initialize(resource)
|
72
|
+
@real_resource = resource
|
58
73
|
@source_description = resource.path
|
74
|
+
@containment_path = resource.pathbuilder
|
59
75
|
@resource = resource.to_s
|
60
76
|
@change_count = 0
|
61
77
|
@out_of_sync_count = 0
|
@@ -78,6 +94,7 @@ module Puppet
|
|
78
94
|
@resource_type = data['resource_type']
|
79
95
|
@title = data['title']
|
80
96
|
@resource = data['resource']
|
97
|
+
@containment_path = data['containment_path']
|
81
98
|
@file = data['file']
|
82
99
|
@line = data['line']
|
83
100
|
@evaluation_time = data['evaluation_time']
|
@@ -85,6 +102,7 @@ module Puppet
|
|
85
102
|
@out_of_sync_count = data['out_of_sync_count']
|
86
103
|
@tags = data['tags']
|
87
104
|
@time = data['time']
|
105
|
+
@time = Time.parse(@time) if @time.is_a? String
|
88
106
|
@out_of_sync = data['out_of_sync']
|
89
107
|
@changed = data['changed']
|
90
108
|
@skipped = data['skipped']
|
@@ -95,6 +113,27 @@ module Puppet
|
|
95
113
|
end
|
96
114
|
end
|
97
115
|
|
116
|
+
def to_pson
|
117
|
+
{
|
118
|
+
'title' => @title,
|
119
|
+
'file' => @file,
|
120
|
+
'line' => @line,
|
121
|
+
'resource' => @resource,
|
122
|
+
'resource_type' => @resource_type,
|
123
|
+
'containment_path' => @containment_path,
|
124
|
+
'evaluation_time' => @evaluation_time,
|
125
|
+
'tags' => @tags,
|
126
|
+
'time' => @time.iso8601(9),
|
127
|
+
'failed' => @failed,
|
128
|
+
'changed' => @changed,
|
129
|
+
'out_of_sync' => @out_of_sync,
|
130
|
+
'skipped' => @skipped,
|
131
|
+
'change_count' => @change_count,
|
132
|
+
'out_of_sync_count' => @out_of_sync_count,
|
133
|
+
'events' => @events,
|
134
|
+
}.to_pson
|
135
|
+
end
|
136
|
+
|
98
137
|
def to_yaml_properties
|
99
138
|
YAML_ATTRIBUTES & instance_variables
|
100
139
|
end
|
data/lib/puppet/resource/type.rb
CHANGED
@@ -6,6 +6,14 @@ require 'puppet/parser/ast/leaf'
|
|
6
6
|
require 'puppet/parser/ast/block_expression'
|
7
7
|
require 'puppet/dsl'
|
8
8
|
|
9
|
+
# Puppet::Resource::Type represents nodes, classes and defined types.
|
10
|
+
#
|
11
|
+
# It has a standard format for external consumption, usable from the
|
12
|
+
# resource_type indirection via rest and the resource_type face. See the
|
13
|
+
# {file:api_docs/http_resource_type.md#Schema resource type schema
|
14
|
+
# description}.
|
15
|
+
#
|
16
|
+
# @api public
|
9
17
|
class Puppet::Resource::Type
|
10
18
|
Puppet::ResourceType = self
|
11
19
|
include Puppet::Util::InlineDocs
|
@@ -14,13 +22,7 @@ class Puppet::Resource::Type
|
|
14
22
|
|
15
23
|
RESOURCE_KINDS = [:hostclass, :node, :definition]
|
16
24
|
|
17
|
-
#
|
18
|
-
# in our documentation that don't entirely match up with our internal names
|
19
|
-
# for things. Ideally we'd change the internal representation to match the
|
20
|
-
# conventions expressed in our docs, but that would be a fairly far-reaching
|
21
|
-
# and risky change. For the time being, we're settling for mapping the
|
22
|
-
# internal names to the external ones (and vice-versa) during serialization
|
23
|
-
# and deserialization. These two hashes is here to help with that mapping.
|
25
|
+
# Map the names used in our documentation to the names used internally
|
24
26
|
RESOURCE_KINDS_TO_EXTERNAL_NAMES = {
|
25
27
|
:hostclass => "class",
|
26
28
|
:node => "node",
|
@@ -54,41 +56,26 @@ class Puppet::Resource::Type
|
|
54
56
|
|
55
57
|
data = data.inject({}) { |result, ary| result[ary[0].intern] = ary[1]; result }
|
56
58
|
|
57
|
-
#
|
58
|
-
#
|
59
|
-
# class we use the term "arguments". Ideally we'd change the implementation to be consistent
|
60
|
-
# with the documentation, but that would be challenging right now because it could potentially
|
61
|
-
# touch a lot of places in the code, not to mention that we already have another meaning for
|
62
|
-
# "parameters" internally. So, for now, we will simply transform the internal "arguments"
|
63
|
-
# value to "parameters" when serializing, and the opposite when deserializing.
|
64
|
-
# --cprice 2012-04-23
|
59
|
+
# External documentation uses "parameters" but the internal name
|
60
|
+
# is "arguments"
|
65
61
|
data[:arguments] = data.delete(:parameters)
|
66
62
|
|
67
63
|
new(type, name, data)
|
68
64
|
end
|
69
65
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
# serialization / deserialization, and there are probably many other similar methods in
|
74
|
-
# other classes.
|
75
|
-
# --cprice 2012-04-23
|
66
|
+
def to_pson(*args)
|
67
|
+
to_data_hash.to_pson(*args)
|
68
|
+
end
|
76
69
|
|
77
|
-
def
|
70
|
+
def to_data_hash
|
78
71
|
data = [:doc, :line, :file, :parent].inject({}) do |hash, param|
|
79
72
|
next hash unless (value = self.send(param)) and (value != "")
|
80
73
|
hash[param.to_s] = value
|
81
74
|
hash
|
82
75
|
end
|
83
76
|
|
84
|
-
#
|
85
|
-
#
|
86
|
-
# class we use the term "arguments". Ideally we'd change the implementation to be consistent
|
87
|
-
# with the documentation, but that would be challenging right now because it could potentially
|
88
|
-
# touch a lot of places in the code, not to mention that we already have another meaning for
|
89
|
-
# "parameters" internally. So, for now, we will simply transform the internal "arguments"
|
90
|
-
# value to "parameters" when serializing, and the opposite when deserializing.
|
91
|
-
# --cprice 2012-04-23
|
77
|
+
# External documentation uses "parameters" but the internal name
|
78
|
+
# is "arguments"
|
92
79
|
data['parameters'] = arguments.dup unless arguments.empty?
|
93
80
|
|
94
81
|
data['name'] = name
|
@@ -100,19 +87,6 @@ class Puppet::Resource::Type
|
|
100
87
|
data
|
101
88
|
end
|
102
89
|
|
103
|
-
# It seems wrong that we have a 'to_pson' method on this class, but not a 'to_yaml'.
|
104
|
-
# As a result, if you use the REST API to retrieve one or more objects of this type,
|
105
|
-
# you will receive different data if you use 'Accept: yaml' vs 'Accept: pson'. That
|
106
|
-
# seems really, really wrong. The "Accept" header should never affect what data is
|
107
|
-
# being returned--only the format of the data. If the data itself is going to differ,
|
108
|
-
# then there should be a different request URL. Documenting the REST API becomes
|
109
|
-
# a much more complex problem when the "Accept" header can change the semantics
|
110
|
-
# of the response. --cprice 2012-04-23
|
111
|
-
|
112
|
-
def to_pson(*args)
|
113
|
-
to_pson_data_hash.to_pson(*args)
|
114
|
-
end
|
115
|
-
|
116
90
|
# Are we a child of the passed class? Do a recursive search up our
|
117
91
|
# parentage tree to figure it out.
|
118
92
|
def child_of?(klass)
|
@@ -134,7 +108,19 @@ class Puppet::Resource::Type
|
|
134
108
|
|
135
109
|
resource.add_edge_to_stage
|
136
110
|
|
137
|
-
|
111
|
+
if code
|
112
|
+
if @match # Only bother setting up the ephemeral scope if there are match variables to add into it
|
113
|
+
begin
|
114
|
+
elevel = scope.ephemeral_level
|
115
|
+
scope.ephemeral_from(@match, file, line)
|
116
|
+
code.safeevaluate(scope)
|
117
|
+
ensure
|
118
|
+
scope.unset_ephemeral_var(elevel)
|
119
|
+
end
|
120
|
+
else
|
121
|
+
code.safeevaluate(scope)
|
122
|
+
end
|
123
|
+
end
|
138
124
|
|
139
125
|
evaluate_ruby_code(resource, scope) if ruby_code
|
140
126
|
end
|
@@ -154,6 +140,8 @@ class Puppet::Resource::Type
|
|
154
140
|
|
155
141
|
set_arguments(options[:arguments])
|
156
142
|
|
143
|
+
@match = nil
|
144
|
+
|
157
145
|
@module_name = options[:module_name]
|
158
146
|
end
|
159
147
|
|
@@ -162,7 +150,7 @@ class Puppet::Resource::Type
|
|
162
150
|
def match(string)
|
163
151
|
return string.to_s.downcase == name unless name_is_regex?
|
164
152
|
|
165
|
-
@
|
153
|
+
@match = @name.match(string)
|
166
154
|
end
|
167
155
|
|
168
156
|
# Add code from a new instance to our code.
|
@@ -242,7 +230,6 @@ class Puppet::Resource::Type
|
|
242
230
|
|
243
231
|
def assign_parameter_values(parameters, resource)
|
244
232
|
return unless parameters
|
245
|
-
scope = resource.scope || {}
|
246
233
|
|
247
234
|
# It'd be nice to assign default parameter values here,
|
248
235
|
# but we can't because they often rely on local variables
|
@@ -1,9 +1,13 @@
|
|
1
1
|
require 'puppet/parser/type_loader'
|
2
|
+
require 'puppet/util/file_watcher'
|
3
|
+
require 'puppet/util/warnings'
|
2
4
|
|
3
5
|
class Puppet::Resource::TypeCollection
|
4
6
|
attr_reader :environment
|
5
7
|
attr_accessor :parse_failed
|
6
8
|
|
9
|
+
include Puppet::Util::Warnings
|
10
|
+
|
7
11
|
def clear
|
8
12
|
@hostclasses.clear
|
9
13
|
@definitions.clear
|
@@ -22,7 +26,7 @@ class Puppet::Resource::TypeCollection
|
|
22
26
|
# So we can keep a list and match the first-defined regex
|
23
27
|
@node_list = []
|
24
28
|
|
25
|
-
@watched_files =
|
29
|
+
@watched_files = Puppet::Util::FileWatcher.new
|
26
30
|
end
|
27
31
|
|
28
32
|
def import_ast(ast, modname)
|
@@ -130,29 +134,29 @@ class Puppet::Resource::TypeCollection
|
|
130
134
|
end
|
131
135
|
|
132
136
|
def stale?
|
133
|
-
@watched_files.
|
137
|
+
@watched_files.changed?
|
134
138
|
end
|
135
139
|
|
136
140
|
def version
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
141
|
+
if !defined?(@version)
|
142
|
+
if environment[:config_version] == ""
|
143
|
+
@version = Time.now.to_i
|
144
|
+
else
|
145
|
+
@version = Puppet::Util::Execution.execute([environment[:config_version]]).strip
|
146
|
+
end
|
142
147
|
end
|
143
148
|
|
144
|
-
@version
|
145
|
-
|
149
|
+
@version
|
146
150
|
rescue Puppet::ExecutionFailure => e
|
147
|
-
raise Puppet::ParseError, "
|
151
|
+
raise Puppet::ParseError, "Execution of config_version command `#{environment[:config_version]}` failed: #{e.message}"
|
148
152
|
end
|
149
153
|
|
150
|
-
def watch_file(
|
151
|
-
@watched_files
|
154
|
+
def watch_file(filename)
|
155
|
+
@watched_files.watch(filename)
|
152
156
|
end
|
153
157
|
|
154
|
-
def watching_file?(
|
155
|
-
@watched_files.
|
158
|
+
def watching_file?(filename)
|
159
|
+
@watched_files.watching?(filename)
|
156
160
|
end
|
157
161
|
|
158
162
|
private
|
@@ -202,7 +206,7 @@ class Puppet::Resource::TypeCollection
|
|
202
206
|
if @notfound[fqname] and Puppet[:ignoremissingtypes]
|
203
207
|
# do not try to autoload if we already tried and it wasn't conclusive
|
204
208
|
# as this is a time consuming operation. Warn the user.
|
205
|
-
|
209
|
+
debug_once "Not attempting to load #{type} #{fqname} as this object was missing during a prior compilation"
|
206
210
|
else
|
207
211
|
result = loader.try_load_fqname(type, fqname)
|
208
212
|
@notfound[fqname] = result.nil?
|
data/lib/puppet/run.rb
CHANGED
@@ -1,38 +1,37 @@
|
|
1
1
|
module Puppet::Scheduler
|
2
2
|
class Scheduler
|
3
|
-
def initialize(
|
3
|
+
def initialize(timer=Puppet::Scheduler::Timer.new)
|
4
4
|
@timer = timer
|
5
|
-
@jobs = jobs
|
6
5
|
end
|
7
6
|
|
8
|
-
def run_loop
|
9
|
-
mark_start_times(@timer.now)
|
10
|
-
while not
|
11
|
-
@timer.wait_for(min_interval_to_next_run_from(@timer.now))
|
12
|
-
run_ready(@timer.now)
|
7
|
+
def run_loop(jobs)
|
8
|
+
mark_start_times(jobs, @timer.now)
|
9
|
+
while not enabled(jobs).empty?
|
10
|
+
@timer.wait_for(min_interval_to_next_run_from(jobs, @timer.now))
|
11
|
+
run_ready(jobs, @timer.now)
|
13
12
|
end
|
14
13
|
end
|
15
14
|
|
16
15
|
private
|
17
16
|
|
18
|
-
def
|
19
|
-
|
17
|
+
def enabled(jobs)
|
18
|
+
jobs.select(&:enabled?)
|
20
19
|
end
|
21
20
|
|
22
|
-
def mark_start_times(start_time)
|
23
|
-
|
21
|
+
def mark_start_times(jobs, start_time)
|
22
|
+
jobs.each do |job|
|
24
23
|
job.start_time = start_time
|
25
24
|
end
|
26
25
|
end
|
27
26
|
|
28
|
-
def min_interval_to_next_run_from(from_time)
|
29
|
-
|
27
|
+
def min_interval_to_next_run_from(jobs, from_time)
|
28
|
+
enabled(jobs).map do |j|
|
30
29
|
j.interval_to_next_from(from_time)
|
31
30
|
end.min
|
32
31
|
end
|
33
32
|
|
34
|
-
def run_ready(at_time)
|
35
|
-
|
33
|
+
def run_ready(jobs, at_time)
|
34
|
+
enabled(jobs).each do |j|
|
36
35
|
# This check intentionally happens right before each run,
|
37
36
|
# instead of filtering on ready schedulers, since one may adjust
|
38
37
|
# the readiness of a later one
|
data/lib/puppet/settings.rb
CHANGED
@@ -1,23 +1,26 @@
|
|
1
1
|
require 'puppet'
|
2
2
|
require 'sync'
|
3
3
|
require 'getoptlong'
|
4
|
-
require 'puppet/util/
|
4
|
+
require 'puppet/util/watched_file'
|
5
5
|
require 'puppet/util/command_line/puppet_option_parser'
|
6
|
-
require 'puppet/settings/errors'
|
7
|
-
require 'puppet/settings/string_setting'
|
8
|
-
require 'puppet/settings/file_setting'
|
9
|
-
require 'puppet/settings/directory_setting'
|
10
|
-
require 'puppet/settings/path_setting'
|
11
|
-
require 'puppet/settings/boolean_setting'
|
12
|
-
require 'puppet/settings/terminus_setting'
|
13
|
-
require 'puppet/settings/duration_setting'
|
14
|
-
require 'puppet/settings/config_file'
|
15
|
-
require 'puppet/settings/value_translator'
|
16
6
|
|
17
7
|
# The class for handling configuration files.
|
18
8
|
class Puppet::Settings
|
19
9
|
include Enumerable
|
20
10
|
|
11
|
+
require 'puppet/settings/errors'
|
12
|
+
require 'puppet/settings/base_setting'
|
13
|
+
require 'puppet/settings/string_setting'
|
14
|
+
require 'puppet/settings/enum_setting'
|
15
|
+
require 'puppet/settings/file_setting'
|
16
|
+
require 'puppet/settings/directory_setting'
|
17
|
+
require 'puppet/settings/path_setting'
|
18
|
+
require 'puppet/settings/boolean_setting'
|
19
|
+
require 'puppet/settings/terminus_setting'
|
20
|
+
require 'puppet/settings/duration_setting'
|
21
|
+
require 'puppet/settings/config_file'
|
22
|
+
require 'puppet/settings/value_translator'
|
23
|
+
|
21
24
|
# local reference for convenience
|
22
25
|
PuppetOptionParser = Puppet::Util::CommandLine::PuppetOptionParser
|
23
26
|
|
@@ -156,7 +159,34 @@ class Puppet::Settings
|
|
156
159
|
end
|
157
160
|
private :unsafe_clear
|
158
161
|
|
159
|
-
#
|
162
|
+
# Clear @cache, @used and the Environment.
|
163
|
+
#
|
164
|
+
# Whenever an object is returned by Settings, a copy is stored in @cache.
|
165
|
+
# As long as Setting attributes that determine the content of returned
|
166
|
+
# objects remain unchanged, Settings can keep returning objects from @cache
|
167
|
+
# without re-fetching or re-generating them.
|
168
|
+
#
|
169
|
+
# Whenever a Settings attribute changes, such as @values or @preferred_run_mode,
|
170
|
+
# this method must be called to clear out the caches so that updated
|
171
|
+
# objects will be returned.
|
172
|
+
def flush_cache
|
173
|
+
@sync.synchronize do
|
174
|
+
unsafe_flush_cache
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
def unsafe_flush_cache
|
179
|
+
clearused
|
180
|
+
|
181
|
+
# Clear the list of environments, because they cache, at least, the module path.
|
182
|
+
# We *could* preferentially just clear them if the modulepath is changed,
|
183
|
+
# but we don't really know if, say, the vardir is changed and the modulepath
|
184
|
+
# is defined relative to it. We need the defined?(stuff) because of loading
|
185
|
+
# order issues.
|
186
|
+
Puppet::Node::Environment.clear if defined?(Puppet::Node) and defined?(Puppet::Node::Environment)
|
187
|
+
end
|
188
|
+
private :unsafe_flush_cache
|
189
|
+
|
160
190
|
def clearused
|
161
191
|
@cache.clear
|
162
192
|
@used = []
|
@@ -222,7 +252,7 @@ class Puppet::Settings
|
|
222
252
|
# "no-" prefix on flag/boolean options).
|
223
253
|
#
|
224
254
|
# @param [String] opt the command line option that we are munging
|
225
|
-
# @param [String, TrueClass, FalseClass] the value for the setting (as determined by the OptionParser)
|
255
|
+
# @param [String, TrueClass, FalseClass] val the value for the setting (as determined by the OptionParser)
|
226
256
|
def self.clean_opt(opt, val)
|
227
257
|
# rewrite --[no-]option to --no-option if that's what was given
|
228
258
|
if opt =~ /\[no-\]/ and !val
|
@@ -455,6 +485,10 @@ class Puppet::Settings
|
|
455
485
|
mode = mode.to_s.downcase.intern
|
456
486
|
raise ValidationError, "Invalid run mode '#{mode}'" unless [:master, :agent, :user].include?(mode)
|
457
487
|
@preferred_run_mode_name = mode
|
488
|
+
# Changing the run mode has far-reaching consequences. Flush any cached
|
489
|
+
# settings so they will be re-generated.
|
490
|
+
flush_cache
|
491
|
+
mode
|
458
492
|
end
|
459
493
|
|
460
494
|
# Return all of the parameters associated with a given section.
|
@@ -506,7 +540,7 @@ class Puppet::Settings
|
|
506
540
|
def config_file_name
|
507
541
|
begin
|
508
542
|
return self[:config_file_name] if self[:config_file_name]
|
509
|
-
rescue SettingsError
|
543
|
+
rescue SettingsError
|
510
544
|
# This just means that the setting wasn't explicitly set on the command line, so we will ignore it and
|
511
545
|
# fall through to the default name.
|
512
546
|
end
|
@@ -562,7 +596,7 @@ class Puppet::Settings
|
|
562
596
|
# Call any hooks we should be calling.
|
563
597
|
settings_with_hooks.each do |setting|
|
564
598
|
each_source(env) do |source|
|
565
|
-
if
|
599
|
+
if @values[source][setting.name]
|
566
600
|
# We still have to use value to retrieve the value, since
|
567
601
|
# we want the fully interpolated value, not $vardir/lib or whatever.
|
568
602
|
# This results in extra work, but so few of the settings
|
@@ -593,6 +627,17 @@ class Puppet::Settings
|
|
593
627
|
end
|
594
628
|
private :apply_metadata
|
595
629
|
|
630
|
+
SETTING_TYPES = {
|
631
|
+
:string => StringSetting,
|
632
|
+
:file => FileSetting,
|
633
|
+
:directory => DirectorySetting,
|
634
|
+
:path => PathSetting,
|
635
|
+
:boolean => BooleanSetting,
|
636
|
+
:terminus => TerminusSetting,
|
637
|
+
:duration => DurationSetting,
|
638
|
+
:enum => EnumSetting,
|
639
|
+
}
|
640
|
+
|
596
641
|
# Create a new setting. The value is passed in because it's used to determine
|
597
642
|
# what kind of setting we're creating, but the value itself might be either
|
598
643
|
# a default or a value, so we can't actually assign it.
|
@@ -603,15 +648,7 @@ class Puppet::Settings
|
|
603
648
|
hash[:section] = hash[:section].to_sym if hash[:section]
|
604
649
|
|
605
650
|
if type = hash[:type]
|
606
|
-
unless klass =
|
607
|
-
:string => StringSetting,
|
608
|
-
:file => FileSetting,
|
609
|
-
:directory => DirectorySetting,
|
610
|
-
:path => PathSetting,
|
611
|
-
:boolean => BooleanSetting,
|
612
|
-
:terminus => TerminusSetting,
|
613
|
-
:duration => DurationSetting,
|
614
|
-
} [type]
|
651
|
+
unless klass = SETTING_TYPES[type]
|
615
652
|
raise ArgumentError, "Invalid setting type '#{type}'"
|
616
653
|
end
|
617
654
|
hash.delete(:type)
|
@@ -656,7 +693,7 @@ class Puppet::Settings
|
|
656
693
|
@files = []
|
657
694
|
[main_config_file, user_config_file].each do |path|
|
658
695
|
if FileTest.exist?(path)
|
659
|
-
@files << Puppet::Util::
|
696
|
+
@files << Puppet::Util::WatchedFile.new(path)
|
660
697
|
end
|
661
698
|
end
|
662
699
|
@files
|
@@ -664,10 +701,11 @@ class Puppet::Settings
|
|
664
701
|
private :files
|
665
702
|
|
666
703
|
# Checks to see if any of the config files have been modified
|
667
|
-
# @return the filename of the first file that is found to have changed, or
|
704
|
+
# @return the filename of the first file that is found to have changed, or
|
705
|
+
# nil if no files have changed
|
668
706
|
def any_files_changed?
|
669
707
|
files.each do |file|
|
670
|
-
return file.
|
708
|
+
return file.to_str if file.changed?
|
671
709
|
end
|
672
710
|
nil
|
673
711
|
end
|
@@ -753,16 +791,8 @@ class Puppet::Settings
|
|
753
791
|
@sync.synchronize do # yay, thread-safe
|
754
792
|
|
755
793
|
@values[type][param] = value
|
756
|
-
|
757
|
-
|
758
|
-
clearused
|
794
|
+
unsafe_flush_cache
|
759
795
|
|
760
|
-
# Clear the list of environments, because they cache, at least, the module path.
|
761
|
-
# We *could* preferentially just clear them if the modulepath is changed,
|
762
|
-
# but we don't really know if, say, the vardir is changed and the modulepath
|
763
|
-
# is defined relative to it. We need the defined?(stuff) because of loading
|
764
|
-
# order issues.
|
765
|
-
Puppet::Node::Environment.clear if defined?(Puppet::Node) and defined?(Puppet::Node::Environment)
|
766
796
|
end
|
767
797
|
|
768
798
|
value
|
@@ -952,8 +982,15 @@ Generated on #{Time.now}.
|
|
952
982
|
end
|
953
983
|
private :find_value
|
954
984
|
|
955
|
-
# Find the correct value using our search path.
|
956
|
-
#
|
985
|
+
# Find the correct value using our search path.
|
986
|
+
#
|
987
|
+
# @param param [String, Symbol] The value to look up
|
988
|
+
# @param environment [String, Symbol] The environment to check for the value
|
989
|
+
# @param bypass_interpolation [true, false] Whether to skip interpolation
|
990
|
+
#
|
991
|
+
# @return [Object] The looked up value
|
992
|
+
#
|
993
|
+
# @raise [InterpolationError]
|
957
994
|
def value(param, environment = nil, bypass_interpolation = false)
|
958
995
|
param = param.to_sym
|
959
996
|
environment &&= environment.to_sym
|
@@ -969,8 +1006,8 @@ Generated on #{Time.now}.
|
|
969
1006
|
# Check the cache first. It needs to be a per-environment
|
970
1007
|
# cache so that we don't spread values from one env
|
971
1008
|
# to another.
|
972
|
-
if
|
973
|
-
return
|
1009
|
+
if @cache[environment||"none"].has_key?(param)
|
1010
|
+
return @cache[environment||"none"][param]
|
974
1011
|
end
|
975
1012
|
|
976
1013
|
val = uninterpolated_value(param, environment)
|
@@ -1183,7 +1220,7 @@ Generated on #{Time.now}.
|
|
1183
1220
|
#
|
1184
1221
|
begin
|
1185
1222
|
return true if self[:config]
|
1186
|
-
rescue InterpolationError
|
1223
|
+
rescue InterpolationError
|
1187
1224
|
# This means we failed to interpolate, which means that they didn't
|
1188
1225
|
# explicitly specify either :config or :confdir... so we'll fall out to
|
1189
1226
|
# the default value.
|