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
@@ -15,17 +15,17 @@ describe augeas do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
describe "basic structure" do
|
18
|
-
it "should be able to create
|
18
|
+
it "should be able to create an instance" do
|
19
19
|
provider_class = Puppet::Type::Augeas.provider(Puppet::Type::Augeas.providers[0])
|
20
20
|
Puppet::Type::Augeas.expects(:defaultprovider).returns provider_class
|
21
21
|
augeas.new(:name => "bar").should_not be_nil
|
22
22
|
end
|
23
23
|
|
24
|
-
it "should have
|
24
|
+
it "should have a parse_commands feature" do
|
25
25
|
augeas.provider_feature(:parse_commands).should_not be_nil
|
26
26
|
end
|
27
27
|
|
28
|
-
it "should have
|
28
|
+
it "should have a need_to_run? feature" do
|
29
29
|
augeas.provider_feature(:need_to_run?).should_not be_nil
|
30
30
|
end
|
31
31
|
|
@@ -21,15 +21,6 @@ describe component do
|
|
21
21
|
comp.title.should == comp.ref
|
22
22
|
end
|
23
23
|
|
24
|
-
it "should alias itself to its reference if it has a catalog and the catalog does not already have a resource with the same reference" do
|
25
|
-
catalog = mock 'catalog'
|
26
|
-
catalog.expects(:resource).with("Foo[bar]").returns nil
|
27
|
-
|
28
|
-
catalog.expects(:alias).with { |resource, name| resource.is_a?(component) and name == "Foo[bar]" }
|
29
|
-
|
30
|
-
component.new(:name => "Foo[bar]", :catalog => catalog)
|
31
|
-
end
|
32
|
-
|
33
24
|
it "should not fail when provided an invalid value" do
|
34
25
|
comp = component.new(:name => "Foo[bar]")
|
35
26
|
lambda { comp[:yayness] = "ey" }.should_not raise_error
|
@@ -18,7 +18,7 @@ describe Puppet::Type.type(:computer), " when checking computer objects" do
|
|
18
18
|
@ensure = Puppet::Type::Computer.attrclass(:ensure).new(:resource => @resource)
|
19
19
|
end
|
20
20
|
|
21
|
-
it "should be able to create
|
21
|
+
it "should be able to create an instance" do
|
22
22
|
provider_class = Puppet::Type::Computer.provider(Puppet::Type::Computer.providers[0])
|
23
23
|
Puppet::Type::Computer.expects(:defaultprovider).returns provider_class
|
24
24
|
computer.new(:name => "bar").should_not be_nil
|
data/spec/unit/type/cron_spec.rb
CHANGED
@@ -457,13 +457,13 @@ describe Puppet::Type.type(:cron), :unless => Puppet.features.microsoft_windows?
|
|
457
457
|
it "should accept empty environment variables that do not contain '='" do
|
458
458
|
expect do
|
459
459
|
described_class.new(:name => 'foo',:environment => 'MAILTO=')
|
460
|
-
end.to_not raise_error
|
460
|
+
end.to_not raise_error
|
461
461
|
end
|
462
462
|
|
463
463
|
it "should accept 'absent'" do
|
464
464
|
expect do
|
465
465
|
described_class.new(:name => 'foo',:environment => 'absent')
|
466
|
-
end.to_not raise_error
|
466
|
+
end.to_not raise_error
|
467
467
|
end
|
468
468
|
|
469
469
|
end
|
data/spec/unit/type/exec_spec.rb
CHANGED
@@ -154,11 +154,13 @@ describe Puppet::Type.type(:exec) do
|
|
154
154
|
foo = make_absolute('/bin/foo')
|
155
155
|
catalog = Puppet::Resource::Catalog.new
|
156
156
|
tmp = Puppet::Type.type(:file).new(:name => foo)
|
157
|
-
catalog.add_resource tmp
|
158
157
|
execer = Puppet::Type.type(:exec).new(:name => foo)
|
158
|
+
|
159
|
+
catalog.add_resource tmp
|
159
160
|
catalog.add_resource execer
|
161
|
+
dependencies = execer.autorequire(catalog)
|
160
162
|
|
161
|
-
|
163
|
+
dependencies.collect(&:to_s).should == [Puppet::Relationship.new(tmp, execer).to_s]
|
162
164
|
end
|
163
165
|
|
164
166
|
describe "when handling the path parameter" do
|
@@ -147,6 +147,17 @@ describe content do
|
|
147
147
|
@content.must be_safe_insync("whatever")
|
148
148
|
end
|
149
149
|
|
150
|
+
it "should warn that no content will be synced to links when ensure is :present" do
|
151
|
+
@resource[:ensure] = :present
|
152
|
+
@resource[:content] = 'foo'
|
153
|
+
@resource.stubs(:should_be_file?).returns false
|
154
|
+
@resource.stubs(:stat).returns mock("stat", :ftype => "link")
|
155
|
+
|
156
|
+
@resource.expects(:warning).with {|msg| msg =~ /Ensure set to :present but file type is/}
|
157
|
+
|
158
|
+
@content.insync? :present
|
159
|
+
end
|
160
|
+
|
150
161
|
it "should return false if the current content is :absent" do
|
151
162
|
@content.should = "foo"
|
152
163
|
@content.should_not be_safe_insync(:absent)
|
@@ -23,7 +23,7 @@ describe Puppet::Type.type(:file).attrclass(:group) do
|
|
23
23
|
resource.provider.stubs(:name2gid).with('bars').returns 1002
|
24
24
|
end
|
25
25
|
|
26
|
-
it "should fail if
|
26
|
+
it "should fail if a group's id can't be found by name" do
|
27
27
|
resource.provider.stubs(:name2gid).returns nil
|
28
28
|
|
29
29
|
expect { group.insync?(5) }.to raise_error(/Could not find group foos/)
|
data/spec/unit/type/file_spec.rb
CHANGED
@@ -26,6 +26,11 @@ describe Puppet::Type.type(:file) do
|
|
26
26
|
file[:path].should == "/foo/bar/baz"
|
27
27
|
end
|
28
28
|
|
29
|
+
it "should remove triple slashes" do
|
30
|
+
file[:path] = "/foo/bar///baz"
|
31
|
+
file[:path].should == "/foo/bar/baz"
|
32
|
+
end
|
33
|
+
|
29
34
|
it "should remove trailing double slashes" do
|
30
35
|
file[:path] = "/foo/bar/baz//"
|
31
36
|
file[:path].should == "/foo/bar/baz"
|
@@ -36,11 +41,14 @@ describe Puppet::Type.type(:file) do
|
|
36
41
|
file[:path].should == "/"
|
37
42
|
end
|
38
43
|
|
39
|
-
it "should accept and
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
+
it "should accept and collapse a double-slash at the start of the path" do
|
45
|
+
file[:path] = "//tmp/xxx"
|
46
|
+
file[:path].should == '/tmp/xxx'
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should accept and collapse a triple-slash at the start of the path" do
|
50
|
+
file[:path] = "///tmp/xxx"
|
51
|
+
file[:path].should == '/tmp/xxx'
|
44
52
|
end
|
45
53
|
end
|
46
54
|
|
@@ -176,14 +184,14 @@ describe Puppet::Type.type(:file) do
|
|
176
184
|
[true, :true, :yes].each do |value|
|
177
185
|
it "should consider #{value} to be true" do
|
178
186
|
file[:replace] = value
|
179
|
-
file[:replace].should
|
187
|
+
file[:replace].should be_true
|
180
188
|
end
|
181
189
|
end
|
182
190
|
|
183
191
|
[false, :false, :no].each do |value|
|
184
192
|
it "should consider #{value} to be false" do
|
185
193
|
file[:replace] = value
|
186
|
-
file[:replace].should
|
194
|
+
file[:replace].should be_false
|
187
195
|
end
|
188
196
|
end
|
189
197
|
end
|
@@ -1116,7 +1124,7 @@ describe Puppet::Type.type(:file) do
|
|
1116
1124
|
property = stub('content_property', :actual_content => "something", :length => "something".length, :write => 'checksum_a')
|
1117
1125
|
file.stubs(:property).with(:content).returns(property)
|
1118
1126
|
|
1119
|
-
expect { file.write :NOTUSED }.to_not raise_error
|
1127
|
+
expect { file.write :NOTUSED }.to_not raise_error
|
1120
1128
|
end
|
1121
1129
|
end
|
1122
1130
|
end
|
@@ -2,336 +2,522 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
4
|
describe Puppet::Type.type(:mount), :unless => Puppet.features.microsoft_windows? do
|
5
|
+
|
6
|
+
before :each do
|
7
|
+
Puppet::Type.type(:mount).stubs(:defaultprovider).returns providerclass
|
8
|
+
end
|
9
|
+
|
10
|
+
let :providerclass do
|
11
|
+
described_class.provide(:fake_mount_provider) do
|
12
|
+
attr_accessor :property_hash
|
13
|
+
def create; end
|
14
|
+
def destroy; end
|
15
|
+
def exists?
|
16
|
+
get(:ensure) != :absent
|
17
|
+
end
|
18
|
+
def mount; end
|
19
|
+
def umount; end
|
20
|
+
def mounted?
|
21
|
+
[:mounted, :ghost].include?(get(:ensure))
|
22
|
+
end
|
23
|
+
mk_resource_methods
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
let :provider do
|
28
|
+
providerclass.new(:name => 'yay')
|
29
|
+
end
|
30
|
+
|
31
|
+
let :resource do
|
32
|
+
described_class.new(:name => "yay", :audit => :ensure, :provider => provider)
|
33
|
+
end
|
34
|
+
|
35
|
+
let :ensureprop do
|
36
|
+
resource.property(:ensure)
|
37
|
+
end
|
38
|
+
|
5
39
|
it "should have a :refreshable feature that requires the :remount method" do
|
6
|
-
|
40
|
+
described_class.provider_feature(:refreshable).methods.should == [:remount]
|
7
41
|
end
|
8
42
|
|
9
43
|
it "should have no default value for :ensure" do
|
10
|
-
mount =
|
44
|
+
mount = described_class.new(:name => "yay")
|
11
45
|
mount.should(:ensure).should be_nil
|
12
46
|
end
|
13
47
|
|
14
48
|
it "should have :name as the only keyattribut" do
|
15
|
-
|
49
|
+
described_class.key_attributes.should == [:name]
|
16
50
|
end
|
17
|
-
end
|
18
51
|
|
19
|
-
describe
|
20
|
-
|
21
|
-
|
22
|
-
|
52
|
+
describe "when validating attributes" do
|
53
|
+
[:name, :remounts, :provider].each do |param|
|
54
|
+
it "should have a #{param} parameter" do
|
55
|
+
described_class.attrtype(param).should == :param
|
56
|
+
end
|
23
57
|
end
|
24
|
-
end
|
25
58
|
|
26
|
-
|
27
|
-
|
28
|
-
|
59
|
+
[:ensure, :device, :blockdevice, :fstype, :options, :pass, :dump, :atboot, :target].each do |param|
|
60
|
+
it "should have a #{param} property" do
|
61
|
+
described_class.attrtype(param).should == :property
|
62
|
+
end
|
29
63
|
end
|
30
64
|
end
|
31
|
-
end
|
32
65
|
|
33
|
-
describe
|
34
|
-
before do
|
35
|
-
@provider = stub 'provider', :class => Puppet::Type.type(:mount).defaultprovider, :clear => nil
|
36
|
-
Puppet::Type.type(:mount).defaultprovider.expects(:new).returns(@provider)
|
37
|
-
end
|
66
|
+
describe "when validating values" do
|
38
67
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
68
|
+
describe "for name" do
|
69
|
+
it "should allow full qualified paths" do
|
70
|
+
described_class.new(:name => "/mnt/foo")[:name].should == '/mnt/foo'
|
71
|
+
end
|
43
72
|
|
44
|
-
|
45
|
-
|
46
|
-
|
73
|
+
it "should remove trailing slashes" do
|
74
|
+
described_class.new(:name => '/')[:name].should == '/'
|
75
|
+
described_class.new(:name => '//')[:name].should == '/'
|
76
|
+
described_class.new(:name => '/foo/')[:name].should == '/foo'
|
77
|
+
described_class.new(:name => '/foo/bar/')[:name].should == '/foo/bar'
|
78
|
+
described_class.new(:name => '/foo/bar/baz//')[:name].should == '/foo/bar/baz'
|
79
|
+
end
|
47
80
|
|
48
|
-
|
49
|
-
|
50
|
-
|
81
|
+
it "should not allow spaces" do
|
82
|
+
expect { described_class.new(:name => "/mnt/foo bar") }.to raise_error Puppet::Error, /name.*whitespace/
|
83
|
+
end
|
51
84
|
|
52
|
-
|
53
|
-
|
54
|
-
|
85
|
+
it "should allow pseudo mountpoints (e.g. swap)" do
|
86
|
+
described_class.new(:name => 'none')[:name].should == 'none'
|
87
|
+
end
|
88
|
+
end
|
55
89
|
|
56
|
-
|
57
|
-
|
58
|
-
|
90
|
+
describe "for ensure" do
|
91
|
+
it "should alias :present to :defined as a value to :ensure" do
|
92
|
+
mount = described_class.new(:name => "yay", :ensure => :present)
|
93
|
+
mount.should(:ensure).should == :defined
|
94
|
+
end
|
59
95
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
end
|
96
|
+
it "should support :present as a value to :ensure" do
|
97
|
+
expect { described_class.new(:name => "yay", :ensure => :present) }.to_not raise_error
|
98
|
+
end
|
64
99
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
@provider = stub 'provider', :class => Puppet::Type.type(:mount).defaultprovider, :clear => nil, :satisfies? => true, :name => :mock, :property_hash => provider_properties
|
69
|
-
Puppet::Type.type(:mount).defaultprovider.stubs(:new).returns(@provider)
|
70
|
-
@mount = Puppet::Type.type(:mount).new(:name => "yay", :audit => :ensure)
|
100
|
+
it "should support :defined as a value to :ensure" do
|
101
|
+
expect { described_class.new(:name => "yay", :ensure => :defined) }.to_not raise_error
|
102
|
+
end
|
71
103
|
|
72
|
-
|
73
|
-
|
104
|
+
it "should support :unmounted as a value to :ensure" do
|
105
|
+
expect { described_class.new(:name => "yay", :ensure => :unmounted) }.to_not raise_error
|
106
|
+
end
|
107
|
+
|
108
|
+
it "should support :absent as a value to :ensure" do
|
109
|
+
expect { described_class.new(:name => "yay", :ensure => :absent) }.to_not raise_error
|
110
|
+
end
|
111
|
+
|
112
|
+
it "should support :mounted as a value to :ensure" do
|
113
|
+
expect { described_class.new(:name => "yay", :ensure => :mounted) }.to_not raise_error
|
114
|
+
end
|
115
|
+
|
116
|
+
it "should not support other values for :ensure" do
|
117
|
+
expect { described_class.new(:name => "yay", :ensure => :mount) }.to raise_error Puppet::Error, /Invalid value/
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
describe "for device" do
|
122
|
+
it "should support normal /dev paths for device" do
|
123
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :device => '/dev/hda1') }.to_not raise_error
|
124
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :device => '/dev/dsk/c0d0s0') }.to_not raise_error
|
125
|
+
end
|
126
|
+
|
127
|
+
it "should support labels for device" do
|
128
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :device => 'LABEL=/boot') }.to_not raise_error
|
129
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :device => 'LABEL=SWAP-hda6') }.to_not raise_error
|
130
|
+
end
|
131
|
+
|
132
|
+
it "should support pseudo devices for device" do
|
133
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :device => 'ctfs') }.to_not raise_error
|
134
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :device => 'swap') }.to_not raise_error
|
135
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :device => 'sysfs') }.to_not raise_error
|
136
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :device => 'proc') }.to_not raise_error
|
137
|
+
end
|
138
|
+
|
139
|
+
it 'should not support whitespace in device' do
|
140
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :device => '/dev/my dev/foo') }.to raise_error Puppet::Error, /device.*whitespace/
|
141
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :device => "/dev/my\tdev/foo") }.to raise_error Puppet::Error, /device.*whitespace/
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
describe "for blockdevice" do
|
146
|
+
before :each do
|
147
|
+
# blockdevice is only used on Solaris
|
148
|
+
Facter.stubs(:value).with(:operatingsystem).returns 'Solaris'
|
149
|
+
Facter.stubs(:value).with(:osfamily).returns 'Solaris'
|
150
|
+
end
|
151
|
+
|
152
|
+
it "should support normal /dev/rdsk paths for blockdevice" do
|
153
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :blockdevice => '/dev/rdsk/c0d0s0') }.to_not raise_error
|
154
|
+
end
|
155
|
+
|
156
|
+
it "should support a dash for blockdevice" do
|
157
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :blockdevice => '-') }.to_not raise_error
|
158
|
+
end
|
159
|
+
|
160
|
+
it "should not support whitespace in blockdevice" do
|
161
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :blockdevice => '/dev/my dev/foo') }.to raise_error Puppet::Error, /blockdevice.*whitespace/
|
162
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :blockdevice => "/dev/my\tdev/foo") }.to raise_error Puppet::Error, /blockdevice.*whitespace/
|
163
|
+
end
|
164
|
+
|
165
|
+
it "should default to /dev/rdsk/DEVICE if device is /dev/dsk/DEVICE" do
|
166
|
+
obj = described_class.new(:name => "/foo", :device => '/dev/dsk/c0d0s0')
|
167
|
+
obj[:blockdevice].should == '/dev/rdsk/c0d0s0'
|
168
|
+
end
|
169
|
+
|
170
|
+
it "should default to - if it is an nfs-share" do
|
171
|
+
obj = described_class.new(:name => "/foo", :device => "server://share", :fstype => 'nfs')
|
172
|
+
obj[:blockdevice].should == '-'
|
173
|
+
end
|
174
|
+
|
175
|
+
it "should have no default otherwise" do
|
176
|
+
described_class.new(:name => "/foo")[:blockdevice].should == nil
|
177
|
+
described_class.new(:name => "/foo", :device => "/foo")[:blockdevice].should == nil
|
178
|
+
end
|
179
|
+
|
180
|
+
it "should overwrite any default if blockdevice is explicitly set" do
|
181
|
+
described_class.new(:name => "/foo", :device => '/dev/dsk/c0d0s0', :blockdevice => '/foo')[:blockdevice].should == '/foo'
|
182
|
+
described_class.new(:name => "/foo", :device => "server://share", :fstype => 'nfs', :blockdevice => '/foo')[:blockdevice].should == '/foo'
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
describe "for fstype" do
|
187
|
+
it "should support valid fstypes" do
|
188
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :fstype => 'ext3') }.to_not raise_error
|
189
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :fstype => 'proc') }.to_not raise_error
|
190
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :fstype => 'sysfs') }.to_not raise_error
|
191
|
+
end
|
192
|
+
|
193
|
+
it "should support auto as a special fstype" do
|
194
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :fstype => 'auto') }.to_not raise_error
|
195
|
+
end
|
196
|
+
|
197
|
+
it "should not support whitespace in fstype" do
|
198
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :fstype => 'ext 3') }.to raise_error Puppet::Error, /fstype.*whitespace/
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
describe "for options" do
|
203
|
+
it "should support a single option" do
|
204
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :options => 'ro') }.to_not raise_error
|
205
|
+
end
|
206
|
+
|
207
|
+
it "should support muliple options as a comma separated list" do
|
208
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :options => 'ro,rsize=4096') }.to_not raise_error
|
209
|
+
end
|
210
|
+
|
211
|
+
it "should not support whitespace in options" do
|
212
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :options => ['ro','foo bar','intr']) }.to raise_error Puppet::Error, /option.*whitespace/
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
describe "for pass" do
|
217
|
+
it "should support numeric values" do
|
218
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :pass => '0') }.to_not raise_error
|
219
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :pass => '1') }.to_not raise_error
|
220
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :pass => '2') }.to_not raise_error
|
221
|
+
end
|
222
|
+
|
223
|
+
it "should support - on Solaris" do
|
224
|
+
Facter.stubs(:value).with(:operatingsystem).returns 'Solaris'
|
225
|
+
Facter.stubs(:value).with(:osfamily).returns 'Solaris'
|
226
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :pass => '-') }.to_not raise_error
|
227
|
+
end
|
74
228
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
229
|
+
it "should default to 0 on non Solaris" do
|
230
|
+
Facter.stubs(:value).with(:osfamily).returns nil
|
231
|
+
Facter.stubs(:value).with(:operatingsystem).returns 'HP-UX'
|
232
|
+
described_class.new(:name => "/foo", :ensure => :present)[:pass].should == 0
|
233
|
+
end
|
234
|
+
|
235
|
+
it "should default to - on Solaris" do
|
236
|
+
Facter.stubs(:value).with(:operatingsystem).returns 'Solaris'
|
237
|
+
Facter.stubs(:value).with(:osfamily).returns 'Solaris'
|
238
|
+
described_class.new(:name => "/foo", :ensure => :present)[:pass].should == '-'
|
80
239
|
end
|
81
240
|
end
|
82
241
|
|
83
|
-
|
84
|
-
|
242
|
+
describe "for dump" do
|
243
|
+
it "should support 0 as a value for dump" do
|
244
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :dump => '0') }.to_not raise_error
|
245
|
+
end
|
246
|
+
|
247
|
+
it "should support 1 as a value for dump" do
|
248
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :dump => '1') }.to_not raise_error
|
249
|
+
end
|
250
|
+
|
251
|
+
# Unfortunately the operatingsystem is evaluatet at load time so I am unable to stub operatingsystem
|
252
|
+
it "should support 2 as a value for dump on FreeBSD", :if => Facter.value(:operatingsystem) == 'FreeBSD' do
|
253
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :dump => '2') }.to_not raise_error
|
254
|
+
end
|
255
|
+
|
256
|
+
it "should not support 2 as a value for dump when not on FreeBSD", :if => Facter.value(:operatingsystem) != 'FreeBSD' do
|
257
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :dump => '2') }.to raise_error Puppet::Error, /Invalid value/
|
258
|
+
end
|
259
|
+
|
260
|
+
it "should default to 0" do
|
261
|
+
described_class.new(:name => "/foo", :ensure => :present)[:dump].should == 0
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
describe "for atboot" do
|
266
|
+
it "should support yes as a value for atboot" do
|
267
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :atboot => :yes) }.to_not raise_error
|
268
|
+
end
|
269
|
+
|
270
|
+
it "should support no as a value for atboot" do
|
271
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :atboot => :no) }.to_not raise_error
|
272
|
+
end
|
273
|
+
|
274
|
+
it "should not support other values for atboot" do
|
275
|
+
expect { described_class.new(:name => "/foo", :ensure => :present, :atboot => :true) }.to raise_error Puppet::Error, /Invalid value/
|
276
|
+
end
|
85
277
|
end
|
86
278
|
end
|
87
279
|
|
88
|
-
describe Puppet::Type.type(:mount)::Ensure, "when changing the host" do
|
89
280
|
|
281
|
+
describe "when changing the host" do
|
90
282
|
def test_ensure_change(options)
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
@ensure.safe_insync?(:unmounted).should == true
|
208
|
-
end
|
209
|
-
|
210
|
-
|
211
|
-
it "should be out of sync if it is :ghost and should be :absent" do
|
212
|
-
@ensure.should = :absent
|
213
|
-
@ensure.safe_insync?(:ghost).should == false
|
214
|
-
end
|
283
|
+
provider.set(:ensure => options[:from])
|
284
|
+
provider.expects(:create).times(options[:create] || 0)
|
285
|
+
provider.expects(:destroy).times(options[:destroy] || 0)
|
286
|
+
provider.expects(:mount).never
|
287
|
+
provider.expects(:unmount).times(options[:unmount] || 0)
|
288
|
+
ensureprop.stubs(:syncothers)
|
289
|
+
ensureprop.should = options[:to]
|
290
|
+
ensureprop.sync
|
291
|
+
(!!provider.property_hash[:needs_mount]).should == (!!options[:mount])
|
292
|
+
end
|
293
|
+
|
294
|
+
it "should create itself when changing from :ghost to :present" do
|
295
|
+
test_ensure_change(:from => :ghost, :to => :present, :create => 1)
|
296
|
+
end
|
297
|
+
|
298
|
+
it "should create itself when changing from :absent to :present" do
|
299
|
+
test_ensure_change(:from => :absent, :to => :present, :create => 1)
|
300
|
+
end
|
301
|
+
|
302
|
+
it "should create itself and unmount when changing from :ghost to :unmounted" do
|
303
|
+
test_ensure_change(:from => :ghost, :to => :unmounted, :create => 1, :unmount => 1)
|
304
|
+
end
|
305
|
+
|
306
|
+
it "should unmount resource when changing from :mounted to :unmounted" do
|
307
|
+
test_ensure_change(:from => :mounted, :to => :unmounted, :unmount => 1)
|
308
|
+
end
|
309
|
+
|
310
|
+
it "should create itself when changing from :absent to :unmounted" do
|
311
|
+
test_ensure_change(:from => :absent, :to => :unmounted, :create => 1)
|
312
|
+
end
|
313
|
+
|
314
|
+
it "should unmount resource when changing from :ghost to :absent" do
|
315
|
+
test_ensure_change(:from => :ghost, :to => :absent, :unmount => 1)
|
316
|
+
end
|
317
|
+
|
318
|
+
it "should unmount and destroy itself when changing from :mounted to :absent" do
|
319
|
+
test_ensure_change(:from => :mounted, :to => :absent, :destroy => 1, :unmount => 1)
|
320
|
+
end
|
321
|
+
|
322
|
+
it "should destroy itself when changing from :unmounted to :absent" do
|
323
|
+
test_ensure_change(:from => :unmounted, :to => :absent, :destroy => 1)
|
324
|
+
end
|
325
|
+
|
326
|
+
it "should create itself when changing from :ghost to :mounted" do
|
327
|
+
test_ensure_change(:from => :ghost, :to => :mounted, :create => 1)
|
328
|
+
end
|
329
|
+
|
330
|
+
it "should create itself and mount when changing from :absent to :mounted" do
|
331
|
+
test_ensure_change(:from => :absent, :to => :mounted, :create => 1, :mount => 1)
|
332
|
+
end
|
333
|
+
|
334
|
+
it "should mount resource when changing from :unmounted to :mounted" do
|
335
|
+
test_ensure_change(:from => :unmounted, :to => :mounted, :mount => 1)
|
336
|
+
end
|
337
|
+
|
338
|
+
|
339
|
+
it "should be in sync if it is :absent and should be :absent" do
|
340
|
+
ensureprop.should = :absent
|
341
|
+
ensureprop.safe_insync?(:absent).should == true
|
342
|
+
end
|
343
|
+
|
344
|
+
it "should be out of sync if it is :absent and should be :defined" do
|
345
|
+
ensureprop.should = :defined
|
346
|
+
ensureprop.safe_insync?(:absent).should == false
|
347
|
+
end
|
348
|
+
|
349
|
+
it "should be out of sync if it is :absent and should be :mounted" do
|
350
|
+
ensureprop.should = :mounted
|
351
|
+
ensureprop.safe_insync?(:absent).should == false
|
352
|
+
end
|
353
|
+
|
354
|
+
it "should be out of sync if it is :absent and should be :unmounted" do
|
355
|
+
ensureprop.should = :unmounted
|
356
|
+
ensureprop.safe_insync?(:absent).should == false
|
357
|
+
end
|
358
|
+
|
359
|
+
it "should be out of sync if it is :mounted and should be :absent" do
|
360
|
+
ensureprop.should = :absent
|
361
|
+
ensureprop.safe_insync?(:mounted).should == false
|
362
|
+
end
|
363
|
+
|
364
|
+
it "should be in sync if it is :mounted and should be :defined" do
|
365
|
+
ensureprop.should = :defined
|
366
|
+
ensureprop.safe_insync?(:mounted).should == true
|
367
|
+
end
|
368
|
+
|
369
|
+
it "should be in sync if it is :mounted and should be :mounted" do
|
370
|
+
ensureprop.should = :mounted
|
371
|
+
ensureprop.safe_insync?(:mounted).should == true
|
372
|
+
end
|
373
|
+
|
374
|
+
it "should be out in sync if it is :mounted and should be :unmounted" do
|
375
|
+
ensureprop.should = :unmounted
|
376
|
+
ensureprop.safe_insync?(:mounted).should == false
|
377
|
+
end
|
378
|
+
|
379
|
+
|
380
|
+
it "should be out of sync if it is :unmounted and should be :absent" do
|
381
|
+
ensureprop.should = :absent
|
382
|
+
ensureprop.safe_insync?(:unmounted).should == false
|
383
|
+
end
|
384
|
+
|
385
|
+
it "should be in sync if it is :unmounted and should be :defined" do
|
386
|
+
ensureprop.should = :defined
|
387
|
+
ensureprop.safe_insync?(:unmounted).should == true
|
388
|
+
end
|
389
|
+
|
390
|
+
it "should be out of sync if it is :unmounted and should be :mounted" do
|
391
|
+
ensureprop.should = :mounted
|
392
|
+
ensureprop.safe_insync?(:unmounted).should == false
|
393
|
+
end
|
394
|
+
|
395
|
+
it "should be in sync if it is :unmounted and should be :unmounted" do
|
396
|
+
ensureprop.should = :unmounted
|
397
|
+
ensureprop.safe_insync?(:unmounted).should == true
|
398
|
+
end
|
215
399
|
|
216
|
-
it "should be out of sync if it is :ghost and should be :defined" do
|
217
|
-
@ensure.should = :defined
|
218
|
-
@ensure.safe_insync?(:ghost).should == false
|
219
|
-
end
|
220
|
-
|
221
|
-
it "should be out of sync if it is :ghost and should be :mounted" do
|
222
|
-
@ensure.should = :mounted
|
223
|
-
@ensure.safe_insync?(:ghost).should == false
|
224
|
-
end
|
225
|
-
|
226
|
-
it "should be out of sync if it is :ghost and should be :unmounted" do
|
227
|
-
@ensure.should = :unmounted
|
228
|
-
@ensure.safe_insync?(:ghost).should == false
|
229
|
-
end
|
230
|
-
|
231
|
-
end
|
232
|
-
|
233
|
-
describe Puppet::Type.type(:mount), "when responding to refresh" do
|
234
|
-
pending "2.6.x specifies slightly different behavior and the desired behavior needs to be clarified and revisited. See ticket #4904" do
|
235
400
|
|
401
|
+
it "should be out of sync if it is :ghost and should be :absent" do
|
402
|
+
ensureprop.should = :absent
|
403
|
+
ensureprop.safe_insync?(:ghost).should == false
|
404
|
+
end
|
405
|
+
|
406
|
+
it "should be out of sync if it is :ghost and should be :defined" do
|
407
|
+
ensureprop.should = :defined
|
408
|
+
ensureprop.safe_insync?(:ghost).should == false
|
409
|
+
end
|
410
|
+
|
411
|
+
it "should be out of sync if it is :ghost and should be :mounted" do
|
412
|
+
ensureprop.should = :mounted
|
413
|
+
ensureprop.safe_insync?(:ghost).should == false
|
414
|
+
end
|
415
|
+
|
416
|
+
it "should be out of sync if it is :ghost and should be :unmounted" do
|
417
|
+
ensureprop.should = :unmounted
|
418
|
+
ensureprop.safe_insync?(:ghost).should == false
|
419
|
+
end
|
420
|
+
end
|
421
|
+
|
422
|
+
describe "when responding to refresh" do
|
423
|
+
pending "2.6.x specifies slightly different behavior and the desired behavior needs to be clarified and revisited. See ticket #4904" do
|
236
424
|
it "should remount if it is supposed to be mounted" do
|
237
|
-
|
238
|
-
|
425
|
+
resource[:ensure] = "mounted"
|
426
|
+
provider.expects(:remount)
|
239
427
|
|
240
|
-
|
428
|
+
resource.refresh
|
241
429
|
end
|
242
430
|
|
243
431
|
it "should not remount if it is supposed to be present" do
|
244
|
-
|
245
|
-
|
432
|
+
resource[:ensure] = "present"
|
433
|
+
provider.expects(:remount).never
|
246
434
|
|
247
|
-
|
435
|
+
resource.refresh
|
248
436
|
end
|
249
437
|
|
250
438
|
it "should not remount if it is supposed to be absent" do
|
251
|
-
|
252
|
-
|
439
|
+
resource[:ensure] = "absent"
|
440
|
+
provider.expects(:remount).never
|
253
441
|
|
254
|
-
|
442
|
+
resource.refresh
|
255
443
|
end
|
256
444
|
|
257
445
|
it "should not remount if it is supposed to be defined" do
|
258
|
-
|
259
|
-
|
446
|
+
resource[:ensure] = "defined"
|
447
|
+
provider.expects(:remount).never
|
260
448
|
|
261
|
-
|
449
|
+
resource.refresh
|
262
450
|
end
|
263
451
|
|
264
452
|
it "should not remount if it is supposed to be unmounted" do
|
265
|
-
|
266
|
-
|
453
|
+
resource[:ensure] = "unmounted"
|
454
|
+
provider.expects(:remount).never
|
267
455
|
|
268
|
-
|
456
|
+
resource.refresh
|
269
457
|
end
|
270
458
|
|
271
459
|
it "should not remount swap filesystems" do
|
272
|
-
|
273
|
-
|
274
|
-
|
460
|
+
resource[:ensure] = "mounted"
|
461
|
+
resource[:fstype] = "swap"
|
462
|
+
provider.expects(:remount).never
|
275
463
|
|
276
|
-
|
464
|
+
resource.refresh
|
277
465
|
end
|
278
466
|
end
|
279
467
|
end
|
280
|
-
end
|
281
468
|
|
282
|
-
describe
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
469
|
+
describe "when modifying an existing mount entry" do
|
470
|
+
|
471
|
+
let :initial_values do
|
472
|
+
{
|
473
|
+
:ensure => :mounted,
|
474
|
+
:name => '/mnt/foo',
|
475
|
+
:device => "/foo/bar",
|
476
|
+
:blockdevice => "/other/bar",
|
477
|
+
:target => "/what/ever",
|
478
|
+
:options => "soft",
|
479
|
+
:pass => 0,
|
480
|
+
:dump => 0,
|
481
|
+
:atboot => :no,
|
482
|
+
}
|
294
483
|
end
|
295
484
|
|
296
|
-
@mount.provider.stubs(:mounted?).returns true
|
297
|
-
|
298
|
-
# stub this to not try to create state.yaml
|
299
|
-
Puppet::Util::Storage.stubs(:store)
|
300
485
|
|
301
|
-
|
302
|
-
|
303
|
-
|
486
|
+
let :resource do
|
487
|
+
described_class.new(initial_values.merge(:provider => provider))
|
488
|
+
end
|
304
489
|
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
@mount.provider.stubs(:respond_to?).returns(false)
|
309
|
-
@mount.provider.stubs(:respond_to?).with("dump=").returns(true)
|
490
|
+
let :provider do
|
491
|
+
providerclass.new(initial_values)
|
492
|
+
end
|
310
493
|
|
311
|
-
|
494
|
+
def run_in_catalog(*resources)
|
495
|
+
Puppet::Util::Storage.stubs(:store)
|
496
|
+
catalog = Puppet::Resource::Catalog.new
|
497
|
+
catalog.add_resource *resources
|
498
|
+
catalog.apply
|
499
|
+
end
|
312
500
|
|
313
|
-
|
314
|
-
|
501
|
+
it "should use the provider to change the dump value" do
|
502
|
+
provider.expects(:dump=).with(1)
|
315
503
|
|
316
|
-
|
317
|
-
syncorder = sequence('syncorder')
|
318
|
-
@mount.provider.expects(:options).returns 'soft'
|
319
|
-
@mount.provider.expects(:ensure).returns :mounted
|
504
|
+
resource[:dump] = 1
|
320
505
|
|
321
|
-
|
322
|
-
|
506
|
+
run_in_catalog(resource)
|
507
|
+
end
|
323
508
|
|
324
|
-
|
325
|
-
|
326
|
-
@mount.expects(:flush).in_sequence(syncorder) # Call inside syncothers
|
327
|
-
@mount.expects(:flush).in_sequence(syncorder) # I guess transaction or anything calls flush again
|
509
|
+
it "should umount before flushing changes to disk" do
|
510
|
+
syncorder = sequence('syncorder')
|
328
511
|
|
329
|
-
|
512
|
+
provider.expects(:unmount).in_sequence(syncorder)
|
513
|
+
provider.expects(:options=).in_sequence(syncorder).with 'hard'
|
514
|
+
resource.expects(:flush).in_sequence(syncorder) # Call inside syncothers
|
515
|
+
resource.expects(:flush).in_sequence(syncorder) # I guess transaction or anything calls flush again
|
330
516
|
|
331
|
-
|
332
|
-
|
517
|
+
resource[:ensure] = :unmounted
|
518
|
+
resource[:options] = 'hard'
|
333
519
|
|
334
|
-
|
520
|
+
run_in_catalog(resource)
|
521
|
+
end
|
335
522
|
end
|
336
|
-
|
337
523
|
end
|