summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-07-20 16:46:54 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-07-20 16:46:54 +0000
commit2229dc1621106510a34d1ce80cbec883f8b2af8c (patch)
tree1635127033d7797b58b43ec2f1fda7a0de86591e
parent47b705883bfdb38e3f94cba129936f70e3153735 (diff)
downloadpuppet-2229dc1621106510a34d1ce80cbec883f8b2af8c.tar.gz
puppet-2229dc1621106510a34d1ce80cbec883f8b2af8c.tar.xz
puppet-2229dc1621106510a34d1ce80cbec883f8b2af8c.zip
Fixing #726 -- mounts can now correctly handle mounted but absent filesystems.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2723 980ebf18-57e1-0310-9a29-db15c13687c0
-rwxr-xr-xlib/puppet/type/mount.rb16
-rwxr-xr-xtest/ral/types/mount.rb17
2 files changed, 31 insertions, 2 deletions
diff --git a/lib/puppet/type/mount.rb b/lib/puppet/type/mount.rb
index b2686a20e..2a393391d 100755
--- a/lib/puppet/type/mount.rb
+++ b/lib/puppet/type/mount.rb
@@ -49,11 +49,23 @@ module Puppet
end
syncothers()
- provider.mount
+ # The fs can be already mounted if it was absent but mounted
+ unless provider.mounted?
+ provider.mount
+ end
end
def retrieve
- return provider.mounted? ? :mounted : super()
+ # We need to special case :mounted; if we're absent, we still
+ # want
+ curval = super()
+ if curval == :absent
+ return curval
+ elsif provider.mounted?
+ return :mounted
+ else
+ return curval
+ end
end
def syncothers
diff --git a/test/ral/types/mount.rb b/test/ral/types/mount.rb
index 201156f50..c4314db98 100755
--- a/test/ral/types/mount.rb
+++ b/test/ral/types/mount.rb
@@ -3,6 +3,7 @@
$:.unshift("../../lib") if __FILE__ =~ /\.rb$/
require 'puppettest'
+require 'mocha'
unless Facter.value(:operatingsystem) == "Darwin"
class TestMounts < PuppetTest::TestCase
@@ -339,6 +340,22 @@ class TestMounts < PuppetTest::TestCase
assert(value != :absent, "Got :absent for %s" % property.name)
end
end
+
+ # #726 - when filesystems are mounted but absent, Puppet does not write them out.
+ def test_mounted_but_absent
+ mount = @mount.create(:name => "/testing", :ensure => :mounted, :provider => :fake, :device => "/dev/something")
+
+ class << mount.provider
+ def mounted?
+ true
+ end
+ end
+
+ mount.provider.destroy
+ mount.provider.expects(:create)
+ mount.provider.expects(:mount).never
+ assert_apply(mount)
+ end
end
end