diff options
author | Luke Kanies <luke@madstop.com> | 2008-10-28 19:13:45 -0500 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2008-10-29 14:02:43 +1100 |
commit | 4806c51d309e43d0adc45d743a0ea85c3dc2da0d (patch) | |
tree | 4d92896e3effb7dcc20ca1bb22f12f7f0301f571 | |
parent | c7ccc4ba7c42d56595564491ae578a1604c628d1 (diff) | |
download | puppet-4806c51d309e43d0adc45d743a0ea85c3dc2da0d.tar.gz puppet-4806c51d309e43d0adc45d743a0ea85c3dc2da0d.tar.xz puppet-4806c51d309e43d0adc45d743a0ea85c3dc2da0d.zip |
Fixing #1669 - The dump parameter can now be changed on mounts.
Signed-off-by: Luke Kanies <luke@madstop.com>
-rwxr-xr-x | lib/puppet/type/mount.rb | 2 | ||||
-rwxr-xr-x | spec/unit/type/mount.rb | 29 |
2 files changed, 30 insertions, 1 deletions
diff --git a/lib/puppet/type/mount.rb b/lib/puppet/type/mount.rb index 1679b73a3..4eb149488 100755 --- a/lib/puppet/type/mount.rb +++ b/lib/puppet/type/mount.rb @@ -143,7 +143,7 @@ module Puppet desc "Whether to dump the mount. Not all platforms support this. Valid values are ``1`` or ``0``. Default is ``0``." - newvalue(%r{(0|1)}) { } + newvalue(%r{(0|1)}) defaultto { if @resource.managed? diff --git a/spec/unit/type/mount.rb b/spec/unit/type/mount.rb index a9b78672e..0a1ccaecf 100755 --- a/spec/unit/type/mount.rb +++ b/spec/unit/type/mount.rb @@ -188,3 +188,32 @@ describe Puppet::Type.type(:mount)::Ensure do end end end + +describe Puppet::Type.type(:mount), "when modifying an existing mount entry" do + before do + @provider = stub 'provider', :class => Puppet::Type.type(:mount).defaultprovider, :clear => nil, :satisfies? => true, :name => :mock, :remount => nil + Puppet::Type.type(:mount).defaultprovider.stubs(:new).returns(@provider) + @mount = Puppet::Type.type(:mount).create(:name => "yay", :ensure => :mounted) + + {:device => "/foo/bar", :blockdevice => "/other/bar", :target => "/what/ever", :fstype => 'eh', :options => "", :pass => 0, :dump => 0, :atboot => 0, + :ensure => :mounted}.each do + |param, value| + @mount.provider.stubs(param).returns value + @mount[param] = value + end + + @mount.provider.stubs(:mounted?).returns true + + @catalog = Puppet::Node::Catalog.new + @catalog.add_resource @mount + end + + it "should use the provider to change the dump value" do + @mount.provider.expects(:dump).returns 0 + @mount.provider.expects(:dump=).with(1) + + @mount[:dump] = 1 + + @catalog.apply + end +end |