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,19 +1,19 @@
|
|
1
1
|
require 'puppet/file_serving/configuration'
|
2
|
-
require 'puppet/util/
|
2
|
+
require 'puppet/util/watched_file'
|
3
3
|
|
4
|
-
class Puppet::FileServing::Configuration::Parser
|
4
|
+
class Puppet::FileServing::Configuration::Parser
|
5
5
|
Mount = Puppet::FileServing::Mount
|
6
6
|
MODULES = 'modules'
|
7
7
|
|
8
8
|
# Parse our configuration file.
|
9
9
|
def parse
|
10
|
-
raise("File server configuration #{
|
11
|
-
raise("Cannot read file server configuration #{
|
10
|
+
raise("File server configuration #{@file} does not exist") unless FileTest.exists?(@file)
|
11
|
+
raise("Cannot read file server configuration #{@file}") unless FileTest.readable?(@file)
|
12
12
|
|
13
13
|
@mounts = {}
|
14
14
|
@count = 0
|
15
15
|
|
16
|
-
File.open(
|
16
|
+
File.open(@file) { |f|
|
17
17
|
mount = nil
|
18
18
|
f.each_line { |line|
|
19
19
|
# Have the count increment at the top, in case we throw exceptions.
|
@@ -37,10 +37,10 @@ class Puppet::FileServing::Configuration::Parser < Puppet::Util::LoadedFile
|
|
37
37
|
when "deny"
|
38
38
|
deny(mount, value)
|
39
39
|
else
|
40
|
-
raise ArgumentError.new("Invalid argument '#{var}'", @count, file)
|
40
|
+
raise ArgumentError.new("Invalid argument '#{var}'", @count, @file)
|
41
41
|
end
|
42
42
|
else
|
43
|
-
raise ArgumentError.new("Invalid line '#{line.chomp}'", @count, file)
|
43
|
+
raise ArgumentError.new("Invalid line '#{line.chomp}'", @count, @file)
|
44
44
|
end
|
45
45
|
}
|
46
46
|
}
|
@@ -50,37 +50,43 @@ class Puppet::FileServing::Configuration::Parser < Puppet::Util::LoadedFile
|
|
50
50
|
@mounts
|
51
51
|
end
|
52
52
|
|
53
|
+
def initialize(filename)
|
54
|
+
@file = Puppet::Util::WatchedFile.new(filename)
|
55
|
+
end
|
56
|
+
|
57
|
+
def changed?
|
58
|
+
@file.changed?
|
59
|
+
end
|
60
|
+
|
53
61
|
private
|
54
62
|
|
55
63
|
# Allow a given pattern access to a mount.
|
56
64
|
def allow(mount, value)
|
57
|
-
|
58
|
-
x = value.split(/\s*,\s*/).each { |val|
|
65
|
+
value.split(/\s*,\s*/).each { |val|
|
59
66
|
begin
|
60
67
|
mount.info "allowing #{val} access"
|
61
68
|
mount.allow(val)
|
62
69
|
rescue Puppet::AuthStoreError => detail
|
63
|
-
raise ArgumentError.new(detail.to_s, @count, file)
|
70
|
+
raise ArgumentError.new(detail.to_s, @count, @file)
|
64
71
|
end
|
65
72
|
}
|
66
73
|
end
|
67
74
|
|
68
75
|
# Deny a given pattern access to a mount.
|
69
76
|
def deny(mount, value)
|
70
|
-
|
71
|
-
x = value.split(/\s*,\s*/).each { |val|
|
77
|
+
value.split(/\s*,\s*/).each { |val|
|
72
78
|
begin
|
73
79
|
mount.info "denying #{val} access"
|
74
80
|
mount.deny(val)
|
75
81
|
rescue Puppet::AuthStoreError => detail
|
76
|
-
raise ArgumentError.new(detail.to_s, @count, file)
|
82
|
+
raise ArgumentError.new(detail.to_s, @count, @file)
|
77
83
|
end
|
78
84
|
}
|
79
85
|
end
|
80
86
|
|
81
87
|
# Create a new mount.
|
82
88
|
def newmount(name)
|
83
|
-
raise ArgumentError, "#{@mounts[name]} is already mounted at #{name}", @count, file if @mounts.include?(name)
|
89
|
+
raise ArgumentError, "#{@mounts[name]} is already mounted at #{name}", @count, @file if @mounts.include?(name)
|
84
90
|
case name
|
85
91
|
when "modules"
|
86
92
|
mount = Mount::Modules.new(name)
|
data/lib/puppet/forge.rb
CHANGED
@@ -89,38 +89,6 @@ class Puppet::Forge
|
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
|
-
def get_release_packages_from_repository(install_list)
|
93
|
-
install_list.map do |release|
|
94
|
-
modname, version, file = release
|
95
|
-
cache_path = nil
|
96
|
-
if file
|
97
|
-
begin
|
98
|
-
cache_path = repository.retrieve(file)
|
99
|
-
rescue OpenURI::HTTPError => e
|
100
|
-
raise HttpResponseError.new(:uri => uri.to_s, :input => modname, :message => e.message)
|
101
|
-
end
|
102
|
-
else
|
103
|
-
raise RuntimeError, "Malformed response from module repository."
|
104
|
-
end
|
105
|
-
cache_path
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
# Locate a module release package on the local filesystem and move it
|
110
|
-
# into the `Puppet.settings[:module_working_dir]`. Do not unpack it, just
|
111
|
-
# return the location of the package on disk.
|
112
|
-
def get_release_package_from_filesystem(filename)
|
113
|
-
if File.exist?(File.expand_path(filename))
|
114
|
-
repository = Repository.new('file:///')
|
115
|
-
uri = URI.parse("file://#{URI.escape(File.expand_path(filename))}")
|
116
|
-
cache_path = repository.retrieve(uri)
|
117
|
-
else
|
118
|
-
raise ArgumentError, "File does not exists: #{filename}"
|
119
|
-
end
|
120
|
-
|
121
|
-
cache_path
|
122
|
-
end
|
123
|
-
|
124
92
|
def retrieve(release)
|
125
93
|
repository.retrieve(release)
|
126
94
|
end
|
data/lib/puppet/forge/cache.rb
CHANGED
@@ -6,7 +6,7 @@ class Puppet::Forge
|
|
6
6
|
# Provides methods for reading files from local cache, filesystem or network.
|
7
7
|
class Cache
|
8
8
|
|
9
|
-
# Instantiate new
|
9
|
+
# Instantiate new cache for the +repository+ instance.
|
10
10
|
def initialize(repository, options = {})
|
11
11
|
@repository = repository
|
12
12
|
@options = options
|
data/lib/puppet/forge/errors.rb
CHANGED
@@ -30,7 +30,7 @@ module Puppet::Forge::Errors
|
|
30
30
|
#
|
31
31
|
# @return [String] the multiline version of the error message
|
32
32
|
def multiline
|
33
|
-
|
33
|
+
<<-EOS.chomp
|
34
34
|
Could not connect via HTTPS to #{@uri}
|
35
35
|
Unable to verify the SSL certificate
|
36
36
|
The certificate may not be signed by a valid CA
|
@@ -57,7 +57,7 @@ Could not connect via HTTPS to #{@uri}
|
|
57
57
|
#
|
58
58
|
# @return [String] the multiline version of the error message
|
59
59
|
def multiline
|
60
|
-
|
60
|
+
<<-EOS.chomp
|
61
61
|
Could not connect to #{@uri}
|
62
62
|
There was a network communications problem
|
63
63
|
The error we caught said '#{@detail}'
|
@@ -78,7 +78,7 @@ Could not connect to #{@uri}
|
|
78
78
|
@input = options[:input]
|
79
79
|
@message = options[:message]
|
80
80
|
response = options[:response]
|
81
|
-
@response = "#{response.code} #{response.message}"
|
81
|
+
@response = "#{response.code} #{response.message.strip}"
|
82
82
|
|
83
83
|
message = "Could not execute operation for '#{@input}'. Detail: "
|
84
84
|
message << @message << " / " if @message
|
@@ -2,6 +2,7 @@ require 'net/https'
|
|
2
2
|
require 'zlib'
|
3
3
|
require 'digest/sha1'
|
4
4
|
require 'uri'
|
5
|
+
require 'puppet/util/http_proxy'
|
5
6
|
require 'puppet/forge/errors'
|
6
7
|
|
7
8
|
class Puppet::Forge
|
@@ -37,45 +38,9 @@ class Puppet::Forge
|
|
37
38
|
@consumer_version = consumer_version
|
38
39
|
end
|
39
40
|
|
40
|
-
# Read HTTP proxy configurationm from Puppet's config file, or the
|
41
|
-
# http_proxy environment variable.
|
42
|
-
def http_proxy_env
|
43
|
-
proxy_env = ENV["http_proxy"] || ENV["HTTP_PROXY"] || nil
|
44
|
-
begin
|
45
|
-
return URI.parse(proxy_env) if proxy_env
|
46
|
-
rescue URI::InvalidURIError
|
47
|
-
return nil
|
48
|
-
end
|
49
|
-
return nil
|
50
|
-
end
|
51
|
-
|
52
|
-
def http_proxy_host
|
53
|
-
env = http_proxy_env
|
54
|
-
|
55
|
-
if env and env.host then
|
56
|
-
return env.host
|
57
|
-
end
|
58
|
-
|
59
|
-
if Puppet.settings[:http_proxy_host] == 'none'
|
60
|
-
return nil
|
61
|
-
end
|
62
|
-
|
63
|
-
return Puppet.settings[:http_proxy_host]
|
64
|
-
end
|
65
|
-
|
66
|
-
def http_proxy_port
|
67
|
-
env = http_proxy_env
|
68
|
-
|
69
|
-
if env and env.port then
|
70
|
-
return env.port
|
71
|
-
end
|
72
|
-
|
73
|
-
return Puppet.settings[:http_proxy_port]
|
74
|
-
end
|
75
|
-
|
76
41
|
# Return a Net::HTTPResponse read for this +request_path+.
|
77
42
|
def make_http_request(request_path)
|
78
|
-
request = Net::HTTP::Get.new(URI.escape(request_path), { "User-Agent" => user_agent })
|
43
|
+
request = Net::HTTP::Get.new(URI.escape(@uri.path + request_path), { "User-Agent" => user_agent })
|
79
44
|
if ! @uri.user.nil? && ! @uri.password.nil?
|
80
45
|
request.basic_auth(@uri.user, @uri.password)
|
81
46
|
end
|
@@ -115,7 +80,7 @@ class Puppet::Forge
|
|
115
80
|
#
|
116
81
|
# @return [Net::HTTP::Proxy] object constructed from repo settings
|
117
82
|
def get_http_object
|
118
|
-
proxy_class = Net::HTTP::Proxy(http_proxy_host, http_proxy_port)
|
83
|
+
proxy_class = Net::HTTP::Proxy(Puppet::Util::HttpProxy.http_proxy_host, Puppet::Util::HttpProxy.http_proxy_port)
|
119
84
|
proxy = proxy_class.new(@uri.host, @uri.port)
|
120
85
|
|
121
86
|
if @uri.scheme == 'https'
|
@@ -133,7 +98,9 @@ class Puppet::Forge
|
|
133
98
|
# Return the local file name containing the data downloaded from the
|
134
99
|
# repository at +release+ (e.g. "myuser-mymodule").
|
135
100
|
def retrieve(release)
|
136
|
-
|
101
|
+
uri = @uri.dup
|
102
|
+
uri.path = uri.path.chomp('/') + release
|
103
|
+
return cache.retrieve(uri)
|
137
104
|
end
|
138
105
|
|
139
106
|
# Return the URI string for this repository.
|
@@ -156,9 +123,7 @@ class Puppet::Forge
|
|
156
123
|
private :user_agent
|
157
124
|
|
158
125
|
def ruby_version
|
159
|
-
#
|
160
|
-
patch = defined?(RUBY_PATCHLEVEL) ? "-p#{RUBY_PATCHLEVEL}" : ""
|
161
|
-
"Ruby/#{RUBY_VERSION}#{patch} (#{RUBY_RELEASE_DATE}; #{RUBY_PLATFORM})"
|
126
|
+
"Ruby/#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} (#{RUBY_RELEASE_DATE}; #{RUBY_PLATFORM})"
|
162
127
|
end
|
163
128
|
private :ruby_version
|
164
129
|
end
|
data/lib/puppet/graph.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
module Puppet::Graph
|
2
|
+
require 'puppet/graph/prioritizer'
|
3
|
+
require 'puppet/graph/sequential_prioritizer'
|
4
|
+
require 'puppet/graph/title_hash_prioritizer'
|
5
|
+
require 'puppet/graph/random_prioritizer'
|
6
|
+
|
7
|
+
require 'puppet/graph/simple_graph'
|
8
|
+
require 'puppet/graph/rb_tree_map'
|
9
|
+
require 'puppet/graph/key'
|
10
|
+
require 'puppet/graph/relationship_graph'
|
11
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Sequential, nestable keys for tracking order of insertion in "the graph"
|
2
|
+
# @api private
|
3
|
+
class Puppet::Graph::Key
|
4
|
+
include Comparable
|
5
|
+
|
6
|
+
attr_reader :value
|
7
|
+
protected :value
|
8
|
+
|
9
|
+
def initialize(value = [0])
|
10
|
+
@value = value
|
11
|
+
end
|
12
|
+
|
13
|
+
def next
|
14
|
+
next_values = @value.clone
|
15
|
+
next_values[-1] += 1
|
16
|
+
Puppet::Graph::Key.new(next_values)
|
17
|
+
end
|
18
|
+
|
19
|
+
def down
|
20
|
+
Puppet::Graph::Key.new(@value + [0])
|
21
|
+
end
|
22
|
+
|
23
|
+
def <=>(other)
|
24
|
+
@value <=> other.value
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# Base, template method, class for Prioritizers. This provides the basic
|
2
|
+
# tracking facilities used.
|
3
|
+
#
|
4
|
+
# @api private
|
5
|
+
class Puppet::Graph::Prioritizer
|
6
|
+
def initialize
|
7
|
+
@priority = {}
|
8
|
+
end
|
9
|
+
|
10
|
+
def forget(key)
|
11
|
+
@priority.delete(key)
|
12
|
+
end
|
13
|
+
|
14
|
+
def record_priority_for(key, priority)
|
15
|
+
@priority[key] = priority
|
16
|
+
end
|
17
|
+
|
18
|
+
def generate_priority_for(key)
|
19
|
+
raise NotImplementedError
|
20
|
+
end
|
21
|
+
|
22
|
+
def generate_priority_contained_in(container, key)
|
23
|
+
raise NotImplementedError
|
24
|
+
end
|
25
|
+
|
26
|
+
def priority_of(key)
|
27
|
+
@priority[key]
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Assign a random priority to items.
|
2
|
+
#
|
3
|
+
# @api private
|
4
|
+
class Puppet::Graph::RandomPrioritizer < Puppet::Graph::Prioritizer
|
5
|
+
def generate_priority_for(key)
|
6
|
+
if priority_of(key).nil?
|
7
|
+
record_priority_for(key, SecureRandom.uuid)
|
8
|
+
else
|
9
|
+
priority_of(key)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def generate_priority_contained_in(container, key)
|
14
|
+
generate_priority_for(key)
|
15
|
+
end
|
16
|
+
end
|
@@ -30,7 +30,7 @@
|
|
30
30
|
#
|
31
31
|
# Most methods have O(log n) complexity.
|
32
32
|
|
33
|
-
class Puppet::RbTreeMap
|
33
|
+
class Puppet::Graph::RbTreeMap
|
34
34
|
include Enumerable
|
35
35
|
|
36
36
|
attr_reader :size
|
@@ -230,7 +230,7 @@ class Puppet::RbTreeMap
|
|
230
230
|
|
231
231
|
def rotate_left
|
232
232
|
r = @right
|
233
|
-
r_key, r_value
|
233
|
+
r_key, r_value = r.key, r.value
|
234
234
|
b = r.left
|
235
235
|
r.left = @left
|
236
236
|
@left = r
|
@@ -243,7 +243,7 @@ class Puppet::RbTreeMap
|
|
243
243
|
|
244
244
|
def rotate_right
|
245
245
|
l = @left
|
246
|
-
l_key, l_value
|
246
|
+
l_key, l_value = l.key, l.value
|
247
247
|
b = l.right
|
248
248
|
l.right = @right
|
249
249
|
@right = l
|
@@ -0,0 +1,246 @@
|
|
1
|
+
# The relationship graph is the final form of a puppet catalog in
|
2
|
+
# which all dependency edges are explicitly in the graph. This form of the
|
3
|
+
# catalog is used to traverse the graph in the order in which resources are
|
4
|
+
# managed.
|
5
|
+
#
|
6
|
+
# @api private
|
7
|
+
class Puppet::Graph::RelationshipGraph < Puppet::Graph::SimpleGraph
|
8
|
+
attr_reader :blockers
|
9
|
+
|
10
|
+
def initialize(prioritizer)
|
11
|
+
super()
|
12
|
+
|
13
|
+
@prioritizer = prioritizer
|
14
|
+
|
15
|
+
@ready = Puppet::Graph::RbTreeMap.new
|
16
|
+
@generated = {}
|
17
|
+
@done = {}
|
18
|
+
@blockers = {}
|
19
|
+
@providerless_types = []
|
20
|
+
end
|
21
|
+
|
22
|
+
def populate_from(catalog)
|
23
|
+
add_all_resources_as_vertices(catalog)
|
24
|
+
build_manual_dependencies
|
25
|
+
build_autorequire_dependencies(catalog)
|
26
|
+
|
27
|
+
write_graph(:relationships) if catalog.host_config?
|
28
|
+
|
29
|
+
replace_containers_with_anchors(catalog)
|
30
|
+
|
31
|
+
write_graph(:expanded_relationships) if catalog.host_config?
|
32
|
+
end
|
33
|
+
|
34
|
+
def add_vertex(vertex, priority = nil)
|
35
|
+
super(vertex)
|
36
|
+
|
37
|
+
if priority
|
38
|
+
@prioritizer.record_priority_for(vertex, priority)
|
39
|
+
else
|
40
|
+
@prioritizer.generate_priority_for(vertex)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def add_relationship(f, t, label=nil)
|
45
|
+
super(f, t, label)
|
46
|
+
@ready.delete(@prioritizer.priority_of(t))
|
47
|
+
end
|
48
|
+
|
49
|
+
def remove_vertex!(vertex)
|
50
|
+
super
|
51
|
+
@prioritizer.forget(vertex)
|
52
|
+
end
|
53
|
+
|
54
|
+
def resource_priority(resource)
|
55
|
+
@prioritizer.priority_of(resource)
|
56
|
+
end
|
57
|
+
|
58
|
+
# Enqueue the initial set of resources, those with no dependencies.
|
59
|
+
def enqueue_roots
|
60
|
+
vertices.each do |v|
|
61
|
+
@blockers[v] = direct_dependencies_of(v).length
|
62
|
+
enqueue(v) if @blockers[v] == 0
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# Decrement the blocker count for the resource by 1. If the number of
|
67
|
+
# blockers is unknown, count them and THEN decrement by 1.
|
68
|
+
def unblock(resource)
|
69
|
+
@blockers[resource] ||= direct_dependencies_of(resource).select { |r2| !@done[r2] }.length
|
70
|
+
if @blockers[resource] > 0
|
71
|
+
@blockers[resource] -= 1
|
72
|
+
else
|
73
|
+
resource.warning "appears to have a negative number of dependencies"
|
74
|
+
end
|
75
|
+
@blockers[resource] <= 0
|
76
|
+
end
|
77
|
+
|
78
|
+
def clear_blockers
|
79
|
+
@blockers.clear
|
80
|
+
end
|
81
|
+
|
82
|
+
def enqueue(*resources)
|
83
|
+
resources.each do |resource|
|
84
|
+
@ready[@prioritizer.priority_of(resource)] = resource
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def finish(resource)
|
89
|
+
direct_dependents_of(resource).each do |v|
|
90
|
+
enqueue(v) if unblock(v)
|
91
|
+
end
|
92
|
+
@done[resource] = true
|
93
|
+
end
|
94
|
+
|
95
|
+
def next_resource
|
96
|
+
@ready.delete_min
|
97
|
+
end
|
98
|
+
|
99
|
+
def traverse(options = {}, &block)
|
100
|
+
continue_while = options[:while] || lambda { true }
|
101
|
+
pre_process = options[:pre_process] || lambda { |resource| }
|
102
|
+
overly_deferred_resource_handler = options[:overly_deferred_resource_handler] || lambda { |resource| }
|
103
|
+
canceled_resource_handler = options[:canceled_resource_handler] || lambda { |resource| }
|
104
|
+
teardown = options[:teardown] || lambda {}
|
105
|
+
|
106
|
+
report_cycles_in_graph
|
107
|
+
|
108
|
+
enqueue_roots
|
109
|
+
|
110
|
+
deferred_resources = []
|
111
|
+
|
112
|
+
while continue_while.call() && (resource = next_resource)
|
113
|
+
if resource.suitable?
|
114
|
+
made_progress = true
|
115
|
+
|
116
|
+
pre_process.call(resource)
|
117
|
+
|
118
|
+
yield resource
|
119
|
+
|
120
|
+
finish(resource)
|
121
|
+
else
|
122
|
+
deferred_resources << resource
|
123
|
+
end
|
124
|
+
|
125
|
+
if @ready.empty? and deferred_resources.any?
|
126
|
+
if made_progress
|
127
|
+
enqueue(*deferred_resources)
|
128
|
+
else
|
129
|
+
deferred_resources.each do |resource|
|
130
|
+
overly_deferred_resource_handler.call(resource)
|
131
|
+
finish(resource)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
made_progress = false
|
136
|
+
deferred_resources = []
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
if !continue_while.call()
|
141
|
+
while (resource = next_resource)
|
142
|
+
canceled_resource_handler.call(resource)
|
143
|
+
finish(resource)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
teardown.call()
|
148
|
+
end
|
149
|
+
|
150
|
+
private
|
151
|
+
|
152
|
+
def add_all_resources_as_vertices(catalog)
|
153
|
+
catalog.resources.each do |vertex|
|
154
|
+
add_vertex(vertex)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
def build_manual_dependencies
|
159
|
+
vertices.each do |vertex|
|
160
|
+
vertex.builddepends.each do |edge|
|
161
|
+
add_edge(edge)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
def build_autorequire_dependencies(catalog)
|
167
|
+
vertices.each do |vertex|
|
168
|
+
vertex.autorequire(catalog).each do |edge|
|
169
|
+
# don't let automatic relationships conflict with manual ones.
|
170
|
+
next if edge?(edge.source, edge.target)
|
171
|
+
|
172
|
+
if edge?(edge.target, edge.source)
|
173
|
+
vertex.debug "Skipping automatic relationship with #{edge.source}"
|
174
|
+
else
|
175
|
+
vertex.debug "Autorequiring #{edge.source}"
|
176
|
+
add_edge(edge)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
# Impose our container information on another graph by using it
|
183
|
+
# to replace any container vertices X with a pair of verticies
|
184
|
+
# { admissible_X and completed_X } such that that
|
185
|
+
#
|
186
|
+
# 0) completed_X depends on admissible_X
|
187
|
+
# 1) contents of X each depend on admissible_X
|
188
|
+
# 2) completed_X depends on each on the contents of X
|
189
|
+
# 3) everything which depended on X depens on completed_X
|
190
|
+
# 4) admissible_X depends on everything X depended on
|
191
|
+
# 5) the containers and their edges must be removed
|
192
|
+
#
|
193
|
+
# Note that this requires attention to the possible case of containers
|
194
|
+
# which contain or depend on other containers, but has the advantage
|
195
|
+
# that the number of new edges created scales linearly with the number
|
196
|
+
# of contained verticies regardless of how containers are related;
|
197
|
+
# alternatives such as replacing container-edges with content-edges
|
198
|
+
# scale as the product of the number of external dependences, which is
|
199
|
+
# to say geometrically in the case of nested / chained containers.
|
200
|
+
#
|
201
|
+
Default_label = { :callback => :refresh, :event => :ALL_EVENTS }
|
202
|
+
def replace_containers_with_anchors(catalog)
|
203
|
+
stage_class = Puppet::Type.type(:stage)
|
204
|
+
whit_class = Puppet::Type.type(:whit)
|
205
|
+
component_class = Puppet::Type.type(:component)
|
206
|
+
containers = catalog.resources.find_all { |v| (v.is_a?(component_class) or v.is_a?(stage_class)) and vertex?(v) }
|
207
|
+
#
|
208
|
+
# These two hashes comprise the aforementioned attention to the possible
|
209
|
+
# case of containers that contain / depend on other containers; they map
|
210
|
+
# containers to their sentinels but pass other verticies through. Thus we
|
211
|
+
# can "do the right thing" for references to other verticies that may or
|
212
|
+
# may not be containers.
|
213
|
+
#
|
214
|
+
admissible = Hash.new { |h,k| k }
|
215
|
+
completed = Hash.new { |h,k| k }
|
216
|
+
containers.each { |x|
|
217
|
+
admissible[x] = whit_class.new(:name => "admissible_#{x.ref}", :catalog => catalog)
|
218
|
+
completed[x] = whit_class.new(:name => "completed_#{x.ref}", :catalog => catalog)
|
219
|
+
priority = @prioritizer.priority_of(x)
|
220
|
+
add_vertex(admissible[x], priority)
|
221
|
+
add_vertex(completed[x], priority)
|
222
|
+
}
|
223
|
+
#
|
224
|
+
# Implement the six requirements listed above
|
225
|
+
#
|
226
|
+
containers.each { |x|
|
227
|
+
contents = catalog.adjacent(x, :direction => :out)
|
228
|
+
add_edge(admissible[x],completed[x]) if contents.empty? # (0)
|
229
|
+
contents.each { |v|
|
230
|
+
add_edge(admissible[x],admissible[v],Default_label) # (1)
|
231
|
+
add_edge(completed[v], completed[x], Default_label) # (2)
|
232
|
+
}
|
233
|
+
# (3) & (5)
|
234
|
+
adjacent(x,:direction => :in,:type => :edges).each { |e|
|
235
|
+
add_edge(completed[e.source],admissible[x],e.label)
|
236
|
+
remove_edge! e
|
237
|
+
}
|
238
|
+
# (4) & (5)
|
239
|
+
adjacent(x,:direction => :out,:type => :edges).each { |e|
|
240
|
+
add_edge(completed[x],admissible[e.target],e.label)
|
241
|
+
remove_edge! e
|
242
|
+
}
|
243
|
+
}
|
244
|
+
containers.each { |x| remove_vertex! x } # (5)
|
245
|
+
end
|
246
|
+
end
|