puppet 3.2.4 → 3.3.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/COMMITTERS.md +101 -42
- data/Gemfile +15 -4
- data/README.md +5 -1
- data/README_DEVELOPER.md +117 -54
- data/Rakefile +4 -0
- data/ext/build_defaults.yaml +3 -2
- data/ext/debian/puppet-common.manpages +33 -1
- data/ext/gentoo/init.d/puppet +1 -1
- data/ext/gentoo/init.d/puppetmaster +1 -1
- data/ext/redhat/puppet.spec.erb +0 -1
- data/install.rb +2 -1
- data/lib/hiera/backend/puppet_backend.rb +1 -1
- data/lib/puppet/application.rb +10 -9
- data/lib/puppet/application/agent.rb +87 -93
- data/lib/puppet/application/apply.rb +0 -2
- data/lib/puppet/application/device.rb +3 -3
- data/lib/puppet/application/kick.rb +2 -2
- data/lib/puppet/application/master.rb +41 -19
- data/lib/puppet/application/queue.rb +5 -3
- data/lib/puppet/bindings.rb +147 -0
- data/lib/puppet/configurer.rb +25 -15
- data/lib/puppet/configurer/fact_handler.rb +2 -9
- data/lib/puppet/daemon.rb +44 -33
- data/lib/puppet/defaults.rb +57 -26
- data/lib/puppet/error.rb +1 -1
- data/lib/puppet/external/dot.rb +2 -2
- data/lib/puppet/external/nagios/base.rb +1 -6
- data/lib/puppet/external/pson/common.rb +2 -2
- data/lib/puppet/external/pson/pure/generator.rb +2 -2
- data/lib/puppet/external/pson/pure/parser.rb +1 -1
- data/lib/puppet/face/ca.rb +1 -1
- data/lib/puppet/face/config.rb +1 -1
- data/lib/puppet/face/help.rb +2 -2
- data/lib/puppet/face/module/list.rb +2 -2
- data/lib/puppet/feature/rails.rb +1 -1
- data/lib/puppet/file_bucket/dipper.rb +0 -1
- data/lib/puppet/file_serving/base.rb +1 -1
- data/lib/puppet/file_serving/configuration/parser.rb +20 -14
- data/lib/puppet/forge.rb +0 -32
- data/lib/puppet/forge/cache.rb +1 -1
- data/lib/puppet/forge/errors.rb +3 -3
- data/lib/puppet/forge/repository.rb +7 -42
- data/lib/puppet/graph.rb +11 -0
- data/lib/puppet/graph/key.rb +26 -0
- data/lib/puppet/graph/prioritizer.rb +29 -0
- data/lib/puppet/graph/random_prioritizer.rb +16 -0
- data/lib/puppet/{rb_tree_map.rb → graph/rb_tree_map.rb} +3 -3
- data/lib/puppet/graph/relationship_graph.rb +246 -0
- data/lib/puppet/graph/sequential_prioritizer.rb +31 -0
- data/lib/puppet/{simple_graph.rb → graph/simple_graph.rb} +22 -3
- data/lib/puppet/graph/title_hash_prioritizer.rb +16 -0
- data/lib/puppet/indirector.rb +2 -2
- data/lib/puppet/indirector/catalog/compiler.rb +10 -7
- data/lib/puppet/indirector/catalog/static_compiler.rb +50 -0
- data/lib/puppet/indirector/certificate/rest.rb +1 -1
- data/lib/puppet/indirector/exec.rb +1 -1
- data/lib/puppet/indirector/facts/facter.rb +2 -2
- data/lib/puppet/indirector/facts/inventory_active_record.rb +0 -1
- data/lib/puppet/indirector/facts/network_device.rb +1 -1
- data/lib/puppet/indirector/file_bucket_file/file.rb +0 -1
- data/lib/puppet/indirector/indirection.rb +2 -2
- data/lib/puppet/indirector/memory.rb +9 -0
- data/lib/puppet/indirector/node/ldap.rb +2 -4
- data/lib/puppet/indirector/report/processor.rb +1 -2
- data/lib/puppet/indirector/report/rest.rb +1 -1
- data/lib/puppet/indirector/request.rb +32 -10
- data/lib/puppet/indirector/resource/rest.rb +1 -1
- data/lib/puppet/indirector/resource_type/parser.rb +31 -12
- data/lib/puppet/interface.rb +1 -1
- data/lib/puppet/interface/documentation.rb +7 -11
- data/lib/puppet/interface/option.rb +1 -1
- data/lib/puppet/interface/option_builder.rb +1 -1
- data/lib/puppet/metatype/manager.rb +2 -2
- data/lib/puppet/module.rb +7 -1
- data/lib/puppet/module_tool.rb +1 -1
- data/lib/puppet/module_tool/applications/application.rb +10 -0
- data/lib/puppet/module_tool/applications/installer.rb +6 -3
- data/lib/puppet/module_tool/dependency.rb +2 -0
- data/lib/puppet/module_tool/errors/upgrader.rb +1 -1
- data/lib/puppet/module_tool/metadata.rb +25 -13
- data/lib/puppet/module_tool/modulefile.rb +7 -7
- data/lib/puppet/module_tool/shared_behaviors.rb +4 -2
- data/lib/puppet/module_tool/skeleton.rb +1 -1
- data/lib/puppet/module_tool/skeleton/templates/generator/manifests/init.pp.erb +5 -5
- data/lib/puppet/module_tool/skeleton/templates/generator/tests/init.pp.erb +5 -4
- data/lib/puppet/network/auth_config_parser.rb +3 -0
- data/lib/puppet/network/authconfig.rb +0 -1
- data/lib/puppet/network/authorization.rb +1 -1
- data/lib/puppet/network/authstore.rb +2 -2
- data/lib/puppet/network/format_handler.rb +25 -114
- data/lib/puppet/network/format_support.rb +106 -0
- data/lib/puppet/network/formats.rb +10 -4
- data/lib/puppet/network/http/compression.rb +1 -1
- data/lib/puppet/network/http/connection.rb +76 -32
- data/lib/puppet/network/http/handler.rb +122 -61
- data/lib/puppet/network/http/rack/rest.rb +1 -1
- data/lib/puppet/network/http/webrick/rest.rb +9 -3
- data/lib/puppet/network/http_pool.rb +2 -2
- data/lib/puppet/network/resolver.rb +1 -0
- data/lib/puppet/network/server.rb +5 -81
- data/lib/puppet/node/environment.rb +256 -13
- data/lib/puppet/node/facts.rb +28 -2
- data/lib/puppet/parameter.rb +27 -18
- data/lib/puppet/parameter/boolean.rb +20 -0
- data/lib/puppet/parameter/path.rb +1 -1
- data/lib/puppet/parameter/value.rb +1 -1
- data/lib/puppet/parameter/value_collection.rb +1 -1
- data/lib/puppet/parser/ast/arithmetic_operator.rb +8 -0
- data/lib/puppet/parser/ast/casestatement.rb +0 -3
- data/lib/puppet/parser/ast/lambda.rb +25 -6
- data/lib/puppet/parser/ast/leaf.rb +10 -3
- data/lib/puppet/parser/ast/nop.rb +1 -1
- data/lib/puppet/parser/ast/resource_override.rb +0 -2
- data/lib/puppet/parser/compiler.rb +92 -34
- data/lib/puppet/parser/files.rb +0 -5
- data/lib/puppet/parser/functions/create_resources.rb +23 -46
- data/lib/puppet/parser/functions/each.rb +0 -2
- data/lib/puppet/parser/functions/extlookup.rb +2 -2
- data/lib/puppet/parser/functions/foreach.rb +0 -2
- data/lib/puppet/parser/functions/hiera_include.rb +1 -1
- data/lib/puppet/parser/functions/lookup.rb +44 -0
- data/lib/puppet/parser/functions/slice.rb +1 -1
- data/lib/puppet/parser/grammar.ra +0 -1
- data/lib/puppet/parser/lexer.rb +0 -1
- data/lib/puppet/parser/parser.rb +0 -1
- data/lib/puppet/parser/parser_factory.rb +3 -2
- data/lib/puppet/parser/parser_support.rb +1 -1
- data/lib/puppet/parser/relationship.rb +1 -1
- data/lib/puppet/parser/scope.rb +49 -24
- data/lib/puppet/parser/type_loader.rb +13 -18
- data/lib/puppet/pops.rb +45 -0
- data/lib/puppet/pops/adaptable.rb +2 -2
- data/lib/puppet/pops/adapters.rb +4 -0
- data/lib/puppet/pops/binder/binder.rb +421 -0
- data/lib/puppet/pops/binder/binder_issues.rb +142 -0
- data/lib/puppet/pops/binder/bindings_checker.rb +217 -0
- data/lib/puppet/pops/binder/bindings_composer.rb +241 -0
- data/lib/puppet/pops/binder/bindings_factory.rb +847 -0
- data/lib/puppet/pops/binder/bindings_label_provider.rb +46 -0
- data/lib/puppet/pops/binder/bindings_loader.rb +79 -0
- data/lib/puppet/pops/binder/bindings_model.rb +215 -0
- data/lib/puppet/pops/binder/bindings_model_dumper.rb +205 -0
- data/lib/puppet/pops/binder/bindings_validator_factory.rb +28 -0
- data/lib/puppet/pops/binder/config/binder_config.rb +139 -0
- data/lib/puppet/pops/binder/config/binder_config_checker.rb +183 -0
- data/lib/puppet/pops/binder/config/diagnostic_producer.rb +32 -0
- data/lib/puppet/pops/binder/config/issues.rb +106 -0
- data/lib/puppet/pops/binder/hiera2.rb +10 -0
- data/lib/puppet/pops/binder/hiera2/bindings_provider.rb +148 -0
- data/lib/puppet/pops/binder/hiera2/config.rb +69 -0
- data/lib/puppet/pops/binder/hiera2/config_checker.rb +68 -0
- data/lib/puppet/pops/binder/hiera2/diagnostic_producer.rb +36 -0
- data/lib/puppet/pops/binder/hiera2/issues.rb +67 -0
- data/lib/puppet/pops/binder/hiera2/json_backend.rb +18 -0
- data/lib/puppet/pops/binder/hiera2/yaml_backend.rb +21 -0
- data/lib/puppet/pops/binder/injector.rb +688 -0
- data/lib/puppet/pops/binder/injector_entry.rb +53 -0
- data/lib/puppet/pops/binder/key_factory.rb +61 -0
- data/lib/puppet/pops/binder/producers.rb +829 -0
- data/lib/puppet/pops/binder/scheme_handler/confdir_hiera_scheme.rb +67 -0
- data/lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb +34 -0
- data/lib/puppet/pops/binder/scheme_handler/module_hiera_scheme.rb +92 -0
- data/lib/puppet/pops/binder/scheme_handler/module_scheme.rb +84 -0
- data/lib/puppet/pops/binder/scheme_handler/symbolic_scheme.rb +54 -0
- data/lib/puppet/pops/binder/system_bindings.rb +72 -0
- data/lib/puppet/pops/issue_reporter.rb +75 -0
- data/lib/puppet/pops/issues.rb +9 -5
- data/lib/puppet/pops/model/ast_transformer.rb +4 -4
- data/lib/puppet/pops/model/ast_tree_dumper.rb +1 -1
- data/lib/puppet/pops/model/factory.rb +25 -13
- data/lib/puppet/pops/model/model.rb +1 -1
- data/lib/puppet/pops/model/tree_dumper.rb +2 -2
- data/lib/puppet/pops/parser/egrammar.ra +0 -1
- data/lib/puppet/pops/parser/eparser.rb +1 -2
- data/lib/puppet/pops/parser/evaluating_parser.rb +162 -0
- data/lib/puppet/pops/parser/lexer.rb +8 -6
- data/lib/puppet/pops/types/class_loader.rb +118 -0
- data/lib/puppet/pops/types/type_calculator.rb +557 -0
- data/lib/puppet/pops/types/type_factory.rb +147 -0
- data/lib/puppet/pops/types/type_parser.rb +117 -0
- data/lib/puppet/pops/types/types.rb +132 -0
- data/lib/puppet/pops/validation.rb +146 -17
- data/lib/puppet/pops/validation/checker3_1.rb +1 -1
- data/lib/puppet/pops/validation/validator_factory_3_1.rb +6 -16
- data/lib/puppet/property.rb +3 -3
- data/lib/puppet/property/keyvalue.rb +1 -1
- data/lib/puppet/provider.rb +2 -2
- data/lib/puppet/provider/aixobject.rb +19 -21
- data/lib/puppet/provider/augeas/augeas.rb +3 -1
- data/lib/puppet/provider/command.rb +2 -2
- data/lib/puppet/provider/group/aix.rb +1 -1
- data/lib/puppet/provider/group/ldap.rb +1 -1
- data/lib/puppet/provider/macauthorization/macauthorization.rb +1 -1
- data/lib/puppet/provider/mailalias/aliases.rb +3 -8
- data/lib/puppet/provider/mcx/mcxcontent.rb +7 -1
- data/lib/puppet/provider/mount.rb +8 -3
- data/lib/puppet/provider/nameservice.rb +1 -1
- data/lib/puppet/provider/nameservice/directoryservice.rb +5 -5
- data/lib/puppet/provider/package/appdmg.rb +1 -1
- data/lib/puppet/provider/package/apt.rb +0 -1
- data/lib/puppet/provider/package/dpkg.rb +86 -32
- data/lib/puppet/provider/package/fink.rb +0 -2
- data/lib/puppet/provider/package/freebsd.rb +0 -2
- data/lib/puppet/provider/package/openbsd.rb +57 -10
- data/lib/puppet/provider/package/opkg.rb +0 -1
- data/lib/puppet/provider/package/pacman.rb +0 -1
- data/lib/puppet/provider/package/pip.rb +1 -1
- data/lib/puppet/provider/package/pkgdmg.rb +17 -6
- data/lib/puppet/provider/package/pkgutil.rb +1 -1
- data/lib/puppet/provider/package/portage.rb +9 -1
- data/lib/puppet/provider/package/ports.rb +2 -2
- data/lib/puppet/provider/package/rpm.rb +29 -12
- data/lib/puppet/provider/package/rug.rb +1 -1
- data/lib/puppet/provider/package/urpmi.rb +11 -15
- data/lib/puppet/provider/package/windows/exe_package.rb +1 -1
- data/lib/puppet/provider/package/windows/package.rb +1 -26
- data/lib/puppet/provider/package/yum.rb +1 -1
- data/lib/puppet/provider/package/zypper.rb +22 -3
- data/lib/puppet/provider/parsedfile.rb +1 -12
- data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +1 -1
- data/lib/puppet/provider/service/base.rb +1 -1
- data/lib/puppet/provider/service/daemontools.rb +3 -3
- data/lib/puppet/provider/service/debian.rb +1 -1
- data/lib/puppet/provider/service/init.rb +14 -20
- data/lib/puppet/provider/service/openrc.rb +3 -1
- data/lib/puppet/provider/service/redhat.rb +5 -8
- data/lib/puppet/provider/service/runit.rb +3 -2
- data/lib/puppet/provider/service/systemd.rb +1 -1
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +1 -1
- data/lib/puppet/provider/sshkey/parsed.rb +0 -2
- data/lib/puppet/provider/user/aix.rb +25 -12
- data/lib/puppet/provider/user/directoryservice.rb +4 -7
- data/lib/puppet/provider/user/ldap.rb +0 -1
- data/lib/puppet/provider/user/user_role_add.rb +2 -0
- data/lib/puppet/provider/user/useradd.rb +1 -1
- data/lib/puppet/provider/zone/solaris.rb +1 -2
- data/lib/puppet/reference/metaparameter.rb +1 -1
- data/lib/puppet/reference/type.rb +1 -1
- data/lib/puppet/reports/rrdgraph.rb +1 -1
- data/lib/puppet/reports/tagmail.rb +1 -1
- data/lib/puppet/resource.rb +16 -4
- data/lib/puppet/resource/catalog.rb +111 -173
- data/lib/puppet/resource/status.rb +42 -3
- data/lib/puppet/resource/type.rb +33 -46
- data/lib/puppet/resource/type_collection.rb +19 -15
- data/lib/puppet/run.rb +5 -1
- data/lib/puppet/scheduler/scheduler.rb +14 -15
- data/lib/puppet/settings.rb +78 -41
- data/lib/puppet/settings/boolean_setting.rb +0 -2
- data/lib/puppet/settings/config_file.rb +0 -2
- data/lib/puppet/settings/directory_setting.rb +0 -2
- data/lib/puppet/settings/duration_setting.rb +0 -2
- data/lib/puppet/settings/enum_setting.rb +16 -0
- data/lib/puppet/settings/file_setting.rb +0 -2
- data/lib/puppet/settings/path_setting.rb +0 -2
- data/lib/puppet/settings/string_setting.rb +0 -3
- data/lib/puppet/settings/terminus_setting.rb +0 -2
- data/lib/puppet/ssl/certificate_authority.rb +102 -9
- data/lib/puppet/test/test_helper.rb +1 -0
- data/lib/puppet/transaction.rb +130 -292
- data/lib/puppet/transaction/additional_resource_generator.rb +126 -0
- data/lib/puppet/transaction/event.rb +16 -1
- data/lib/puppet/transaction/report.rb +34 -14
- data/lib/puppet/transaction/resource_harness.rb +16 -19
- data/lib/puppet/type.rb +59 -53
- data/lib/puppet/type/component.rb +0 -2
- data/lib/puppet/type/cron.rb +13 -2
- data/lib/puppet/type/exec.rb +5 -7
- data/lib/puppet/type/file.rb +9 -32
- data/lib/puppet/type/file/content.rb +4 -1
- data/lib/puppet/type/file/ctime.rb +3 -1
- data/lib/puppet/type/file/ensure.rb +1 -1
- data/lib/puppet/type/file/mode.rb +0 -1
- data/lib/puppet/type/file/mtime.rb +2 -1
- data/lib/puppet/type/group.rb +7 -9
- data/lib/puppet/type/host.rb +1 -2
- data/lib/puppet/type/mcx.rb +0 -1
- data/lib/puppet/type/mount.rb +38 -6
- data/lib/puppet/type/package.rb +2 -2
- data/lib/puppet/type/resources.rb +5 -4
- data/lib/puppet/type/schedule.rb +1 -4
- data/lib/puppet/type/selmodule.rb +1 -1
- data/lib/puppet/type/service.rb +1 -3
- data/lib/puppet/type/tidy.rb +3 -3
- data/lib/puppet/type/user.rb +9 -13
- data/lib/puppet/type/yumrepo.rb +11 -7
- data/lib/puppet/util.rb +14 -7
- data/lib/puppet/util/autoload.rb +0 -1
- data/lib/puppet/util/backups.rb +1 -3
- data/lib/puppet/util/classgen.rb +1 -1
- data/lib/puppet/util/command_line/puppet_option_parser.rb +1 -3
- data/lib/puppet/util/command_line/trollop.rb +1 -1
- data/lib/puppet/util/constant_inflector.rb +1 -2
- data/lib/puppet/util/errors.rb +1 -0
- data/lib/puppet/util/file_watcher.rb +28 -0
- data/lib/puppet/util/fileparsing.rb +1 -3
- data/lib/puppet/util/filetype.rb +0 -1
- data/lib/puppet/util/http_proxy.rb +38 -0
- data/lib/puppet/util/ldap/manager.rb +1 -2
- data/lib/puppet/util/log.rb +31 -10
- data/lib/puppet/util/log/destinations.rb +0 -50
- data/lib/puppet/util/metric.rb +8 -1
- data/lib/puppet/util/monkey_patches.rb +14 -148
- data/lib/puppet/util/network_device/cisco/facts.rb +1 -1
- data/lib/puppet/util/network_device/config.rb +6 -9
- data/lib/puppet/util/network_device/transport/ssh.rb +1 -1
- data/lib/puppet/util/pidlock.rb +3 -0
- data/lib/puppet/util/posix.rb +1 -1
- data/lib/puppet/util/profiler.rb +1 -1
- data/lib/puppet/util/rdoc.rb +1 -1
- data/lib/puppet/util/rdoc/generators/puppet_generator.rb +0 -1
- data/lib/puppet/util/rdoc/generators/template/puppet/puppet.rb +50 -42
- data/lib/puppet/util/retryaction.rb +0 -1
- data/lib/puppet/util/symbolic_file_mode.rb +5 -1
- data/lib/puppet/util/tagging.rb +0 -2
- data/lib/puppet/util/warnings.rb +3 -0
- data/lib/puppet/util/watched_file.rb +37 -0
- data/lib/puppet/util/watcher.rb +17 -0
- data/lib/puppet/util/watcher/change_watcher.rb +33 -0
- data/lib/puppet/util/watcher/periodic_watcher.rb +37 -0
- data/lib/puppet/util/watcher/timer.rb +19 -0
- data/lib/puppet/util/windows/user.rb +1 -1
- data/lib/puppet/version.rb +1 -1
- data/lib/puppetx.rb +109 -0
- data/lib/puppetx/puppet/bindings_scheme_handler.rb +130 -0
- data/lib/puppetx/puppet/hiera2_backend.rb +31 -0
- data/lib/puppetx/puppet/syntax_checker.rb +91 -0
- data/lib/puppetx/puppetlabs/syntax_checkers/json.rb +39 -0
- data/lib/semver.rb +1 -1
- data/man/man8/puppet-kick.8 +1 -1
- data/spec/fixtures/integration/provider/cron/crontab/unspecialized +15 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/hiera1config/binder_config.yaml +18 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/hiera1config/hiera.yaml +8 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/hiera1config/modules/good/common.yaml +1 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/hiera1config/modules/good/hiera.yaml +10 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/binder_config.yaml +19 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/common.yaml +1 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/hiera.yaml +11 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/localhost.yaml +1 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/common.yaml +3 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/hiera.yaml +13 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/lib/puppet/bindings/awesome/default.rb +4 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/lib/puppetx/awesome/echo_backend.rb +11 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/lib/puppetx/awesome/echo_scheme_handler.rb +18 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/localhost.yaml +1 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/bad/common.yaml +3 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/bad/hiera_config.yaml +9 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/good/common.yaml +2 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/good/hiera.yaml +11 -0
- data/spec/fixtures/unit/pops/binder/config/binder_config/ok/binder_config.yaml +9 -0
- data/spec/fixtures/unit/pops/binder/hiera2/bindings_provider/ok/hiera.yaml +9 -0
- data/spec/fixtures/unit/pops/binder/hiera2/bindings_provider/ok/node.example.com.json +9 -0
- data/spec/fixtures/unit/pops/binder/hiera2/bindings_provider/ok/node.example.com.yaml +5 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/bad_syntax/hiera.yaml +10 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/malformed_hierarchy/hiera.yaml +8 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/missing/foo.txt +1 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/no_backends/hiera.yaml +7 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/no_hierarchy/hiera.yaml +4 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/not_a_hash/hiera.yaml +2 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/ok/hiera.yaml +8 -0
- data/spec/fixtures/unit/pops/binder/hiera2/yaml_backend/empty/common.yaml +0 -0
- data/spec/fixtures/unit/pops/binder/hiera2/yaml_backend/invalid/common.yaml +1 -0
- data/spec/fixtures/unit/pops/binder/hiera2/yaml_backend/ok/common.yaml +2 -0
- data/spec/fixtures/unit/provider/package/openbsd/pkginfo_flavors.list +2 -0
- data/spec/integration/agent/logging_spec.rb +178 -0
- data/spec/integration/configurer_spec.rb +1 -1
- data/spec/integration/defaults_spec.rb +0 -6
- data/spec/integration/network/authconfig_spec.rb +19 -0
- data/spec/integration/network/server/webrick_spec.rb +10 -11
- data/spec/integration/parser/catalog_spec.rb +85 -0
- data/spec/integration/provider/cron/crontab_spec.rb +11 -0
- data/spec/integration/provider/mount_spec.rb +1 -0
- data/spec/integration/transaction_spec.rb +8 -8
- data/spec/integration/type/file_spec.rb +1 -1
- data/spec/integration/util/settings_spec.rb +58 -11
- data/spec/lib/matchers/include_in_order.rb +21 -0
- data/spec/lib/matchers/include_in_order_spec.rb +30 -0
- data/spec/lib/matchers/relationship_graph_matchers.rb +48 -0
- data/spec/lib/puppet_spec/compiler.rb +24 -0
- data/spec/lib/puppet_spec/pops.rb +16 -0
- data/spec/spec_helper.rb +0 -1
- data/spec/unit/application/agent_spec.rb +145 -145
- data/spec/unit/application/apply_spec.rb +1 -1
- data/spec/unit/application/doc_spec.rb +1 -1
- data/spec/unit/application/face_base_spec.rb +3 -3
- data/spec/unit/application/facts_spec.rb +1 -0
- data/spec/unit/application/master_spec.rb +0 -15
- data/spec/unit/application/queue_spec.rb +6 -12
- data/spec/unit/application/resource_spec.rb +1 -1
- data/spec/unit/configurer/fact_handler_spec.rb +19 -50
- data/spec/unit/configurer_spec.rb +23 -7
- data/spec/unit/daemon_spec.rb +97 -121
- data/spec/unit/defaults_spec.rb +44 -0
- data/spec/unit/face/node_spec.rb +2 -2
- data/spec/unit/file_serving/configuration/parser_spec.rb +23 -33
- data/spec/unit/file_serving/configuration_spec.rb +2 -2
- data/spec/unit/file_serving/mount/file_spec.rb +4 -4
- data/spec/unit/forge/repository_spec.rb +9 -29
- data/spec/unit/graph/key_spec.rb +41 -0
- data/spec/unit/{rb_tree_map_spec.rb → graph/rb_tree_map_spec.rb} +7 -7
- data/spec/unit/graph/relationship_graph_spec.rb +393 -0
- data/spec/unit/graph/sequential_prioritizer_spec.rb +32 -0
- data/spec/unit/{simple_graph_spec.rb → graph/simple_graph.rb} +42 -254
- data/spec/unit/graph/title_hash_prioritizer_spec.rb +49 -0
- data/spec/unit/hiera_puppet_spec.rb +1 -1
- data/spec/unit/indirector/catalog/active_record_spec.rb +4 -2
- data/spec/unit/indirector/catalog/compiler_spec.rb +20 -26
- data/spec/unit/indirector/face_spec.rb +1 -1
- data/spec/unit/indirector/facts/facter_spec.rb +11 -1
- data/spec/unit/indirector/facts/network_device_spec.rb +11 -1
- data/spec/unit/indirector/hiera_spec.rb +1 -1
- data/spec/unit/indirector/instrumentation_data/local_spec.rb +1 -1
- data/spec/unit/indirector/instrumentation_listener/local_spec.rb +1 -1
- data/spec/unit/indirector/request_spec.rb +92 -39
- data/spec/unit/indirector/rest_spec.rb +1 -0
- data/spec/unit/indirector_spec.rb +2 -2
- data/spec/unit/interface/option_builder_spec.rb +1 -0
- data/spec/unit/interface/option_spec.rb +1 -0
- data/spec/unit/interface_spec.rb +2 -2
- data/spec/unit/module_tool/applications/installer_spec.rb +49 -2
- data/spec/unit/module_tool/metadata_spec.rb +13 -0
- data/spec/unit/network/authstore_spec.rb +1 -1
- data/spec/unit/network/format_handler_spec.rb +33 -282
- data/spec/unit/network/format_support_spec.rb +199 -0
- data/spec/unit/network/formats_spec.rb +2 -2
- data/spec/unit/network/http/connection_spec.rb +88 -7
- data/spec/unit/network/http/handler_spec.rb +271 -249
- data/spec/unit/network/http/rack/rest_spec.rb +1 -1
- data/spec/unit/network/http/webrick/rest_spec.rb +73 -22
- data/spec/unit/network/http_pool_spec.rb +40 -0
- data/spec/unit/network/server_spec.rb +18 -207
- data/spec/unit/node/facts_spec.rb +68 -17
- data/spec/unit/other/selinux_spec.rb +24 -20
- data/spec/unit/parameter/boolean_spec.rb +25 -0
- data/spec/unit/parameter/value_collection_spec.rb +7 -7
- data/spec/unit/parameter_spec.rb +10 -13
- data/spec/unit/parser/ast/function_spec.rb +4 -4
- data/spec/unit/parser/ast/leaf_spec.rb +45 -6
- data/spec/unit/parser/collector_spec.rb +3 -3
- data/spec/unit/parser/compiler_spec.rb +4 -3
- data/spec/unit/parser/functions/create_resources_spec.rb +9 -25
- data/spec/unit/parser/functions/extlookup_spec.rb +2 -2
- data/spec/unit/parser/functions/hiera_include_spec.rb +12 -0
- data/spec/unit/parser/functions/lookup_spec.rb +96 -0
- data/spec/unit/parser/functions/regsubst_spec.rb +2 -2
- data/spec/unit/parser/functions/split_spec.rb +2 -2
- data/spec/unit/parser/functions/sprintf_spec.rb +1 -1
- data/spec/unit/parser/functions/versioncmp_spec.rb +2 -2
- data/spec/unit/parser/functions_spec.rb +7 -7
- data/spec/unit/parser/lexer_spec.rb +1 -1
- data/spec/unit/parser/methods/collect_spec.rb +43 -0
- data/spec/unit/parser/resource_spec.rb +9 -9
- data/spec/unit/parser/scope_spec.rb +45 -2
- data/spec/unit/parser/type_loader_spec.rb +159 -175
- data/spec/unit/pops/binder/binder_spec.rb +62 -0
- data/spec/unit/pops/binder/bindings_checker_spec.rb +196 -0
- data/spec/unit/pops/binder/bindings_composer_spec.rb +89 -0
- data/spec/unit/pops/binder/bindings_validator_factory_spec.rb +18 -0
- data/spec/unit/pops/binder/config/binder_config_spec.rb +48 -0
- data/spec/unit/pops/binder/hiera2/bindings_provider_spec.rb +74 -0
- data/spec/unit/pops/binder/hiera2/config_spec.rb +61 -0
- data/spec/unit/pops/binder/hiera2/yaml_backend_spec.rb +33 -0
- data/spec/unit/pops/binder/injector_spec.rb +789 -0
- data/spec/unit/pops/containment_spec.rb +1 -0
- data/spec/unit/pops/issues_spec.rb +1 -1
- data/spec/unit/pops/parser/evaluating_parser_spec.rb +88 -0
- data/spec/unit/pops/parser/lexer_spec.rb +1 -1
- data/spec/unit/pops/parser/parse_calls_spec.rb +4 -0
- data/spec/unit/pops/parser/parser_spec.rb +1 -1
- data/spec/unit/pops/types/type_calculator_spec.rb +484 -0
- data/spec/unit/pops/types/type_factory_spec.rb +65 -0
- data/spec/unit/pops/types/type_parser_spec.rb +93 -0
- data/spec/unit/property/list_spec.rb +1 -1
- data/spec/unit/property/ordered_list_spec.rb +1 -1
- data/spec/unit/provider/aixobject_spec.rb +101 -0
- data/spec/unit/provider/augeas/augeas_spec.rb +14 -3
- data/spec/unit/provider/mcx/mcxcontent_spec.rb +52 -16
- data/spec/unit/provider/mount/parsed_spec.rb +44 -56
- data/spec/unit/provider/mount_spec.rb +11 -2
- data/spec/unit/provider/naginator_spec.rb +8 -0
- data/spec/unit/provider/package/apt_spec.rb +5 -1
- data/spec/unit/provider/package/aptitude_spec.rb +9 -5
- data/spec/unit/provider/package/aptrpm_spec.rb +2 -2
- data/spec/unit/provider/package/dpkg_spec.rb +274 -99
- data/spec/unit/provider/package/openbsd_spec.rb +84 -1
- data/spec/unit/provider/package/opkg_spec.rb +3 -3
- data/spec/unit/provider/package/pip_spec.rb +16 -0
- data/spec/unit/provider/package/pkgdmg_spec.rb +62 -7
- data/spec/unit/provider/package/rpm_spec.rb +112 -21
- data/spec/unit/provider/package/urpmi.rb +80 -0
- data/spec/unit/provider/package/windows/exe_package_spec.rb +1 -1
- data/spec/unit/provider/package/yum_spec.rb +85 -0
- data/spec/unit/provider/package/zypper_spec.rb +25 -6
- data/spec/unit/provider/parsedfile_spec.rb +3 -2
- data/spec/unit/provider/service/init_spec.rb +10 -10
- data/spec/unit/provider/service/openrc_spec.rb +16 -0
- data/spec/unit/provider/service/openwrt_spec.rb +1 -1
- data/spec/unit/provider/service/redhat_spec.rb +7 -0
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +2 -2
- data/spec/unit/provider/user/aix_spec.rb +89 -0
- data/spec/unit/provider/user/directoryservice_spec.rb +11 -4
- data/spec/unit/provider/user/user_role_add_spec.rb +18 -0
- data/spec/unit/provider_spec.rb +2 -13
- data/spec/unit/reports/http_spec.rb +1 -1
- data/spec/unit/resource/catalog_spec.rb +23 -97
- data/spec/unit/resource/resource_type.json +34 -0
- data/spec/unit/resource/status_spec.rb +56 -0
- data/spec/unit/resource/type_collection_spec.rb +6 -6
- data/spec/unit/resource/type_spec.rb +25 -5
- data/spec/unit/resource_spec.rb +68 -24
- data/spec/unit/run_spec.rb +16 -0
- data/spec/unit/scheduler/scheduler_spec.rb +14 -27
- data/spec/unit/semver_spec.rb +5 -0
- data/spec/unit/settings/enum_setting_spec.rb +27 -0
- data/spec/unit/settings_spec.rb +53 -44
- data/spec/unit/ssl/certificate_authority_spec.rb +155 -19
- data/spec/unit/transaction/additional_resource_generator_spec.rb +419 -0
- data/spec/unit/transaction/event_manager_spec.rb +2 -2
- data/spec/unit/transaction/event_spec.rb +57 -0
- data/spec/unit/transaction/report_spec.rb +66 -0
- data/spec/unit/transaction/resource_harness_spec.rb +27 -20
- data/spec/unit/transaction_spec.rb +182 -390
- data/spec/unit/type/augeas_spec.rb +3 -3
- data/spec/unit/type/component_spec.rb +0 -9
- data/spec/unit/type/computer_spec.rb +1 -1
- data/spec/unit/type/cron_spec.rb +2 -2
- data/spec/unit/type/exec_spec.rb +4 -2
- data/spec/unit/type/file/content_spec.rb +11 -0
- data/spec/unit/type/file/group_spec.rb +1 -1
- data/spec/unit/type/file_spec.rb +16 -8
- data/spec/unit/type/mount_spec.rb +445 -259
- data/spec/unit/type/package_spec.rb +4 -4
- data/spec/unit/type/resources_spec.rb +30 -1
- data/spec/unit/type/user_spec.rb +26 -3
- data/spec/unit/type/yumrepo_spec.rb +7 -27
- data/spec/unit/type/zone_spec.rb +4 -1
- data/spec/unit/type_spec.rb +66 -33
- data/spec/unit/util/backups_spec.rb +3 -3
- data/spec/unit/util/http_proxy_spec.rb +83 -0
- data/spec/unit/util/log_spec.rb +79 -8
- data/spec/unit/util/metric_spec.rb +12 -0
- data/spec/unit/util/monkey_patches_spec.rb +6 -0
- data/spec/unit/util/network_device/config_spec.rb +26 -64
- data/spec/unit/util/pidlock_spec.rb +4 -1
- data/spec/unit/util/tagging_spec.rb +5 -9
- data/spec/unit/util/warnings_spec.rb +1 -1
- data/spec/unit/util/watched_file_spec.rb +52 -0
- data/spec/unit/util/watcher/periodic_watcher_spec.rb +52 -0
- data/spec/unit/util/watcher_spec.rb +56 -0
- data/spec/unit/util_spec.rb +16 -0
- metadata +2767 -2576
- data/ext/debian/puppet.manpages +0 -32
- data/ext/osx/PackageInfo.plist +0 -36
- data/ext/osx/createpackage.sh +0 -187
- data/ext/redhat/rundir-perms.patch +0 -28
- data/lib/puppet/external/base64.rb +0 -19
- data/lib/puppet/util/graph.rb +0 -27
- data/lib/puppet/util/loadedfile.rb +0 -61
- data/lib/puppet/util/log_paths.rb +0 -22
- data/lib/puppet/util/subclass_loader.rb +0 -78
- data/spec/monkey_patches/publicize_methods.rb +0 -11
- data/spec/unit/util/loadedfile_spec.rb +0 -71
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'puppet/graph'
|
3
|
+
|
4
|
+
describe Puppet::Graph::SequentialPrioritizer do
|
5
|
+
let(:priorities) { Puppet::Graph::SequentialPrioritizer.new }
|
6
|
+
|
7
|
+
it "generates priorities that maintain the sequence" do
|
8
|
+
first = priorities.generate_priority_for("one")
|
9
|
+
second = priorities.generate_priority_for("two")
|
10
|
+
third = priorities.generate_priority_for("three")
|
11
|
+
|
12
|
+
expect(first).to be < second
|
13
|
+
expect(second).to be < third
|
14
|
+
end
|
15
|
+
|
16
|
+
it "prioritizes contained keys after the container" do
|
17
|
+
parent = priorities.generate_priority_for("one")
|
18
|
+
child = priorities.generate_priority_contained_in("one", "child 1")
|
19
|
+
sibling = priorities.generate_priority_contained_in("one", "child 2")
|
20
|
+
uncle = priorities.generate_priority_for("two")
|
21
|
+
|
22
|
+
expect(parent).to be < child
|
23
|
+
expect(child).to be < sibling
|
24
|
+
expect(sibling).to be < uncle
|
25
|
+
end
|
26
|
+
|
27
|
+
it "fails to prioritize a key contained in an unknown container" do
|
28
|
+
expect do
|
29
|
+
priorities.generate_priority_contained_in("unknown", "child 1")
|
30
|
+
end.to raise_error
|
31
|
+
end
|
32
|
+
end
|
@@ -1,27 +1,27 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
require 'spec_helper'
|
3
|
-
require 'puppet/
|
3
|
+
require 'puppet/graph'
|
4
4
|
|
5
|
-
describe Puppet::SimpleGraph do
|
5
|
+
describe Puppet::Graph::SimpleGraph do
|
6
6
|
it "should return the number of its vertices as its length" do
|
7
|
-
@graph = Puppet::SimpleGraph.new
|
7
|
+
@graph = Puppet::Graph::SimpleGraph.new
|
8
8
|
@graph.add_vertex("one")
|
9
9
|
@graph.add_vertex("two")
|
10
10
|
@graph.size.should == 2
|
11
11
|
end
|
12
12
|
|
13
13
|
it "should consider itself a directed graph" do
|
14
|
-
Puppet::SimpleGraph.new.directed?.should be_true
|
14
|
+
Puppet::Graph::SimpleGraph.new.directed?.should be_true
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should provide a method for reversing the graph" do
|
18
|
-
@graph = Puppet::SimpleGraph.new
|
18
|
+
@graph = Puppet::Graph::SimpleGraph.new
|
19
19
|
@graph.add_edge(:one, :two)
|
20
20
|
@graph.reversal.edge?(:two, :one).should be_true
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should be able to produce a dot graph" do
|
24
|
-
@graph = Puppet::SimpleGraph.new
|
24
|
+
@graph = Puppet::Graph::SimpleGraph.new
|
25
25
|
@graph.add_edge(:one, :two)
|
26
26
|
|
27
27
|
expect { @graph.to_dot_graph }.to_not raise_error
|
@@ -29,7 +29,7 @@ describe Puppet::SimpleGraph do
|
|
29
29
|
|
30
30
|
describe "when managing vertices" do
|
31
31
|
before do
|
32
|
-
@graph = Puppet::SimpleGraph.new
|
32
|
+
@graph = Puppet::Graph::SimpleGraph.new
|
33
33
|
end
|
34
34
|
|
35
35
|
it "should provide a method to add a vertex" do
|
@@ -78,7 +78,7 @@ describe Puppet::SimpleGraph do
|
|
78
78
|
|
79
79
|
describe "when managing edges" do
|
80
80
|
before do
|
81
|
-
@graph = Puppet::SimpleGraph.new
|
81
|
+
@graph = Puppet::Graph::SimpleGraph.new
|
82
82
|
end
|
83
83
|
|
84
84
|
it "should provide a method to test whether a given vertex pair is an edge" do
|
@@ -179,7 +179,7 @@ describe Puppet::SimpleGraph do
|
|
179
179
|
|
180
180
|
describe "when finding adjacent vertices" do
|
181
181
|
before do
|
182
|
-
@graph = Puppet::SimpleGraph.new
|
182
|
+
@graph = Puppet::Graph::SimpleGraph.new
|
183
183
|
@one_two = Puppet::Relationship.new(:one, :two)
|
184
184
|
@two_three = Puppet::Relationship.new(:two, :three)
|
185
185
|
@one_three = Puppet::Relationship.new(:one, :three)
|
@@ -212,7 +212,7 @@ describe Puppet::SimpleGraph do
|
|
212
212
|
|
213
213
|
# Bug #2111
|
214
214
|
it "should not consider a vertex adjacent just because it was asked about previously" do
|
215
|
-
@graph = Puppet::SimpleGraph.new
|
215
|
+
@graph = Puppet::Graph::SimpleGraph.new
|
216
216
|
@graph.add_vertex("a")
|
217
217
|
@graph.add_vertex("b")
|
218
218
|
@graph.edge?("a", "b")
|
@@ -222,7 +222,7 @@ describe Puppet::SimpleGraph do
|
|
222
222
|
|
223
223
|
describe "when clearing" do
|
224
224
|
before do
|
225
|
-
@graph = Puppet::SimpleGraph.new
|
225
|
+
@graph = Puppet::Graph::SimpleGraph.new
|
226
226
|
one = Puppet::Relationship.new(:one, :two)
|
227
227
|
two = Puppet::Relationship.new(:two, :three)
|
228
228
|
@graph.add_edge(one)
|
@@ -242,7 +242,7 @@ describe Puppet::SimpleGraph do
|
|
242
242
|
|
243
243
|
describe "when reversing graphs" do
|
244
244
|
before do
|
245
|
-
@graph = Puppet::SimpleGraph.new
|
245
|
+
@graph = Puppet::Graph::SimpleGraph.new
|
246
246
|
end
|
247
247
|
|
248
248
|
it "should provide a method for reversing the graph" do
|
@@ -265,7 +265,7 @@ describe Puppet::SimpleGraph do
|
|
265
265
|
|
266
266
|
describe "when reporting cycles in the graph" do
|
267
267
|
before do
|
268
|
-
@graph = Puppet::SimpleGraph.new
|
268
|
+
@graph = Puppet::Graph::SimpleGraph.new
|
269
269
|
end
|
270
270
|
|
271
271
|
# This works with `add_edges` to auto-vivify the resource instances.
|
@@ -282,9 +282,9 @@ describe Puppet::SimpleGraph do
|
|
282
282
|
end
|
283
283
|
|
284
284
|
def simplify(cycles)
|
285
|
-
cycles.map do |
|
286
|
-
|
287
|
-
|
285
|
+
cycles.map do |cycle|
|
286
|
+
cycle.map do |resource|
|
287
|
+
resource.name
|
288
288
|
end
|
289
289
|
end
|
290
290
|
end
|
@@ -322,18 +322,20 @@ describe Puppet::SimpleGraph do
|
|
322
322
|
add_edges "b" => "a"
|
323
323
|
add_edges "b" => "c"
|
324
324
|
|
325
|
-
|
326
|
-
|
327
|
-
|
325
|
+
simplify(@graph.find_cycles_in_graph).should be == [["a", "b"]]
|
326
|
+
end
|
327
|
+
|
328
|
+
it "cycle discovery handles a self-loop cycle" do
|
329
|
+
add_edges :a => :a
|
330
|
+
|
331
|
+
simplify(@graph.find_cycles_in_graph).should be == [["a"]]
|
328
332
|
end
|
329
333
|
|
330
334
|
it "cycle discovery should handle two distinct cycles" do
|
331
335
|
add_edges "a" => "a1", "a1" => "a"
|
332
336
|
add_edges "b" => "b1", "b1" => "b"
|
333
337
|
|
334
|
-
|
335
|
-
expect { cycles = @graph.find_cycles_in_graph }.to_not raise_error
|
336
|
-
simplify(cycles).should be == [["a1", "a"], ["b1", "b"]]
|
338
|
+
simplify(@graph.find_cycles_in_graph).should be == [["a1", "a"], ["b1", "b"]]
|
337
339
|
end
|
338
340
|
|
339
341
|
it "cycle discovery should handle two cycles in a connected graph" do
|
@@ -341,9 +343,7 @@ describe Puppet::SimpleGraph do
|
|
341
343
|
add_edges "a" => "a1", "a1" => "a"
|
342
344
|
add_edges "c" => "c1", "c1" => "c2", "c2" => "c3", "c3" => "c"
|
343
345
|
|
344
|
-
|
345
|
-
expect { cycles = @graph.find_cycles_in_graph }.to_not raise_error
|
346
|
-
simplify(cycles).should be == [%w{a1 a}, %w{c1 c2 c3 c}]
|
346
|
+
simplify(@graph.find_cycles_in_graph).should be == [%w{a1 a}, %w{c1 c2 c3 c}]
|
347
347
|
end
|
348
348
|
|
349
349
|
it "cycle discovery should handle a complicated cycle" do
|
@@ -352,18 +352,14 @@ describe Puppet::SimpleGraph do
|
|
352
352
|
add_edges "c" => "c1", "c1" => "a"
|
353
353
|
add_edges "c" => "c2", "c2" => "b"
|
354
354
|
|
355
|
-
|
356
|
-
expect { cycles = @graph.find_cycles_in_graph }.to_not raise_error
|
357
|
-
simplify(cycles).should be == [%w{a b c1 c2 c}]
|
355
|
+
simplify(@graph.find_cycles_in_graph).should be == [%w{a b c1 c2 c}]
|
358
356
|
end
|
359
357
|
|
360
358
|
it "cycle discovery should not fail with large data sets" do
|
361
359
|
limit = 3000
|
362
360
|
(1..(limit - 1)).each do |n| add_edges n.to_s => (n+1).to_s end
|
363
361
|
|
364
|
-
|
365
|
-
expect { cycles = @graph.find_cycles_in_graph }.to_not raise_error
|
366
|
-
simplify(cycles).should be == []
|
362
|
+
simplify(@graph.find_cycles_in_graph).should be == []
|
367
363
|
end
|
368
364
|
|
369
365
|
it "path finding should work with a simple cycle" do
|
@@ -415,7 +411,7 @@ describe Puppet::SimpleGraph do
|
|
415
411
|
|
416
412
|
describe "when writing dot files" do
|
417
413
|
before do
|
418
|
-
@graph = Puppet::SimpleGraph.new
|
414
|
+
@graph = Puppet::Graph::SimpleGraph.new
|
419
415
|
@name = :test
|
420
416
|
@file = File.join(Puppet[:graphdir], @name.to_s + ".dot")
|
421
417
|
end
|
@@ -432,15 +428,11 @@ describe Puppet::SimpleGraph do
|
|
432
428
|
Puppet[:graph] = true
|
433
429
|
@graph.write_graph(@name)
|
434
430
|
end
|
435
|
-
|
436
|
-
after do
|
437
|
-
Puppet.settings.clear
|
438
|
-
end
|
439
431
|
end
|
440
432
|
|
441
|
-
describe Puppet::SimpleGraph do
|
433
|
+
describe Puppet::Graph::SimpleGraph do
|
442
434
|
before do
|
443
|
-
@graph = Puppet::SimpleGraph.new
|
435
|
+
@graph = Puppet::Graph::SimpleGraph.new
|
444
436
|
end
|
445
437
|
|
446
438
|
it "should correctly clear vertices and edges when asked" do
|
@@ -454,7 +446,7 @@ describe Puppet::SimpleGraph do
|
|
454
446
|
|
455
447
|
describe "when matching edges" do
|
456
448
|
before do
|
457
|
-
@graph = Puppet::SimpleGraph.new
|
449
|
+
@graph = Puppet::Graph::SimpleGraph.new
|
458
450
|
|
459
451
|
# The Ruby 1.8 semantics for String#[] are that treating it like an
|
460
452
|
# array and asking for `"a"[:whatever]` returns `nil`. Ruby 1.9
|
@@ -496,7 +488,7 @@ describe Puppet::SimpleGraph do
|
|
496
488
|
|
497
489
|
describe "when determining dependencies" do
|
498
490
|
before do
|
499
|
-
@graph = Puppet::SimpleGraph.new
|
491
|
+
@graph = Puppet::Graph::SimpleGraph.new
|
500
492
|
|
501
493
|
@graph.add_edge("a", "b")
|
502
494
|
@graph.add_edge("a", "c")
|
@@ -528,212 +520,8 @@ describe Puppet::SimpleGraph do
|
|
528
520
|
end
|
529
521
|
end
|
530
522
|
|
531
|
-
require 'puppet/util/graph'
|
532
|
-
|
533
|
-
class Container < Puppet::Type::Component
|
534
|
-
include Puppet::Util::Graph
|
535
|
-
include Enumerable
|
536
|
-
attr_accessor :name
|
537
|
-
def each
|
538
|
-
@children.each do |c| yield c end
|
539
|
-
end
|
540
|
-
|
541
|
-
def initialize(name, ary)
|
542
|
-
@name = name
|
543
|
-
@children = ary
|
544
|
-
end
|
545
|
-
|
546
|
-
def push(*ary)
|
547
|
-
ary.each { |c| @children.push(c)}
|
548
|
-
end
|
549
|
-
|
550
|
-
def to_s
|
551
|
-
@name
|
552
|
-
end
|
553
|
-
|
554
|
-
def ref
|
555
|
-
"Container[#{self}]"
|
556
|
-
end
|
557
|
-
end
|
558
|
-
|
559
|
-
require "puppet/resource/catalog"
|
560
|
-
describe "when splicing the graph" do
|
561
|
-
def container_graph
|
562
|
-
@one = Container.new("one", %w{a b})
|
563
|
-
@two = Container.new("two", ["c", "d"])
|
564
|
-
@three = Container.new("three", ["i", "j"])
|
565
|
-
@middle = Container.new("middle", ["e", "f", @two])
|
566
|
-
@top = Container.new("top", ["g", "h", @middle, @one, @three])
|
567
|
-
@empty = Container.new("empty", [])
|
568
|
-
|
569
|
-
@whit = Puppet::Type.type(:whit)
|
570
|
-
@stage = Puppet::Type.type(:stage).new(:name => "foo")
|
571
|
-
|
572
|
-
@contgraph = @top.to_graph(Puppet::Resource::Catalog.new)
|
573
|
-
|
574
|
-
# We have to add the container to the main graph, else it won't
|
575
|
-
# be spliced in the dependency graph.
|
576
|
-
@contgraph.add_vertex(@empty)
|
577
|
-
end
|
578
|
-
|
579
|
-
def containers
|
580
|
-
@contgraph.vertices.select { |x| !x.is_a? String }
|
581
|
-
end
|
582
|
-
|
583
|
-
def contents_of(x)
|
584
|
-
@contgraph.direct_dependents_of(x)
|
585
|
-
end
|
586
|
-
|
587
|
-
def dependency_graph
|
588
|
-
@depgraph = Puppet::SimpleGraph.new
|
589
|
-
@contgraph.vertices.each do |v|
|
590
|
-
@depgraph.add_vertex(v)
|
591
|
-
end
|
592
|
-
|
593
|
-
# We have to specify a relationship to our empty container, else it
|
594
|
-
# never makes it into the dep graph in the first place.
|
595
|
-
@explicit_dependencies = {@one => @two, "f" => "c", "h" => @middle, "c" => @empty}
|
596
|
-
@explicit_dependencies.each do |source, target|
|
597
|
-
@depgraph.add_edge(source, target, :callback => :refresh)
|
598
|
-
end
|
599
|
-
end
|
600
|
-
|
601
|
-
def splice
|
602
|
-
@contgraph.splice!(@depgraph)
|
603
|
-
end
|
604
|
-
|
605
|
-
def whit_called(name)
|
606
|
-
x = @depgraph.vertices.find { |v| v.is_a?(@whit) && v.name =~ /#{Regexp.escape(name)}/ }
|
607
|
-
x.should_not be_nil
|
608
|
-
def x.to_s
|
609
|
-
"Whit[#{name}]"
|
610
|
-
end
|
611
|
-
def x.inspect
|
612
|
-
to_s
|
613
|
-
end
|
614
|
-
x
|
615
|
-
end
|
616
|
-
|
617
|
-
def admissible_sentinel_of(x)
|
618
|
-
@depgraph.vertex?(x) ? x : whit_called("admissible_#{x.ref}")
|
619
|
-
end
|
620
|
-
|
621
|
-
def completed_sentinel_of(x)
|
622
|
-
@depgraph.vertex?(x) ? x : whit_called("completed_#{x.ref}")
|
623
|
-
end
|
624
|
-
|
625
|
-
before do
|
626
|
-
container_graph
|
627
|
-
dependency_graph
|
628
|
-
splice
|
629
|
-
end
|
630
|
-
|
631
|
-
# This is the real heart of splicing -- replacing all containers X in our
|
632
|
-
# relationship graph with a pair of whits { admissible_X and completed_X }
|
633
|
-
# such that that
|
634
|
-
#
|
635
|
-
# 0) completed_X depends on admissible_X
|
636
|
-
# 1) contents of X each depend on admissible_X
|
637
|
-
# 2) completed_X depends on each on the contents of X
|
638
|
-
# 3) everything which depended on X depends on completed_X
|
639
|
-
# 4) admissible_X depends on everything X depended on
|
640
|
-
# 5) the containers and their edges must be removed
|
641
|
-
#
|
642
|
-
# Note that this requires attention to the possible case of containers
|
643
|
-
# which contain or depend on other containers.
|
644
|
-
#
|
645
|
-
# Point by point:
|
646
|
-
|
647
|
-
# 0) completed_X depends on admissible_X
|
648
|
-
#
|
649
|
-
it "every container's completed sentinel should depend on its admissible sentinel" do
|
650
|
-
containers.each { |container|
|
651
|
-
@depgraph.path_between(admissible_sentinel_of(container),completed_sentinel_of(container)).should be
|
652
|
-
}
|
653
|
-
end
|
654
|
-
|
655
|
-
# 1) contents of X each depend on admissible_X
|
656
|
-
#
|
657
|
-
it "all contained objects should depend on their container's admissible sentinel" do
|
658
|
-
containers.each { |container|
|
659
|
-
contents_of(container).each { |leaf|
|
660
|
-
@depgraph.should be_edge(admissible_sentinel_of(container),admissible_sentinel_of(leaf))
|
661
|
-
}
|
662
|
-
}
|
663
|
-
end
|
664
|
-
|
665
|
-
# 2) completed_X depends on each on the contents of X
|
666
|
-
#
|
667
|
-
it "completed sentinels should depend on their container's contents" do
|
668
|
-
containers.each { |container|
|
669
|
-
contents_of(container).each { |leaf|
|
670
|
-
@depgraph.should be_edge(completed_sentinel_of(leaf),completed_sentinel_of(container))
|
671
|
-
}
|
672
|
-
}
|
673
|
-
end
|
674
|
-
|
675
|
-
#
|
676
|
-
# 3) everything which depended on X depends on completed_X
|
677
|
-
|
678
|
-
#
|
679
|
-
# 4) admissible_X depends on everything X depended on
|
680
|
-
|
681
|
-
# 5) the containers and their edges must be removed
|
682
|
-
#
|
683
|
-
it "should remove all Container objects from the dependency graph" do
|
684
|
-
@depgraph.vertices.find_all { |v| v.is_a?(Container) }.should be_empty
|
685
|
-
end
|
686
|
-
|
687
|
-
it "should remove all Stage resources from the dependency graph" do
|
688
|
-
@depgraph.vertices.find_all { |v| v.is_a?(Puppet::Type.type(:stage)) }.should be_empty
|
689
|
-
end
|
690
|
-
|
691
|
-
it "should no longer contain anything but the non-container objects" do
|
692
|
-
@depgraph.vertices.find_all { |v| ! v.is_a?(String) and ! v.is_a?(@whit)}.should be_empty
|
693
|
-
end
|
694
|
-
|
695
|
-
it "should retain labels on non-containment edges" do
|
696
|
-
@explicit_dependencies.each { |f,t|
|
697
|
-
@depgraph.edges_between(completed_sentinel_of(f),admissible_sentinel_of(t))[0].label.should == {:callback => :refresh}
|
698
|
-
}
|
699
|
-
end
|
700
|
-
|
701
|
-
it "should not add labels to edges that have none" do
|
702
|
-
@depgraph.add_edge(@two, @three)
|
703
|
-
splice
|
704
|
-
@depgraph.path_between("c", "i").any? {|segment| segment.all? {|e| e.label == {} }}.should be
|
705
|
-
end
|
706
|
-
|
707
|
-
it "should copy labels over edges that have none" do
|
708
|
-
@depgraph.add_edge("c", @three, {:callback => :refresh})
|
709
|
-
splice
|
710
|
-
# And make sure the label got copied.
|
711
|
-
@depgraph.path_between("c", "i").flatten.select {|e| e.label == {:callback => :refresh} }.should_not be_empty
|
712
|
-
end
|
713
|
-
|
714
|
-
it "should not replace a label with a nil label" do
|
715
|
-
# Lastly, add some new label-less edges and make sure the label stays.
|
716
|
-
@depgraph.add_edge(@middle, @three)
|
717
|
-
@depgraph.add_edge("c", @three, {:callback => :refresh})
|
718
|
-
splice
|
719
|
-
@depgraph.path_between("c","i").flatten.select {|e| e.label == {:callback => :refresh} }.should_not be_empty
|
720
|
-
end
|
721
|
-
|
722
|
-
it "should copy labels to all created edges" do
|
723
|
-
@depgraph.add_edge(@middle, @three)
|
724
|
-
@depgraph.add_edge("c", @three, {:callback => :refresh})
|
725
|
-
splice
|
726
|
-
@three.each do |child|
|
727
|
-
edge = Puppet::Relationship.new("c", child)
|
728
|
-
(path = @depgraph.path_between(edge.source, edge.target)).should be
|
729
|
-
path.should_not be_empty
|
730
|
-
path.flatten.select {|e| e.label == {:callback => :refresh} }.should_not be_empty
|
731
|
-
end
|
732
|
-
end
|
733
|
-
end
|
734
|
-
|
735
523
|
it "should serialize to YAML using the old format by default" do
|
736
|
-
Puppet::SimpleGraph.use_new_yaml_format.should == false
|
524
|
+
Puppet::Graph::SimpleGraph.use_new_yaml_format.should == false
|
737
525
|
end
|
738
526
|
|
739
527
|
describe "(yaml tests)" do
|
@@ -780,18 +568,18 @@ describe Puppet::SimpleGraph do
|
|
780
568
|
end
|
781
569
|
|
782
570
|
def graph_to_yaml(graph, which_format)
|
783
|
-
previous_use_new_yaml_format = Puppet::SimpleGraph.use_new_yaml_format
|
784
|
-
Puppet::SimpleGraph.use_new_yaml_format = (which_format == :new)
|
571
|
+
previous_use_new_yaml_format = Puppet::Graph::SimpleGraph.use_new_yaml_format
|
572
|
+
Puppet::Graph::SimpleGraph.use_new_yaml_format = (which_format == :new)
|
785
573
|
ZAML.dump(graph)
|
786
574
|
ensure
|
787
|
-
Puppet::SimpleGraph.use_new_yaml_format = previous_use_new_yaml_format
|
575
|
+
Puppet::Graph::SimpleGraph.use_new_yaml_format = previous_use_new_yaml_format
|
788
576
|
end
|
789
577
|
|
790
578
|
# Test serialization of graph to YAML.
|
791
579
|
[:old, :new].each do |which_format|
|
792
580
|
all_test_graphs.each do |graph_to_test|
|
793
581
|
it "should be able to serialize #{graph_to_test} to YAML (#{which_format} format)", :if => (RUBY_VERSION[0,3] == '1.8' or YAML::ENGINE.syck?) do
|
794
|
-
graph = Puppet::SimpleGraph.new
|
582
|
+
graph = Puppet::Graph::SimpleGraph.new
|
795
583
|
send(graph_to_test, graph)
|
796
584
|
yaml_form = graph_to_yaml(graph, which_format)
|
797
585
|
|
@@ -805,7 +593,7 @@ describe Puppet::SimpleGraph do
|
|
805
593
|
# Check that the object contains instance variables @edges and
|
806
594
|
# @vertices only. @reversal is also permitted, but we don't
|
807
595
|
# check it, because it is going to be phased out.
|
808
|
-
serialized_object.type_id.should == 'object:Puppet::SimpleGraph'
|
596
|
+
serialized_object.type_id.should == 'object:Puppet::Graph::SimpleGraph'
|
809
597
|
serialized_object.value.keys.reject { |x| x == 'reversal' }.sort.should == ['edges', 'vertices']
|
810
598
|
|
811
599
|
# Check edges by forming a set of tuples (source, target,
|
@@ -829,7 +617,7 @@ describe Puppet::SimpleGraph do
|
|
829
617
|
vertices.should be_a(Hash)
|
830
618
|
Set.new(vertices.keys).should == Set.new(graph.vertices)
|
831
619
|
vertices.each do |key, value|
|
832
|
-
value.type_id.should == 'object:Puppet::SimpleGraph::VertexWrapper'
|
620
|
+
value.type_id.should == 'object:Puppet::Graph::SimpleGraph::VertexWrapper'
|
833
621
|
value.value.keys.sort.should == %w{adjacencies vertex}
|
834
622
|
value.value['vertex'].should equal(key)
|
835
623
|
adjacencies = value.value['adjacencies']
|
@@ -867,7 +655,7 @@ describe Puppet::SimpleGraph do
|
|
867
655
|
# tested.
|
868
656
|
all_test_graphs.each do |graph_to_test|
|
869
657
|
it "should be able to deserialize #{graph_to_test} from YAML (#{which_format} format)" do
|
870
|
-
reference_graph = Puppet::SimpleGraph.new
|
658
|
+
reference_graph = Puppet::Graph::SimpleGraph.new
|
871
659
|
send(graph_to_test, reference_graph)
|
872
660
|
yaml_form = graph_to_yaml(reference_graph, which_format)
|
873
661
|
recovered_graph = YAML.load(yaml_form)
|
@@ -897,7 +685,7 @@ describe Puppet::SimpleGraph do
|
|
897
685
|
end
|
898
686
|
|
899
687
|
it "should be able to serialize a graph where the vertices contain backreferences to the graph (#{which_format} format)" do
|
900
|
-
reference_graph = Puppet::SimpleGraph.new
|
688
|
+
reference_graph = Puppet::Graph::SimpleGraph.new
|
901
689
|
vertex = Object.new
|
902
690
|
vertex.instance_eval { @graph = reference_graph }
|
903
691
|
reference_graph.add_edge(vertex, :other_vertex)
|
@@ -915,7 +703,7 @@ describe Puppet::SimpleGraph do
|
|
915
703
|
end
|
916
704
|
|
917
705
|
it "should serialize properly when used as a base class" do
|
918
|
-
class Puppet::TestDerivedClass < Puppet::SimpleGraph
|
706
|
+
class Puppet::TestDerivedClass < Puppet::Graph::SimpleGraph
|
919
707
|
attr_accessor :foo
|
920
708
|
end
|
921
709
|
derived = Puppet::TestDerivedClass.new
|