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
@@ -148,7 +148,7 @@ describe Puppet::Application::Apply do
|
|
148
148
|
|
149
149
|
STDIN.stubs(:read)
|
150
150
|
|
151
|
-
@transaction =
|
151
|
+
@transaction = stub('transaction')
|
152
152
|
@catalog.stubs(:apply).returns(@transaction)
|
153
153
|
|
154
154
|
Puppet::Util::Storage.stubs(:load)
|
@@ -33,7 +33,7 @@ describe Puppet::Application::FaceBase do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
describe "with just an action" do
|
36
|
-
before
|
36
|
+
before(:each) do
|
37
37
|
# We have to stub Signal.trap to avoid a crazy mess where we take
|
38
38
|
# over signal handling and make it impossible to cancel the test
|
39
39
|
# suite run.
|
@@ -304,8 +304,8 @@ describe Puppet::Application::FaceBase do
|
|
304
304
|
end
|
305
305
|
|
306
306
|
[[1, 2], ["one"], [{ 1 => 1 }]].each do |input|
|
307
|
-
it "should render
|
308
|
-
app.render(input, {}).should == input.
|
307
|
+
it "should render Array as one item per line" do
|
308
|
+
app.render(input, {}).should == input.collect { |item| item.to_s + "\n" }.join('')
|
309
309
|
end
|
310
310
|
end
|
311
311
|
|
@@ -16,6 +16,7 @@ describe Puppet::Application::Facts do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should return facts if a key is given to find" do
|
19
|
+
Puppet[:stringify_facts] = false
|
19
20
|
Puppet::Node::Facts.indirection.reset_terminus_class
|
20
21
|
Puppet::Node::Facts.indirection.expects(:find).returns(Puppet::Node::Facts.new('whatever', {}))
|
21
22
|
subject.command_line.stubs(:args).returns %w{find whatever --render-as yaml}
|
@@ -47,21 +47,6 @@ describe Puppet::Application::Master, :unless => Puppet.features.microsoft_windo
|
|
47
47
|
|
48
48
|
@master.preinit
|
49
49
|
end
|
50
|
-
|
51
|
-
it "should create a Puppet Daemon" do
|
52
|
-
Puppet::Daemon.expects(:new).returns(@daemon)
|
53
|
-
|
54
|
-
@master.preinit
|
55
|
-
end
|
56
|
-
|
57
|
-
it "should give ARGV to the Daemon" do
|
58
|
-
argv = stub 'argv'
|
59
|
-
ARGV.stubs(:dup).returns(argv)
|
60
|
-
@daemon.expects(:argv=).with(argv)
|
61
|
-
|
62
|
-
@master.preinit
|
63
|
-
end
|
64
|
-
|
65
50
|
end
|
66
51
|
|
67
52
|
[:debug,:verbose].each do |option|
|
@@ -8,7 +8,6 @@ describe Puppet::Application::Queue, :unless => Puppet.features.microsoft_window
|
|
8
8
|
before :each do
|
9
9
|
@queue = Puppet::Application[:queue]
|
10
10
|
@queue.stubs(:puts)
|
11
|
-
@daemon = stub_everything 'daemon'
|
12
11
|
Puppet::Util::Log.stubs(:newdestination)
|
13
12
|
|
14
13
|
Puppet::Resource::Catalog.indirection.stubs(:terminus_class=)
|
@@ -40,14 +39,6 @@ describe Puppet::Application::Queue, :unless => Puppet.features.microsoft_window
|
|
40
39
|
|
41
40
|
@queue.options[:debug].should be_false
|
42
41
|
end
|
43
|
-
|
44
|
-
it "should create a Daemon instance and copy ARGV to it" do
|
45
|
-
ARGV.expects(:dup).returns "eh"
|
46
|
-
daemon = mock("daemon")
|
47
|
-
daemon.expects(:argv=).with("eh")
|
48
|
-
Puppet::Daemon.expects(:new).returns daemon
|
49
|
-
@queue.preinit
|
50
|
-
end
|
51
42
|
end
|
52
43
|
|
53
44
|
describe "when handling options" do
|
@@ -65,10 +56,13 @@ describe Puppet::Application::Queue, :unless => Puppet.features.microsoft_window
|
|
65
56
|
end
|
66
57
|
|
67
58
|
describe "during setup" do
|
59
|
+
let(:daemon) { stub("Daemon", :daemonize => nil, :argv= => []) }
|
60
|
+
|
68
61
|
before :each do
|
62
|
+
Puppet::Daemon.stubs(:new).returns(daemon)
|
63
|
+
|
69
64
|
@queue.preinit
|
70
65
|
@queue.options.stubs(:[])
|
71
|
-
@queue.daemon.stubs(:daemonize)
|
72
66
|
Puppet.stubs(:info)
|
73
67
|
Puppet.features.stubs(:stomp?).returns true
|
74
68
|
Puppet::Resource::Catalog.indirection.stubs(:terminus_class=)
|
@@ -79,7 +73,7 @@ describe Puppet::Application::Queue, :unless => Puppet.features.microsoft_window
|
|
79
73
|
|
80
74
|
it "should fail if the stomp feature is missing" do
|
81
75
|
Puppet.features.expects(:stomp?).returns false
|
82
|
-
|
76
|
+
expect { @queue.setup }.to raise_error(ArgumentError)
|
83
77
|
end
|
84
78
|
|
85
79
|
it "should issue a warning that queue is deprecated" do
|
@@ -139,7 +133,7 @@ describe Puppet::Application::Queue, :unless => Puppet.features.microsoft_window
|
|
139
133
|
it "should daemonize if needed" do
|
140
134
|
Puppet[:daemonize] = true
|
141
135
|
|
142
|
-
|
136
|
+
daemon.expects(:daemonize)
|
143
137
|
|
144
138
|
@queue.setup
|
145
139
|
end
|
@@ -36,7 +36,7 @@ describe Puppet::Application::Resource do
|
|
36
36
|
@resource_app.host.should == :whatever
|
37
37
|
end
|
38
38
|
|
39
|
-
it "should load
|
39
|
+
it "should load a display all types with types option" do
|
40
40
|
type1 = stub_everything 'type1', :name => :type1
|
41
41
|
type2 = stub_everything 'type2', :name => :type2
|
42
42
|
Puppet::Type.stubs(:loadall)
|
@@ -5,19 +5,19 @@ require 'puppet/configurer/fact_handler'
|
|
5
5
|
|
6
6
|
class FactHandlerTester
|
7
7
|
include Puppet::Configurer::FactHandler
|
8
|
+
|
9
|
+
def reload_facter
|
10
|
+
# don't want to do this in tests
|
11
|
+
end
|
8
12
|
end
|
9
13
|
|
10
14
|
describe Puppet::Configurer::FactHandler do
|
11
|
-
before do
|
15
|
+
before :each do
|
12
16
|
@facthandler = FactHandlerTester.new
|
17
|
+
Puppet::Node::Facts.indirection.terminus_class = :memory
|
13
18
|
end
|
14
19
|
|
15
20
|
describe "when finding facts" do
|
16
|
-
before :each do
|
17
|
-
@facthandler.stubs(:reload_facter)
|
18
|
-
Puppet::Node::Facts.indirection.terminus_class = :memory
|
19
|
-
end
|
20
|
-
|
21
21
|
it "should use the node name value to retrieve the facts" do
|
22
22
|
foo_facts = Puppet::Node::Facts.new('foo')
|
23
23
|
bar_facts = Puppet::Node::Facts.new('bar')
|
@@ -48,61 +48,30 @@ describe Puppet::Configurer::FactHandler do
|
|
48
48
|
end
|
49
49
|
|
50
50
|
it "should fail if finding facts fails" do
|
51
|
-
Puppet[:trace] = false
|
52
|
-
Puppet[:certname] = "myhost"
|
53
51
|
Puppet::Node::Facts.indirection.expects(:find).raises RuntimeError
|
54
52
|
|
55
|
-
|
53
|
+
expect { @facthandler.find_facts }.to raise_error(Puppet::Error, /Could not retrieve local facts/)
|
56
54
|
end
|
57
|
-
end
|
58
55
|
|
59
|
-
|
60
|
-
|
61
|
-
|
56
|
+
it "should only load fact plugins once" do
|
57
|
+
Puppet::Node::Facts.indirection.expects(:find).once
|
58
|
+
@facthandler.find_facts
|
59
|
+
end
|
62
60
|
end
|
63
61
|
|
64
|
-
# I couldn't get marshal to work for this, only yaml, so we hard-code yaml.
|
65
62
|
it "should serialize and CGI escape the fact values for uploading" do
|
66
|
-
facts =
|
67
|
-
|
68
|
-
|
69
|
-
text = CGI.escape("my text")
|
63
|
+
facts = Puppet::Node::Facts.new(Puppet[:node_name_value], 'my_name_fact' => 'other_node_name')
|
64
|
+
Puppet::Node::Facts.indirection.save(facts)
|
65
|
+
text = CGI.escape(@facthandler.find_facts.render(:pson))
|
70
66
|
|
71
|
-
@facthandler.
|
72
|
-
|
73
|
-
@facthandler.facts_for_uploading.should == {:facts_format => :b64_zlib_yaml, :facts => text}
|
67
|
+
@facthandler.facts_for_uploading.should == {:facts_format => :pson, :facts => text}
|
74
68
|
end
|
75
69
|
|
76
70
|
it "should properly accept facts containing a '+'" do
|
77
|
-
facts =
|
78
|
-
|
79
|
-
|
80
|
-
text = "my%2Btext"
|
81
|
-
|
82
|
-
@facthandler.expects(:find_facts).returns facts
|
83
|
-
|
84
|
-
@facthandler.facts_for_uploading.should == {:facts_format => :b64_zlib_yaml, :facts => text}
|
85
|
-
end
|
86
|
-
|
87
|
-
it "use compressed yaml as the serialization if zlib is supported" do
|
88
|
-
facts = stub 'facts'
|
89
|
-
facts.expects(:support_format?).with(:b64_zlib_yaml).returns true
|
90
|
-
facts.expects(:render).with(:b64_zlib_yaml).returns "my text"
|
91
|
-
text = CGI.escape("my text")
|
92
|
-
|
93
|
-
@facthandler.expects(:find_facts).returns facts
|
94
|
-
|
95
|
-
@facthandler.facts_for_uploading
|
96
|
-
end
|
97
|
-
|
98
|
-
it "should use yaml as the serialization if zlib is not supported" do
|
99
|
-
facts = stub 'facts'
|
100
|
-
facts.expects(:support_format?).with(:b64_zlib_yaml).returns false
|
101
|
-
facts.expects(:render).with(:yaml).returns "my text"
|
102
|
-
text = CGI.escape("my text")
|
103
|
-
|
104
|
-
@facthandler.expects(:find_facts).returns facts
|
71
|
+
facts = Puppet::Node::Facts.new('foo', 'afact' => 'a+b')
|
72
|
+
Puppet::Node::Facts.indirection.save(facts)
|
73
|
+
text = CGI.escape(@facthandler.find_facts.render(:pson))
|
105
74
|
|
106
|
-
@facthandler.facts_for_uploading
|
75
|
+
@facthandler.facts_for_uploading.should == {:facts_format => :pson, :facts => text}
|
107
76
|
end
|
108
77
|
end
|
@@ -104,7 +104,7 @@ describe Puppet::Configurer do
|
|
104
104
|
@agent.run(:pluginsync => false)
|
105
105
|
end
|
106
106
|
|
107
|
-
it "should carry on when it can't fetch
|
107
|
+
it "should carry on when it can't fetch its node definition" do
|
108
108
|
error = Net::HTTPError.new(400, 'dummy server communication error')
|
109
109
|
Puppet::Node.indirection.expects(:find).raises(error)
|
110
110
|
@agent.run.should == 0
|
@@ -137,20 +137,17 @@ describe Puppet::Configurer do
|
|
137
137
|
|
138
138
|
it "should use the provided report if it was passed one" do
|
139
139
|
report = Puppet::Transaction::Report.new("apply")
|
140
|
-
|
141
|
-
@catalog.expects(:apply).with{|options| options[:report] == report}
|
140
|
+
@catalog.expects(:apply).with {|options| options[:report] == report}
|
142
141
|
|
143
142
|
@agent.run(:report => report)
|
144
143
|
end
|
145
144
|
|
146
145
|
it "should set the report as a log destination" do
|
147
146
|
report = Puppet::Transaction::Report.new("apply")
|
148
|
-
Puppet::Transaction::Report.expects(:new).returns report
|
149
147
|
|
150
|
-
|
151
|
-
Puppet::Util::Log.expects(:close).with(report)
|
148
|
+
report.expects(:<<).with(instance_of(Puppet::Util::Log)).at_least_once
|
152
149
|
|
153
|
-
@agent.run
|
150
|
+
@agent.run(:report => report)
|
154
151
|
end
|
155
152
|
|
156
153
|
it "should retrieve the catalog" do
|
@@ -480,6 +477,25 @@ describe Puppet::Configurer do
|
|
480
477
|
Puppet.expects(:err)
|
481
478
|
expect { @configurer.save_last_run_summary(@report) }.to_not raise_error
|
482
479
|
end
|
480
|
+
|
481
|
+
it "should create the last run file with the correct mode" do
|
482
|
+
Puppet.settings.setting(:lastrunfile).expects(:mode).returns('664')
|
483
|
+
@configurer.save_last_run_summary(@report)
|
484
|
+
|
485
|
+
if Puppet::Util::Platform.windows?
|
486
|
+
require 'puppet/util/windows/security'
|
487
|
+
mode = Puppet::Util::Windows::Security.get_mode(Puppet[:lastrunfile])
|
488
|
+
else
|
489
|
+
mode = File.stat(Puppet[:lastrunfile]).mode
|
490
|
+
end
|
491
|
+
(mode & 0777).should == 0664
|
492
|
+
end
|
493
|
+
|
494
|
+
it "should report invalid last run file permissions" do
|
495
|
+
Puppet.settings.setting(:lastrunfile).expects(:mode).returns('892')
|
496
|
+
Puppet.expects(:err).with(regexp_matches(/Could not save last run local report.*892 is invalid/))
|
497
|
+
@configurer.save_last_run_summary(@report)
|
498
|
+
end
|
483
499
|
end
|
484
500
|
|
485
501
|
describe "when retrieving a catalog" do
|
data/spec/unit/daemon_spec.rb
CHANGED
@@ -19,24 +19,29 @@ end
|
|
19
19
|
describe Puppet::Daemon, :unless => Puppet.features.microsoft_windows? do
|
20
20
|
include PuppetSpec::Files
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
@agent = Puppet::Agent.new(TestClient.new, false)
|
25
|
-
@daemon = Puppet::Daemon.new
|
26
|
-
@daemon.stubs(:close_streams).returns nil
|
27
|
-
end
|
22
|
+
class RecordingScheduler
|
23
|
+
attr_reader :jobs
|
28
24
|
|
29
|
-
|
30
|
-
|
25
|
+
def run_loop(jobs)
|
26
|
+
@jobs = jobs
|
27
|
+
end
|
31
28
|
end
|
32
29
|
|
33
|
-
|
34
|
-
|
30
|
+
let(:server) { stub("Server", :start => nil, :wait_for_shutdown => nil) }
|
31
|
+
let(:agent) { Puppet::Agent.new(TestClient.new, false) }
|
32
|
+
|
33
|
+
let(:pidfile) { stub("PidFile", :lock => true, :unlock => true, :file_path => 'fake.pid') }
|
34
|
+
let(:scheduler) { RecordingScheduler.new }
|
35
|
+
|
36
|
+
let(:daemon) { Puppet::Daemon.new(pidfile, scheduler) }
|
37
|
+
|
38
|
+
before do
|
39
|
+
daemon.stubs(:close_streams).returns nil
|
35
40
|
end
|
36
41
|
|
37
42
|
it "should reopen the Log logs when told to reopen logs" do
|
38
43
|
Puppet::Util::Log.expects(:reopen)
|
39
|
-
|
44
|
+
daemon.reopen_logs
|
40
45
|
end
|
41
46
|
|
42
47
|
let(:server) { stub("Server", :start => nil, :wait_for_shutdown => nil) }
|
@@ -50,52 +55,81 @@ describe Puppet::Daemon, :unless => Puppet.features.microsoft_windows? do
|
|
50
55
|
|
51
56
|
Puppet.expects(:notice)
|
52
57
|
|
53
|
-
|
58
|
+
daemon.expects(method)
|
54
59
|
|
55
|
-
|
60
|
+
daemon.set_signal_traps
|
56
61
|
end
|
57
62
|
end
|
58
63
|
end
|
59
64
|
|
60
65
|
describe "when starting" do
|
61
66
|
before do
|
62
|
-
|
63
|
-
@daemon.stubs(:set_signal_traps)
|
64
|
-
@daemon.stubs(:run_event_loop)
|
67
|
+
daemon.stubs(:set_signal_traps)
|
65
68
|
end
|
66
69
|
|
67
70
|
it "should fail if it has neither agent nor server" do
|
68
|
-
|
71
|
+
expect { daemon.start }.to raise_error(Puppet::DevError)
|
69
72
|
end
|
70
73
|
|
71
74
|
it "should create its pidfile" do
|
72
|
-
|
75
|
+
pidfile.expects(:lock).returns(true)
|
73
76
|
|
74
|
-
|
75
|
-
|
77
|
+
daemon.agent = agent
|
78
|
+
daemon.start
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should fail if it cannot lock" do
|
82
|
+
pidfile.expects(:lock).returns(false)
|
83
|
+
daemon.agent = agent
|
84
|
+
|
85
|
+
expect { daemon.start }.to raise_error(RuntimeError, "Could not create PID file: #{pidfile.file_path}")
|
76
86
|
end
|
77
87
|
|
78
88
|
it "should start its server if one is configured" do
|
79
|
-
|
89
|
+
daemon.server = server
|
80
90
|
|
81
91
|
server.expects(:start)
|
82
|
-
@daemon.stubs(:server).returns server
|
83
92
|
|
84
|
-
|
93
|
+
daemon.start
|
94
|
+
end
|
95
|
+
|
96
|
+
it "disables the reparse of configs if the filetimeout is 0" do
|
97
|
+
Puppet[:filetimeout] = 0
|
98
|
+
daemon.agent = agent
|
99
|
+
|
100
|
+
daemon.start
|
101
|
+
|
102
|
+
scheduler.jobs[0].should_not be_enabled
|
103
|
+
end
|
104
|
+
|
105
|
+
it "disables the agent run when there is no agent" do
|
106
|
+
Puppet[:filetimeout] = 0
|
107
|
+
daemon.server = server
|
108
|
+
|
109
|
+
daemon.start
|
110
|
+
|
111
|
+
scheduler.jobs[1].should_not be_enabled
|
112
|
+
end
|
113
|
+
|
114
|
+
it "waits for the server to shutdown when there is one" do
|
115
|
+
daemon.server = server
|
116
|
+
|
117
|
+
server.expects(:wait_for_shutdown)
|
118
|
+
|
119
|
+
daemon.start
|
85
120
|
end
|
86
121
|
|
87
122
|
it "waits for the server to shutdown when there is one" do
|
88
|
-
|
123
|
+
daemon.server = server
|
89
124
|
|
90
125
|
server.expects(:wait_for_shutdown)
|
91
126
|
|
92
|
-
|
127
|
+
daemon.start
|
93
128
|
end
|
94
129
|
end
|
95
130
|
|
96
131
|
describe "when stopping" do
|
97
132
|
before do
|
98
|
-
@daemon.stubs(:remove_pidfile)
|
99
133
|
Puppet::Util::Log.stubs(:close_all)
|
100
134
|
# to make the global safe to mock, set it to a subclass of itself,
|
101
135
|
# then restore it in an after pass
|
@@ -109,115 +143,57 @@ describe Puppet::Daemon, :unless => Puppet.features.microsoft_windows? do
|
|
109
143
|
|
110
144
|
it "should stop its server if one is configured" do
|
111
145
|
server.expects(:stop)
|
112
|
-
|
113
|
-
|
146
|
+
|
147
|
+
daemon.server = server
|
148
|
+
|
149
|
+
expect { daemon.stop }.to exit_with 0
|
114
150
|
end
|
115
151
|
|
116
152
|
it 'should request a stop from Puppet::Application' do
|
117
153
|
Puppet::Application.expects(:stop!)
|
118
|
-
expect {
|
154
|
+
expect { daemon.stop }.to exit_with 0
|
119
155
|
end
|
120
156
|
|
121
157
|
it "should remove its pidfile" do
|
122
|
-
|
123
|
-
|
158
|
+
pidfile.expects(:unlock)
|
159
|
+
|
160
|
+
expect { daemon.stop }.to exit_with 0
|
124
161
|
end
|
125
162
|
|
126
163
|
it "should close all logs" do
|
127
164
|
Puppet::Util::Log.expects(:close_all)
|
128
|
-
expect {
|
165
|
+
expect { daemon.stop }.to exit_with 0
|
129
166
|
end
|
130
167
|
|
131
168
|
it "should exit unless called with ':exit => false'" do
|
132
|
-
expect {
|
169
|
+
expect { daemon.stop }.to exit_with 0
|
133
170
|
end
|
134
171
|
|
135
172
|
it "should not exit if called with ':exit => false'" do
|
136
|
-
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
describe "when creating its pidfile" do
|
141
|
-
it "should use an exclusive mutex" do
|
142
|
-
Puppet.run_mode.expects(:name).returns "me"
|
143
|
-
Puppet::Util.expects(:synchronize_on).with("me",Sync::EX)
|
144
|
-
@daemon.create_pidfile
|
145
|
-
end
|
146
|
-
|
147
|
-
it "should lock the pidfile using the Pidlock class" do
|
148
|
-
pidfile = mock 'pidfile'
|
149
|
-
|
150
|
-
Puppet.run_mode.expects(:name).returns "eh"
|
151
|
-
Puppet[:pidfile] = make_absolute("/my/file")
|
152
|
-
|
153
|
-
Puppet::Util::Pidlock.expects(:new).with(make_absolute("/my/file")).returns pidfile
|
154
|
-
|
155
|
-
pidfile.expects(:lock).returns true
|
156
|
-
@daemon.create_pidfile
|
157
|
-
end
|
158
|
-
|
159
|
-
it "should fail if it cannot lock" do
|
160
|
-
pidfile = mock 'pidfile'
|
161
|
-
|
162
|
-
Puppet.run_mode.expects(:name).returns "eh"
|
163
|
-
Puppet[:pidfile] = make_absolute("/my/file")
|
164
|
-
|
165
|
-
Puppet::Util::Pidlock.expects(:new).with(make_absolute("/my/file")).returns pidfile
|
166
|
-
|
167
|
-
pidfile.expects(:lock).returns false
|
168
|
-
|
169
|
-
lambda { @daemon.create_pidfile }.should raise_error
|
170
|
-
end
|
171
|
-
end
|
172
|
-
|
173
|
-
describe "when removing its pidfile" do
|
174
|
-
it "should use an exclusive mutex" do
|
175
|
-
Puppet.run_mode.expects(:name).returns "me"
|
176
|
-
|
177
|
-
Puppet::Util.expects(:synchronize_on).with("me",Sync::EX)
|
178
|
-
|
179
|
-
@daemon.remove_pidfile
|
180
|
-
end
|
181
|
-
|
182
|
-
it "should do nothing if the pidfile is not present" do
|
183
|
-
pidfile = mock 'pidfile', :unlock => false
|
184
|
-
|
185
|
-
Puppet[:pidfile] = make_absolute("/my/file")
|
186
|
-
Puppet::Util::Pidlock.expects(:new).with(make_absolute("/my/file")).returns pidfile
|
187
|
-
|
188
|
-
@daemon.remove_pidfile
|
189
|
-
end
|
190
|
-
|
191
|
-
it "should unlock the pidfile using the Pidlock class" do
|
192
|
-
pidfile = mock 'pidfile', :unlock => true
|
193
|
-
|
194
|
-
Puppet[:pidfile] = make_absolute("/my/file")
|
195
|
-
Puppet::Util::Pidlock.expects(:new).with(make_absolute("/my/file")).returns pidfile
|
196
|
-
|
197
|
-
@daemon.remove_pidfile
|
173
|
+
daemon.stop :exit => false
|
198
174
|
end
|
199
175
|
end
|
200
176
|
|
201
177
|
describe "when reloading" do
|
202
178
|
it "should do nothing if no agent is configured" do
|
203
|
-
|
179
|
+
daemon.reload
|
204
180
|
end
|
205
181
|
|
206
182
|
it "should do nothing if the agent is running" do
|
207
|
-
|
183
|
+
agent.expects(:running?).returns true
|
208
184
|
|
209
|
-
|
185
|
+
daemon.agent = agent
|
210
186
|
|
211
|
-
|
187
|
+
daemon.reload
|
212
188
|
end
|
213
189
|
|
214
190
|
it "should run the agent if one is available and it is not running" do
|
215
|
-
|
216
|
-
|
191
|
+
agent.expects(:running?).returns false
|
192
|
+
agent.expects(:run).with({:splay => false})
|
217
193
|
|
218
|
-
|
194
|
+
daemon.agent = agent
|
219
195
|
|
220
|
-
|
196
|
+
daemon.reload
|
221
197
|
end
|
222
198
|
end
|
223
199
|
|
@@ -232,48 +208,48 @@ describe Puppet::Daemon, :unless => Puppet.features.microsoft_windows? do
|
|
232
208
|
|
233
209
|
it 'should set Puppet::Application.restart!' do
|
234
210
|
Puppet::Application.expects(:restart!)
|
235
|
-
|
236
|
-
|
211
|
+
daemon.stubs(:reexec)
|
212
|
+
daemon.restart
|
237
213
|
end
|
238
214
|
|
239
215
|
it "should reexec itself if no agent is available" do
|
240
|
-
|
216
|
+
daemon.expects(:reexec)
|
241
217
|
|
242
|
-
|
218
|
+
daemon.restart
|
243
219
|
end
|
244
220
|
|
245
221
|
it "should reexec itself if the agent is not running" do
|
246
|
-
|
247
|
-
|
248
|
-
|
222
|
+
agent.expects(:running?).returns false
|
223
|
+
daemon.agent = agent
|
224
|
+
daemon.expects(:reexec)
|
249
225
|
|
250
|
-
|
226
|
+
daemon.restart
|
251
227
|
end
|
252
228
|
end
|
253
229
|
|
254
230
|
describe "when reexecing it self" do
|
255
231
|
before do
|
256
|
-
|
257
|
-
|
232
|
+
daemon.stubs(:exec)
|
233
|
+
daemon.stubs(:stop)
|
258
234
|
end
|
259
235
|
|
260
236
|
it "should fail if no argv values are available" do
|
261
|
-
|
262
|
-
lambda {
|
237
|
+
daemon.expects(:argv).returns nil
|
238
|
+
lambda { daemon.reexec }.should raise_error(Puppet::DevError)
|
263
239
|
end
|
264
240
|
|
265
241
|
it "should shut down without exiting" do
|
266
|
-
|
267
|
-
|
242
|
+
daemon.argv = %w{foo}
|
243
|
+
daemon.expects(:stop).with(:exit => false)
|
268
244
|
|
269
|
-
|
245
|
+
daemon.reexec
|
270
246
|
end
|
271
247
|
|
272
248
|
it "should call 'exec' with the original executable and arguments" do
|
273
|
-
|
274
|
-
|
249
|
+
daemon.argv = %w{foo}
|
250
|
+
daemon.expects(:exec).with($0 + " foo")
|
275
251
|
|
276
|
-
|
252
|
+
daemon.reexec
|
277
253
|
end
|
278
254
|
end
|
279
255
|
end
|