summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPaul Berry <paul@puppetlabs.com>2011-03-08 11:35:58 -0800
committerPaul Berry <paul@puppetlabs.com>2011-03-08 13:04:39 -0800
commit5ef10315705b8e4d69d13b8df86b9585f2bcc29a (patch)
tree049e9d8343d023c7eea67103ce60d9bef9879960 /lib
parentbd5517dd9cd8e10f488713d9654957746e687378 (diff)
downloadpuppet-5ef10315705b8e4d69d13b8df86b9585f2bcc29a.tar.gz
puppet-5ef10315705b8e4d69d13b8df86b9585f2bcc29a.tar.xz
puppet-5ef10315705b8e4d69d13b8df86b9585f2bcc29a.zip
(#6632) Adding a new mount no longer causes error with umount
There were two problems: * In lib/puppet/type/mount.rb, we were calling provider.mounted? to determine whether we needed to execute "mount" after updating the in-memory fstab record. This wasn't working properly because provider.mounted? makes its decision based on the data stored in the in-memory fstab record. Since the fstab record had just been updated, provider.mounted? was incorrectly returning true even though the device wasn't actually mounted. Fixed this by checking provider.mounted? before updating the in-memory fstab record. * Calling mount from this point in lib/puppet/type/mount.rb is actually too early, because even though the in-memory fstab record has been created, its contents have not been written to `/etc/fstab` yet. Fixed this by storing a :needs_mount entry in the property_hash and checking it at the end of the flush() method. Reviewed-by: Jacob Helwig <jacob@puppetlabs.com>
Diffstat (limited to 'lib')
-rwxr-xr-xlib/puppet/provider/mount/parsed.rb6
-rwxr-xr-xlib/puppet/type/mount.rb3
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/puppet/provider/mount/parsed.rb b/lib/puppet/provider/mount/parsed.rb
index 42e543c15..11c5e21a9 100755
--- a/lib/puppet/provider/mount/parsed.rb
+++ b/lib/puppet/provider/mount/parsed.rb
@@ -97,4 +97,10 @@ Puppet::Type.type(:mount).provide(
end
instances
end
+
+ def flush
+ needs_mount = @property_hash.delete(:needs_mount)
+ super
+ mount if needs_mount
+ end
end
diff --git a/lib/puppet/type/mount.rb b/lib/puppet/type/mount.rb
index 98a1f2509..5b8c5ca58 100755
--- a/lib/puppet/type/mount.rb
+++ b/lib/puppet/type/mount.rb
@@ -74,12 +74,13 @@ module Puppet
newvalue(:mounted, :event => :mount_mounted) do
# Create the mount point if it does not already exist.
current_value = self.retrieve
+ currently_mounted = provider.mounted?
provider.create if [nil, :absent, :ghost].include?(current_value)
syncothers
# The fs can be already mounted if it was absent but mounted
- provider.mount unless provider.mounted?
+ provider.property_hash[:needs_mount] = true unless currently_mounted
end
# insync: mounted -> present