diff options
author | Jesse Wolfe <jes5199@gmail.com> | 2010-11-11 11:14:02 -0800 |
---|---|---|
committer | Jesse Wolfe <jes5199@gmail.com> | 2010-11-11 11:23:20 -0800 |
commit | 6f1416d7a4cec92ccff64d904d5fe799b8ff9a85 (patch) | |
tree | 7163d09c170c5d96072ac1540c6f2280c642de86 | |
parent | 3228a279c6df183309bfa89fb0d890360f6ff697 (diff) | |
download | puppet-6f1416d7a4cec92ccff64d904d5fe799b8ff9a85.tar.gz puppet-6f1416d7a4cec92ccff64d904d5fe799b8ff9a85.tar.xz puppet-6f1416d7a4cec92ccff64d904d5fe799b8ff9a85.zip |
Fix #4904 Mounts shouldn't remount unless they are ensure=>mounted
After we fixed issue #2730, it is now possible to manage an fstab entry
without asking puppet to try to call mount or unmount on that device.
That fix failed to address the "refresh" behavior of mounts.
We have changed "refresh" to only remount devices that are set to
"mounted", so users can truly manage fstab entries without having
puppet try to remount them.
Paired-With: Paul Berry <paul@puppetlabs.com>
-rwxr-xr-x | lib/puppet/type/mount.rb | 2 | ||||
-rwxr-xr-x | spec/unit/type/mount_spec.rb | 32 |
2 files changed, 28 insertions, 6 deletions
diff --git a/lib/puppet/type/mount.rb b/lib/puppet/type/mount.rb index d048c90f1..e8c6b3290 100755 --- a/lib/puppet/type/mount.rb +++ b/lib/puppet/type/mount.rb @@ -210,7 +210,7 @@ module Puppet def refresh # Only remount if we're supposed to be mounted. - provider.remount if self.should(:fstype) != "swap" and provider.mounted? + provider.remount if self.should(:fstype) != "swap" and self.should(:ensure) == :mounted end def value(name) diff --git a/spec/unit/type/mount_spec.rb b/spec/unit/type/mount_spec.rb index ce82cb516..4aa9baf70 100755 --- a/spec/unit/type/mount_spec.rb +++ b/spec/unit/type/mount_spec.rb @@ -203,23 +203,45 @@ describe Puppet::Type.type(:mount)::Ensure do end end - describe Puppet::Type.type(:mount), "when responding to events" do + describe Puppet::Type.type(:mount), "when responding to refresh" do - it "should remount if it is currently mounted" do - @provider.expects(:mounted?).returns(true) + it "should remount if it is supposed to be mounted" do + @mount[:ensure] = "mounted" @provider.expects(:remount) @mount.refresh end - it "should not remount if it is not currently mounted" do - @provider.expects(:mounted?).returns(false) + it "should not remount if it is supposed to be present" do + @mount[:ensure] = "present" + @provider.expects(:remount).never + + @mount.refresh + end + + it "should not remount if it is supposed to be absent" do + @mount[:ensure] = "absent" + @provider.expects(:remount).never + + @mount.refresh + end + + it "should not remount if it is supposed to be defined" do + @mount[:ensure] = "defined" + @provider.expects(:remount).never + + @mount.refresh + end + + it "should not remount if it is supposed to be unmounted" do + @mount[:ensure] = "unmounted" @provider.expects(:remount).never @mount.refresh end it "should not remount swap filesystems" do + @mount[:ensure] = "mounted" @mount[:fstype] = "swap" @provider.expects(:remount).never |