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
@@ -2,105 +2,93 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
require 'shared_behaviours/all_parsedfile_providers'
|
4
4
|
|
5
|
-
|
5
|
+
describe Puppet::Type.type(:mount).provider(:parsed), :unless => Puppet.features.microsoft_windows? do
|
6
6
|
|
7
|
-
|
7
|
+
let :vfstab_sample do
|
8
|
+
"/dev/dsk/c0d0s0 /dev/rdsk/c0d0s0 \t\t / \t ufs 1 no\t-"
|
9
|
+
end
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
@provider = @mount_class.provider(:parsed)
|
11
|
+
let :fstab_sample do
|
12
|
+
"/dev/vg00/lv01\t/spare \t \t ext3 defaults\t1 2"
|
12
13
|
end
|
13
14
|
|
14
15
|
# LAK:FIXME I can't mock Facter because this test happens at parse-time.
|
15
16
|
it "should default to /etc/vfstab on Solaris" do
|
16
17
|
pending "This test only works on Solaris" unless Facter.value(:osfamily) == 'Solaris'
|
17
|
-
|
18
|
+
described_class.default_target.should == '/etc/vfstab'
|
18
19
|
end
|
19
20
|
|
20
21
|
it "should default to /etc/fstab on anything else" do
|
21
22
|
pending "This test does not work on Solaris" if Facter.value(:osfamily) == 'Solaris'
|
22
|
-
|
23
|
+
described_class.default_target.should == '/etc/fstab'
|
23
24
|
end
|
24
25
|
|
25
26
|
describe "when parsing a line" do
|
26
|
-
|
27
27
|
it "should not crash on incomplete lines in fstab" do
|
28
|
-
parse =
|
28
|
+
parse = described_class.parse <<-FSTAB
|
29
29
|
/dev/incomplete
|
30
30
|
/dev/device name
|
31
31
|
FSTAB
|
32
|
-
|
32
|
+
expect { described_class.to_line(parse[0]) }.to_not raise_error
|
33
33
|
end
|
34
34
|
|
35
35
|
# it_should_behave_like "all parsedfile providers",
|
36
36
|
# provider_class, my_fixtures('*.fstab')
|
37
37
|
|
38
38
|
describe "on Solaris", :if => Facter.value(:osfamily) == 'Solaris' do
|
39
|
-
|
40
|
-
before :each do
|
41
|
-
@example_line = "/dev/dsk/c0d0s0 /dev/rdsk/c0d0s0 \t\t / \t ufs 1 no\t-"
|
42
|
-
end
|
43
|
-
|
44
39
|
it "should extract device from the first field" do
|
45
|
-
|
40
|
+
described_class.parse_line(vfstab_sample)[:device].should == '/dev/dsk/c0d0s0'
|
46
41
|
end
|
47
42
|
|
48
43
|
it "should extract blockdevice from second field" do
|
49
|
-
|
44
|
+
described_class.parse_line(vfstab_sample)[:blockdevice].should == "/dev/rdsk/c0d0s0"
|
50
45
|
end
|
51
46
|
|
52
47
|
it "should extract name from third field" do
|
53
|
-
|
48
|
+
described_class.parse_line(vfstab_sample)[:name].should == "/"
|
54
49
|
end
|
55
50
|
|
56
51
|
it "should extract fstype from fourth field" do
|
57
|
-
|
52
|
+
described_class.parse_line(vfstab_sample)[:fstype].should == "ufs"
|
58
53
|
end
|
59
54
|
|
60
55
|
it "should extract pass from fifth field" do
|
61
|
-
|
56
|
+
described_class.parse_line(vfstab_sample)[:pass].should == "1"
|
62
57
|
end
|
63
58
|
|
64
59
|
it "should extract atboot from sixth field" do
|
65
|
-
|
60
|
+
described_class.parse_line(vfstab_sample)[:atboot].should == "no"
|
66
61
|
end
|
67
62
|
|
68
63
|
it "should extract options from seventh field" do
|
69
|
-
|
64
|
+
described_class.parse_line(vfstab_sample)[:options].should == "-"
|
70
65
|
end
|
71
|
-
|
72
66
|
end
|
73
67
|
|
74
68
|
describe "on other platforms than Solaris", :if => Facter.value(:osfamily) != 'Solaris' do
|
75
|
-
|
76
|
-
before :each do
|
77
|
-
@example_line = "/dev/vg00/lv01\t/spare \t \t ext3 defaults\t1 2"
|
78
|
-
end
|
79
|
-
|
80
69
|
it "should extract device from the first field" do
|
81
|
-
|
70
|
+
described_class.parse_line(fstab_sample)[:device].should == '/dev/vg00/lv01'
|
82
71
|
end
|
83
72
|
|
84
73
|
it "should extract name from second field" do
|
85
|
-
|
74
|
+
described_class.parse_line(fstab_sample)[:name].should == "/spare"
|
86
75
|
end
|
87
76
|
|
88
77
|
it "should extract fstype from third field" do
|
89
|
-
|
78
|
+
described_class.parse_line(fstab_sample)[:fstype].should == "ext3"
|
90
79
|
end
|
91
80
|
|
92
81
|
it "should extract options from fourth field" do
|
93
|
-
|
82
|
+
described_class.parse_line(fstab_sample)[:options].should == "defaults"
|
94
83
|
end
|
95
84
|
|
96
85
|
it "should extract dump from fifth field" do
|
97
|
-
|
86
|
+
described_class.parse_line(fstab_sample)[:dump].should == "1"
|
98
87
|
end
|
99
88
|
|
100
89
|
it "should extract options from sixth field" do
|
101
|
-
|
90
|
+
described_class.parse_line(fstab_sample)[:pass].should == "2"
|
102
91
|
end
|
103
|
-
|
104
92
|
end
|
105
93
|
|
106
94
|
end
|
@@ -108,8 +96,8 @@ FSTAB
|
|
108
96
|
describe "mountinstances" do
|
109
97
|
it "should get name from mountoutput found on Solaris" do
|
110
98
|
Facter.stubs(:value).with(:osfamily).returns 'Solaris'
|
111
|
-
|
112
|
-
mounts =
|
99
|
+
described_class.stubs(:mountcmd).returns(File.read(my_fixture('solaris.mount')))
|
100
|
+
mounts = described_class.mountinstances
|
113
101
|
mounts.size.should == 6
|
114
102
|
mounts[0].should == { :name => '/', :mounted => :yes }
|
115
103
|
mounts[1].should == { :name => '/proc', :mounted => :yes }
|
@@ -121,8 +109,8 @@ FSTAB
|
|
121
109
|
|
122
110
|
it "should get name from mountoutput found on HP-UX" do
|
123
111
|
Facter.stubs(:value).with(:osfamily).returns 'HP-UX'
|
124
|
-
|
125
|
-
mounts =
|
112
|
+
described_class.stubs(:mountcmd).returns(File.read(my_fixture('hpux.mount')))
|
113
|
+
mounts = described_class.mountinstances
|
126
114
|
mounts.size.should == 17
|
127
115
|
mounts[0].should == { :name => '/', :mounted => :yes }
|
128
116
|
mounts[1].should == { :name => '/devices', :mounted => :yes }
|
@@ -145,8 +133,8 @@ FSTAB
|
|
145
133
|
|
146
134
|
it "should get name from mountoutput found on Darwin" do
|
147
135
|
Facter.stubs(:value).with(:osfamily).returns 'Darwin'
|
148
|
-
|
149
|
-
mounts =
|
136
|
+
described_class.stubs(:mountcmd).returns(File.read(my_fixture('darwin.mount')))
|
137
|
+
mounts = described_class.mountinstances
|
150
138
|
mounts.size.should == 6
|
151
139
|
mounts[0].should == { :name => '/', :mounted => :yes }
|
152
140
|
mounts[1].should == { :name => '/dev', :mounted => :yes }
|
@@ -158,8 +146,8 @@ FSTAB
|
|
158
146
|
|
159
147
|
it "should get name from mountoutput found on Linux" do
|
160
148
|
Facter.stubs(:value).with(:osfamily).returns 'Gentoo'
|
161
|
-
|
162
|
-
mounts =
|
149
|
+
described_class.stubs(:mountcmd).returns(File.read(my_fixture('linux.mount')))
|
150
|
+
mounts = described_class.mountinstances
|
163
151
|
mounts[0].should == { :name => '/', :mounted => :yes }
|
164
152
|
mounts[1].should == { :name => '/lib64/rc/init.d', :mounted => :yes }
|
165
153
|
mounts[2].should == { :name => '/sys', :mounted => :yes }
|
@@ -169,8 +157,8 @@ FSTAB
|
|
169
157
|
|
170
158
|
it "should get name from mountoutput found on AIX" do
|
171
159
|
Facter.stubs(:value).with(:osfamily).returns 'AIX'
|
172
|
-
|
173
|
-
mounts =
|
160
|
+
described_class.stubs(:mountcmd).returns(File.read(my_fixture('aix.mount')))
|
161
|
+
mounts = described_class.mountinstances
|
174
162
|
mounts[0].should == { :name => '/', :mounted => :yes }
|
175
163
|
mounts[1].should == { :name => '/tmp', :mounted => :yes }
|
176
164
|
mounts[2].should == { :name => '/home', :mounted => :yes }
|
@@ -179,8 +167,8 @@ FSTAB
|
|
179
167
|
end
|
180
168
|
|
181
169
|
it "should raise an error if a line is not understandable" do
|
182
|
-
|
183
|
-
|
170
|
+
described_class.stubs(:mountcmd).returns("bazinga!")
|
171
|
+
expect { described_class.mountinstances }.to raise_error Puppet::Error, 'Could not understand line bazinga! from mount output'
|
184
172
|
end
|
185
173
|
|
186
174
|
end
|
@@ -203,7 +191,7 @@ FSTAB
|
|
203
191
|
# Stub the mount output to our fixture.
|
204
192
|
begin
|
205
193
|
mount = my_fixture(platform + '.mount')
|
206
|
-
|
194
|
+
described_class.stubs(:mountcmd).returns File.read(mount)
|
207
195
|
rescue
|
208
196
|
pending "is #{platform}.mount missing at this point?"
|
209
197
|
end
|
@@ -211,8 +199,8 @@ FSTAB
|
|
211
199
|
# Note: we have to stub default_target before creating resources
|
212
200
|
# because it is used by Puppet::Type::Mount.new to populate the
|
213
201
|
# :target property.
|
214
|
-
|
215
|
-
@retrieve =
|
202
|
+
described_class.stubs(:default_target).returns fstab
|
203
|
+
@retrieve = described_class.instances.collect { |prov| {:name => prov.get(:name), :ensure => prov.get(:ensure)}}
|
216
204
|
end
|
217
205
|
|
218
206
|
# Following mountpoint are present in all fstabs/mountoutputs
|
@@ -246,7 +234,7 @@ FSTAB
|
|
246
234
|
# Stub the mount output to our fixture.
|
247
235
|
begin
|
248
236
|
mount = my_fixture(platform + '.mount')
|
249
|
-
|
237
|
+
described_class.stubs(:mountcmd).returns File.read(mount)
|
250
238
|
rescue
|
251
239
|
pending "is #{platform}.mount missing at this point?"
|
252
240
|
end
|
@@ -254,7 +242,7 @@ FSTAB
|
|
254
242
|
# Note: we have to stub default_target before creating resources
|
255
243
|
# because it is used by Puppet::Type::Mount.new to populate the
|
256
244
|
# :target property.
|
257
|
-
|
245
|
+
described_class.stubs(:default_target).returns fstab
|
258
246
|
|
259
247
|
@res_ghost = Puppet::Type::Mount.new(:name => '/ghost') # in no fake fstab
|
260
248
|
@res_mounted = Puppet::Type::Mount.new(:name => '/') # in every fake fstab
|
@@ -270,24 +258,24 @@ FSTAB
|
|
270
258
|
|
271
259
|
it "should set :ensure to :unmounted if found in fstab but not mounted" do
|
272
260
|
pending("Solaris:Unable to stub Operating System Fact at runtime", :if => Facter.value(:osfamily) == "Solaris")
|
273
|
-
|
261
|
+
described_class.prefetch(@resource_hash)
|
274
262
|
@res_unmounted.provider.get(:ensure).should == :unmounted
|
275
263
|
end
|
276
264
|
|
277
265
|
it "should set :ensure to :ghost if not found in fstab but mounted" do
|
278
266
|
pending("Solaris:Unable to stub Operating System Fact at runtime", :if => Facter.value(:osfamily) == "Solaris")
|
279
|
-
|
267
|
+
described_class.prefetch(@resource_hash)
|
280
268
|
@res_ghost.provider.get(:ensure).should == :ghost
|
281
269
|
end
|
282
270
|
|
283
271
|
it "should set :ensure to :mounted if found in fstab and mounted" do
|
284
272
|
pending("Solaris:Unable to stub Operating System Fact at runtime", :if => Facter.value(:osfamily) == "Solaris")
|
285
|
-
|
273
|
+
described_class.prefetch(@resource_hash)
|
286
274
|
@res_mounted.provider.get(:ensure).should == :mounted
|
287
275
|
end
|
288
276
|
|
289
277
|
it "should set :ensure to :absent if not found in fstab and not mounted" do
|
290
|
-
|
278
|
+
described_class.prefetch(@resource_hash)
|
291
279
|
@res_absent.provider.get(:ensure).should == :absent
|
292
280
|
end
|
293
281
|
end
|
@@ -29,9 +29,18 @@ describe Puppet::Provider::Mount do
|
|
29
29
|
@mounter.mount
|
30
30
|
end
|
31
31
|
|
32
|
-
it "should add the options following '-o' if they exist and are not set to :absent" do
|
32
|
+
it "should add the options following '-o' on MacOS if they exist and are not set to :absent" do
|
33
|
+
Facter.expects(:value).with(:kernel).returns 'Darwin'
|
33
34
|
@mounter.stubs(:options).returns("ro")
|
34
|
-
@mounter.expects(:mountcmd).with
|
35
|
+
@mounter.expects(:mountcmd).with '-o', 'ro', '/'
|
36
|
+
|
37
|
+
@mounter.mount
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should not explicitly pass mount options on systems other than MacOS" do
|
41
|
+
Facter.expects(:value).with(:kernel).returns 'HP-UX'
|
42
|
+
@mounter.stubs(:options).returns("ro")
|
43
|
+
@mounter.expects(:mountcmd).with '/'
|
35
44
|
|
36
45
|
@mounter.mount
|
37
46
|
end
|
@@ -55,3 +55,11 @@ describe Puppet::Provider::Naginator do
|
|
55
55
|
@class.should_not be_skip_record("foo")
|
56
56
|
end
|
57
57
|
end
|
58
|
+
|
59
|
+
describe Nagios::Base do
|
60
|
+
it "should not turn set parameters into arrays #17871" do
|
61
|
+
obj = Nagios::Base.create('host')
|
62
|
+
obj.host_name = "my_hostname"
|
63
|
+
obj.host_name.should == "my_hostname"
|
64
|
+
end
|
65
|
+
end
|
@@ -8,7 +8,11 @@ describe provider do
|
|
8
8
|
@resource = stub 'resource', :[] => "asdf"
|
9
9
|
@provider = provider.new(@resource)
|
10
10
|
|
11
|
-
@fakeresult =
|
11
|
+
@fakeresult = <<-EOF
|
12
|
+
install ok installed asdf 1.0 "asdf summary
|
13
|
+
asdf multiline description
|
14
|
+
with multiple lines
|
15
|
+
EOF
|
12
16
|
end
|
13
17
|
|
14
18
|
it "should be versionable" do
|
@@ -10,13 +10,17 @@ describe Puppet::Type.type(:package).provider(:aptitude) do
|
|
10
10
|
it { should be_versionable }
|
11
11
|
|
12
12
|
context "when retrieving ensure" do
|
13
|
-
|
14
|
-
|
13
|
+
before do
|
14
|
+
described_class.stubs(:command).with(:dpkgquery).returns 'myquery'
|
15
|
+
end
|
16
|
+
|
17
|
+
{ :absent => "deinstall ok config-files faff 1.2.3-1 :DESC: faff summary\n:DESC:\n",
|
18
|
+
"1.2.3-1" => "install ok installed faff 1.2.3-1 :DESC: faff summary\n:DESC:\n",
|
15
19
|
}.each do |expect, output|
|
16
20
|
it "should detect #{expect} packages" do
|
17
|
-
|
18
|
-
with('-W', '--showformat', '${Status} ${Package} ${Version}
|
19
|
-
|
21
|
+
Puppet::Util::Execution.expects(:execpipe).
|
22
|
+
with(['myquery', '-W', '--showformat', "'${Status} ${Package} ${Version} :DESC: ${Description}\\n:DESC:\\n'", 'faff']).
|
23
|
+
yields(StringIO.new(output))
|
20
24
|
|
21
25
|
pkg.property(:ensure).retrieve.should == expect
|
22
26
|
end
|
@@ -19,7 +19,7 @@ describe Puppet::Type.type(:package).provider(:aptrpm) do
|
|
19
19
|
def rpm
|
20
20
|
pkg.provider.expects(:rpm).
|
21
21
|
with('-q', 'faff', '--nosignature', '--nodigest', '--qf',
|
22
|
-
"%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}
|
22
|
+
"'%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH} :DESC: %{SUMMARY}\\n'")
|
23
23
|
end
|
24
24
|
|
25
25
|
it "should report absent packages" do
|
@@ -28,7 +28,7 @@ describe Puppet::Type.type(:package).provider(:aptrpm) do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
it "should report present packages correctly" do
|
31
|
-
rpm.returns("faff-1.2.3-1 0 1.2.3-1 5 i686\n")
|
31
|
+
rpm.returns("faff-1.2.3-1 0 1.2.3-1 5 i686 :DESC: faff desc\n")
|
32
32
|
pkg.property(:ensure).retrieve.should == "1.2.3-1-5"
|
33
33
|
end
|
34
34
|
end
|
@@ -2,226 +2,401 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
require 'stringio'
|
4
4
|
|
5
|
-
|
5
|
+
provider_class = Puppet::Type.type(:package).provider(:dpkg)
|
6
|
+
|
7
|
+
describe provider_class do
|
8
|
+
let(:bash_version) { '4.2-5ubuntu3' }
|
9
|
+
let(:bash_installed_output) do <<-EOS
|
10
|
+
install ok installed bash #{bash_version} :DESC: GNU Bourne Again SHell
|
11
|
+
Bash is an sh-compatible command language interpreter that executes
|
12
|
+
commands read from the standard input or from a file. Bash also
|
13
|
+
incorporates useful features from the Korn and C shells (ksh and csh).
|
14
|
+
.
|
15
|
+
Bash is ultimately intended to be a conformant implementation of the
|
16
|
+
IEEE POSIX Shell and Tools specification (IEEE Working Group 1003.2).
|
17
|
+
.
|
18
|
+
The Programmable Completion Code, by Ian Macdonald, is now found in
|
19
|
+
the bash-completion package.
|
20
|
+
:DESC:
|
21
|
+
EOS
|
22
|
+
end
|
23
|
+
let(:bash_installed_io) { StringIO.new(bash_installed_output) }
|
24
|
+
|
25
|
+
let(:vim_installed_output) do <<-EOS
|
26
|
+
install ok installed vim 2:7.3.547-6ubuntu5 :DESC: Vi IMproved - enhanced vi editor
|
27
|
+
Vim is an almost compatible version of the UNIX editor Vi.
|
28
|
+
.
|
29
|
+
Many new features have been added: multi level undo, syntax
|
30
|
+
highlighting, command line history, on-line help, filename
|
31
|
+
completion, block operations, folding, Unicode support, etc.
|
32
|
+
.
|
33
|
+
This package contains a version of vim compiled with a rather
|
34
|
+
standard set of features. This package does not provide a GUI
|
35
|
+
version of Vim. See the other vim-* packages if you need more
|
36
|
+
(or less).
|
37
|
+
:DESC:
|
38
|
+
EOS
|
39
|
+
end
|
6
40
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
41
|
+
let(:all_installed_io) { StringIO.new([bash_installed_output, vim_installed_output].join) }
|
42
|
+
let(:args) { ['myquery', '-W', '--showformat', %Q{'${Status} ${Package} ${Version} :DESC: ${Description}\\n:DESC:\\n'}] }
|
43
|
+
let(:resource_name) { 'package' }
|
44
|
+
let(:resource) { stub 'resource', :[] => resource_name }
|
45
|
+
let(:provider) { provider_class.new(resource) }
|
12
46
|
|
13
|
-
|
47
|
+
before do
|
48
|
+
provider_class.stubs(:command).with(:dpkgquery).returns 'myquery'
|
14
49
|
end
|
15
50
|
|
16
51
|
it "should have documentation" do
|
17
|
-
|
52
|
+
provider_class.doc.should be_instance_of(String)
|
18
53
|
end
|
19
54
|
|
20
55
|
describe "when listing all instances" do
|
21
|
-
before do
|
22
|
-
provider.stubs(:command).with(:dpkgquery).returns "myquery"
|
23
|
-
end
|
24
56
|
|
25
57
|
it "should use dpkg-query" do
|
26
|
-
|
27
|
-
Puppet::Util::Execution.expects(:execpipe).with("myquery -W --showformat '${Status} ${Package} ${Version}\\n'").yields StringIO.new(@fakeresult)
|
58
|
+
Puppet::Util::Execution.expects(:execpipe).with(args).yields bash_installed_io
|
28
59
|
|
29
|
-
|
60
|
+
provider_class.instances
|
30
61
|
end
|
31
62
|
|
32
|
-
it "should create and return an instance
|
33
|
-
|
34
|
-
pipe.expects(:each).never
|
35
|
-
pipe.expects(:each_line).yields @fakeresult
|
36
|
-
Puppet::Util::Execution.expects(:execpipe).yields pipe
|
63
|
+
it "should create and return an instance for a single dpkg-query entry" do
|
64
|
+
Puppet::Util::Execution.expects(:execpipe).with(args).yields bash_installed_io
|
37
65
|
|
38
|
-
|
39
|
-
|
66
|
+
installed = mock 'bash'
|
67
|
+
provider_class.expects(:new).with(:ensure => "4.2-5ubuntu3", :error => "ok", :desired => "install", :name => "bash", :status => "installed", :description => "GNU Bourne Again SHell", :provider => :dpkg).returns installed
|
40
68
|
|
41
|
-
|
69
|
+
provider_class.instances.should == [installed]
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should parse multiple dpkg-query multi-line entries in the output" do
|
73
|
+
Puppet::Util::Execution.expects(:execpipe).with(args).yields all_installed_io
|
74
|
+
|
75
|
+
bash = mock 'bash'
|
76
|
+
provider_class.expects(:new).with(:ensure => "4.2-5ubuntu3", :error => "ok", :desired => "install", :name => "bash", :status => "installed", :description => "GNU Bourne Again SHell", :provider => :dpkg).returns bash
|
77
|
+
vim = mock 'vim'
|
78
|
+
provider_class.expects(:new).with(:ensure => "2:7.3.547-6ubuntu5", :error => "ok", :desired => "install", :name => "vim", :status => "installed", :description => "Vi IMproved - enhanced vi editor", :provider => :dpkg).returns vim
|
79
|
+
|
80
|
+
provider_class.instances.should == [bash, vim]
|
42
81
|
end
|
43
82
|
|
44
83
|
it "should warn on and ignore any lines it does not understand" do
|
45
|
-
|
46
|
-
pipe.expects(:each).never
|
47
|
-
pipe.expects(:each_line).yields "foobar"
|
48
|
-
Puppet::Util::Execution.expects(:execpipe).yields pipe
|
84
|
+
Puppet::Util::Execution.expects(:execpipe).with(args).yields StringIO.new('foobar')
|
49
85
|
|
50
86
|
Puppet.expects(:warning)
|
51
|
-
|
87
|
+
provider_class.expects(:new).never
|
88
|
+
|
89
|
+
provider_class.instances.should == []
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should not warn on extra multiline description lines which we are ignoring" do
|
93
|
+
Puppet::Util::Execution.expects(:execpipe).with(args).yields all_installed_io
|
52
94
|
|
53
|
-
|
95
|
+
Puppet.expects(:warning).never
|
96
|
+
provider_class.instances
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should warn if encounters bad lines between good entries without failing" do
|
100
|
+
Puppet::Util::Execution.expects(:execpipe).with(args).yields StringIO.new([bash_installed_output, "foobar\n", vim_installed_output].join)
|
101
|
+
|
102
|
+
Puppet.expects(:warning)
|
103
|
+
|
104
|
+
bash = mock 'bash'
|
105
|
+
vim = mock 'vim'
|
106
|
+
provider_class.expects(:new).twice.returns(bash, vim)
|
107
|
+
|
108
|
+
provider_class.instances.should == [bash, vim]
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should warn on a broken entry while still parsing a good one" do
|
112
|
+
Puppet::Util::Execution.expects(:execpipe).with(args).yields StringIO.new([
|
113
|
+
bash_installed_output,
|
114
|
+
%Q{install ok installed broken 1.0 this shouldn't be here :DESC: broken description\n extra description\n:DESC:\n},
|
115
|
+
vim_installed_output,
|
116
|
+
].join)
|
117
|
+
|
118
|
+
Puppet.expects(:warning).times(3)
|
119
|
+
|
120
|
+
bash = mock('bash')
|
121
|
+
vim = mock('vim')
|
122
|
+
saved = mock('saved')
|
123
|
+
provider_class.expects(:new).twice.returns(bash, vim)
|
124
|
+
|
125
|
+
provider_class.instances.should == [bash, vim]
|
54
126
|
end
|
55
127
|
end
|
56
128
|
|
57
129
|
describe "when querying the current state" do
|
58
|
-
|
59
|
-
@provider.expects(:dpkgquery).with("-W", "--showformat",'${Status} ${Package} ${Version}\\n', "asdf").returns @fakeresult
|
130
|
+
let(:query_args) { args.push(resource_name) }
|
60
131
|
|
61
|
-
|
132
|
+
before do
|
133
|
+
provider.expects(:execute).never # forbid "manual" executions
|
134
|
+
end
|
135
|
+
|
136
|
+
# @return [StringIO] of bash dpkg-query output with :search string replaced
|
137
|
+
# by :replace string.
|
138
|
+
def replace_in_bash_output(search, replace)
|
139
|
+
StringIO.new(bash_installed_output.gsub(search, replace))
|
140
|
+
end
|
141
|
+
|
142
|
+
it "should use exec-pipe" do
|
143
|
+
Puppet::Util::Execution.expects(:execpipe).with(query_args).yields bash_installed_io
|
144
|
+
|
145
|
+
provider.query
|
62
146
|
end
|
63
147
|
|
64
148
|
it "should consider the package purged if dpkg-query fails" do
|
65
|
-
|
149
|
+
Puppet::Util::Execution.expects(:execpipe).with(query_args).raises Puppet::ExecutionFailure.new("eh")
|
66
150
|
|
67
|
-
|
151
|
+
provider.query[:ensure].should == :purged
|
68
152
|
end
|
69
153
|
|
70
|
-
it "should return a hash of the found status
|
71
|
-
|
154
|
+
it "should return a hash of the found package status for an installed package" do
|
155
|
+
Puppet::Util::Execution.expects(:execpipe).with(query_args).yields bash_installed_io
|
72
156
|
|
73
|
-
|
157
|
+
provider.query.should == {:ensure => "4.2-5ubuntu3", :error => "ok", :desired => "install", :name => "bash", :status => "installed", :provider => :dpkg, :description => "GNU Bourne Again SHell"}
|
74
158
|
end
|
75
159
|
|
76
160
|
it "should consider the package absent if the dpkg-query result cannot be interpreted" do
|
77
|
-
|
161
|
+
Puppet::Util::Execution.expects(:execpipe).with(query_args).yields StringIO.new("somebaddata")
|
78
162
|
|
79
|
-
|
163
|
+
provider.query[:ensure].should == :absent
|
80
164
|
end
|
81
165
|
|
82
166
|
it "should fail if an error is discovered" do
|
83
|
-
|
167
|
+
Puppet::Util::Execution.expects(:execpipe).with(query_args).yields replace_in_bash_output("ok", "error")
|
84
168
|
|
85
|
-
lambda {
|
169
|
+
lambda { provider.query }.should raise_error(Puppet::Error)
|
86
170
|
end
|
87
171
|
|
88
172
|
it "should consider the package purged if it is marked 'not-installed'" do
|
89
|
-
|
173
|
+
not_installed_bash = bash_installed_output.gsub("installed", "not-installed")
|
174
|
+
not_installed_bash.gsub!(bash_version, "")
|
175
|
+
Puppet::Util::Execution.expects(:execpipe).with(query_args).yields StringIO.new(not_installed_bash)
|
90
176
|
|
91
|
-
|
177
|
+
provider.query[:ensure].should == :purged
|
92
178
|
end
|
93
179
|
|
94
180
|
it "should consider the package absent if it is marked 'config-files'" do
|
95
|
-
|
96
|
-
|
181
|
+
Puppet::Util::Execution.expects(:execpipe).with(query_args).yields replace_in_bash_output("installed", "config-files")
|
182
|
+
provider.query[:ensure].should == :absent
|
97
183
|
end
|
98
184
|
|
99
185
|
it "should consider the package absent if it is marked 'half-installed'" do
|
100
|
-
|
101
|
-
|
186
|
+
Puppet::Util::Execution.expects(:execpipe).with(query_args).yields replace_in_bash_output("installed", "half-installed")
|
187
|
+
provider.query[:ensure].should == :absent
|
102
188
|
end
|
103
189
|
|
104
190
|
it "should consider the package absent if it is marked 'unpacked'" do
|
105
|
-
|
106
|
-
|
191
|
+
Puppet::Util::Execution.expects(:execpipe).with(query_args).yields replace_in_bash_output("installed", "unpacked")
|
192
|
+
provider.query[:ensure].should == :absent
|
107
193
|
end
|
108
194
|
|
109
195
|
it "should consider the package absent if it is marked 'half-configured'" do
|
110
|
-
|
111
|
-
|
196
|
+
Puppet::Util::Execution.expects(:execpipe).with(query_args).yields replace_in_bash_output("installed", "half-configured")
|
197
|
+
provider.query[:ensure].should == :absent
|
112
198
|
end
|
113
199
|
|
114
200
|
it "should consider the package held if its state is 'hold'" do
|
115
|
-
|
116
|
-
|
201
|
+
Puppet::Util::Execution.expects(:execpipe).with(query_args).yields replace_in_bash_output("install", "hold")
|
202
|
+
provider.query[:ensure].should == :held
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
describe "parsing tests" do
|
207
|
+
let(:resource_name) { 'name' }
|
208
|
+
let(:package_hash) do
|
209
|
+
{
|
210
|
+
:desired => 'desired',
|
211
|
+
:error => 'ok',
|
212
|
+
:status => 'status',
|
213
|
+
:name => resource_name,
|
214
|
+
:ensure => 'ensure',
|
215
|
+
:description => 'summary text',
|
216
|
+
:provider => :dpkg,
|
217
|
+
}
|
218
|
+
end
|
219
|
+
let(:query_args) { args.push(resource_name) }
|
220
|
+
|
221
|
+
it "warns about excess lines if encounters a delimiter in description but does not fail" do
|
222
|
+
broken_description = <<-EOS
|
223
|
+
desired ok status name ensure :DESC: summary text
|
224
|
+
more description
|
225
|
+
:DESC:
|
226
|
+
1 whoops ^^ should not happen, because dpkg-query is supposed to prefix description lines with
|
227
|
+
2 whitespace. So we should see three warnings for these four additional lines when we try
|
228
|
+
3 and process next-pkg (vv the :DESC: is line number 4)
|
229
|
+
:DESC:
|
230
|
+
desired ok status next-pkg ensure :DESC: next summary
|
231
|
+
:DESC:
|
232
|
+
EOS
|
233
|
+
Puppet.expects(:warning).times(4)
|
234
|
+
|
235
|
+
pipe = StringIO.new(broken_description)
|
236
|
+
provider_class.parse_multi_line(pipe).should == package_hash
|
237
|
+
|
238
|
+
next_package = package_hash.merge(:name => 'next-pkg', :description => 'next summary')
|
239
|
+
|
240
|
+
hash = provider_class.parse_multi_line(pipe) until hash # warn about bad lines
|
241
|
+
hash.should == next_package
|
242
|
+
end
|
243
|
+
|
244
|
+
def parser_test(dpkg_output_string, gold_hash)
|
245
|
+
pipe = StringIO.new(dpkg_output_string)
|
246
|
+
Puppet::Util::Execution.expects(:execpipe).with(query_args).yields pipe
|
247
|
+
Puppet.expects(:warning).never
|
248
|
+
|
249
|
+
provider.query.should == gold_hash
|
250
|
+
end
|
251
|
+
|
252
|
+
it "should parse properly even if delimiter is in version" do
|
253
|
+
version_delimiter = <<-EOS
|
254
|
+
desired ok status name 1.2.3-:DESC: :DESC: summary text
|
255
|
+
more description
|
256
|
+
:DESC:
|
257
|
+
EOS
|
258
|
+
parser_test(version_delimiter, package_hash.merge(:ensure => '1.2.3-:DESC:'))
|
259
|
+
end
|
260
|
+
|
261
|
+
it "should parse properly even if delimiter is name" do
|
262
|
+
name_delimiter = <<-EOS
|
263
|
+
desired ok status :DESC: ensure :DESC: summary text
|
264
|
+
more description
|
265
|
+
:DESC:
|
266
|
+
EOS
|
267
|
+
parser_test(name_delimiter, package_hash.merge(:name => ':DESC:'))
|
268
|
+
end
|
269
|
+
|
270
|
+
it "should parse properly even if optional ensure field is missing" do
|
271
|
+
no_ensure = <<-EOS
|
272
|
+
desired ok status name :DESC: summary text
|
273
|
+
more description and note^ two spaces surround the hole where 'ensure' field would be...
|
274
|
+
:DESC:
|
275
|
+
EOS
|
276
|
+
parser_test(no_ensure, package_hash.merge(:ensure => ''))
|
277
|
+
end
|
278
|
+
|
279
|
+
it "should parse properly even if extra delimiter is in summary" do
|
280
|
+
extra_description_delimiter = <<-EOS
|
281
|
+
desired ok status name ensure :DESC: summary text
|
282
|
+
:DESC: should be completely ignored because of leading space which dpkg-query should ensure
|
283
|
+
:DESC:
|
284
|
+
EOS
|
285
|
+
parser_test(extra_description_delimiter, package_hash)
|
286
|
+
end
|
287
|
+
|
288
|
+
it "should parse properly even if package description is completely missing" do
|
289
|
+
no_description = "desired ok status name ensure :DESC: \n:DESC:"
|
290
|
+
parser_test(no_description, package_hash.merge(:description => ''))
|
117
291
|
end
|
118
292
|
end
|
119
293
|
|
120
294
|
it "should be able to install" do
|
121
|
-
|
295
|
+
provider.should respond_to(:install)
|
122
296
|
end
|
123
297
|
|
124
298
|
describe "when installing" do
|
125
299
|
before do
|
126
|
-
|
300
|
+
resource.stubs(:[]).with(:source).returns "mypkg"
|
127
301
|
end
|
128
302
|
|
129
303
|
it "should fail to install if no source is specified in the resource" do
|
130
|
-
|
304
|
+
resource.expects(:[]).with(:source).returns nil
|
131
305
|
|
132
|
-
lambda {
|
306
|
+
lambda { provider.install }.should raise_error(ArgumentError)
|
133
307
|
end
|
134
308
|
|
135
309
|
it "should use 'dpkg -i' to install the package" do
|
136
|
-
|
137
|
-
|
138
|
-
|
310
|
+
resource.expects(:[]).with(:source).returns "mypackagefile"
|
311
|
+
provider.expects(:unhold)
|
312
|
+
provider.expects(:dpkg).with { |*command| command[-1] == "mypackagefile" and command[-2] == "-i" }
|
139
313
|
|
140
|
-
|
314
|
+
provider.install
|
141
315
|
end
|
142
316
|
|
143
317
|
it "should keep old config files if told to do so" do
|
144
|
-
|
145
|
-
|
146
|
-
|
318
|
+
resource.expects(:[]).with(:configfiles).returns :keep
|
319
|
+
provider.expects(:unhold)
|
320
|
+
provider.expects(:dpkg).with { |*command| command[0] == "--force-confold" }
|
147
321
|
|
148
|
-
|
322
|
+
provider.install
|
149
323
|
end
|
150
324
|
|
151
325
|
it "should replace old config files if told to do so" do
|
152
|
-
|
153
|
-
|
154
|
-
|
326
|
+
resource.expects(:[]).with(:configfiles).returns :replace
|
327
|
+
provider.expects(:unhold)
|
328
|
+
provider.expects(:dpkg).with { |*command| command[0] == "--force-confnew" }
|
155
329
|
|
156
|
-
|
330
|
+
provider.install
|
157
331
|
end
|
158
332
|
|
159
333
|
it "should ensure any hold is removed" do
|
160
|
-
|
161
|
-
|
162
|
-
|
334
|
+
provider.expects(:unhold).once
|
335
|
+
provider.expects(:dpkg)
|
336
|
+
provider.install
|
163
337
|
end
|
164
338
|
end
|
165
339
|
|
166
340
|
describe "when holding or unholding" do
|
341
|
+
let(:tempfile) { stub 'tempfile', :print => nil, :close => nil, :flush => nil, :path => "/other/file" }
|
342
|
+
|
167
343
|
before do
|
168
|
-
|
169
|
-
|
170
|
-
Tempfile.stubs(:new).returns @tempfile
|
344
|
+
tempfile.stubs(:write)
|
345
|
+
Tempfile.stubs(:new).returns tempfile
|
171
346
|
end
|
172
347
|
|
173
348
|
it "should install first if holding" do
|
174
|
-
|
175
|
-
|
176
|
-
|
349
|
+
provider.stubs(:execute)
|
350
|
+
provider.expects(:install).once
|
351
|
+
provider.hold
|
177
352
|
end
|
178
353
|
|
179
354
|
it "should execute dpkg --set-selections when holding" do
|
180
|
-
|
181
|
-
|
182
|
-
|
355
|
+
provider.stubs(:install)
|
356
|
+
provider.expects(:execute).with([:dpkg, '--set-selections'], {:failonfail => false, :combine => false, :stdinfile => tempfile.path}).once
|
357
|
+
provider.hold
|
183
358
|
end
|
184
359
|
|
185
360
|
it "should execute dpkg --set-selections when unholding" do
|
186
|
-
|
187
|
-
|
188
|
-
|
361
|
+
provider.stubs(:install)
|
362
|
+
provider.expects(:execute).with([:dpkg, '--set-selections'], {:failonfail => false, :combine => false, :stdinfile => tempfile.path}).once
|
363
|
+
provider.hold
|
189
364
|
end
|
190
365
|
end
|
191
366
|
|
192
367
|
it "should use :install to update" do
|
193
|
-
|
194
|
-
|
368
|
+
provider.expects(:install)
|
369
|
+
provider.update
|
195
370
|
end
|
196
371
|
|
197
372
|
describe "when determining latest available version" do
|
198
373
|
it "should return the version found by dpkg-deb" do
|
199
|
-
|
200
|
-
|
201
|
-
|
374
|
+
resource.expects(:[]).with(:source).returns "myfile"
|
375
|
+
provider.expects(:dpkg_deb).with { |*command| command[-1] == "myfile" }.returns "package\t1.0"
|
376
|
+
provider.latest.should == "1.0"
|
202
377
|
end
|
203
378
|
|
204
379
|
it "should warn if the package file contains a different package" do
|
205
|
-
|
206
|
-
|
207
|
-
|
380
|
+
provider.expects(:dpkg_deb).returns("foo\tversion")
|
381
|
+
provider.expects(:warning)
|
382
|
+
provider.latest
|
208
383
|
end
|
209
384
|
|
210
385
|
it "should cope with names containing ++" do
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
386
|
+
resource = stub 'resource', :[] => "package++"
|
387
|
+
provider = provider_class.new(resource)
|
388
|
+
provider.expects(:dpkg_deb).returns "package++\t1.0"
|
389
|
+
provider.latest.should == "1.0"
|
215
390
|
end
|
216
391
|
end
|
217
392
|
|
218
393
|
it "should use 'dpkg -r' to uninstall" do
|
219
|
-
|
220
|
-
|
394
|
+
provider.expects(:dpkg).with("-r", resource_name)
|
395
|
+
provider.uninstall
|
221
396
|
end
|
222
397
|
|
223
398
|
it "should use 'dpkg --purge' to purge" do
|
224
|
-
|
225
|
-
|
399
|
+
provider.expects(:dpkg).with("--purge", resource_name)
|
400
|
+
provider.purge
|
226
401
|
end
|
227
402
|
end
|