summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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