summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorStefan Schulte <stefan.schulte@taunusstein.net>2011-05-01 15:22:17 +0200
committerNick Lewis <nick@puppetlabs.com>2011-05-16 14:53:05 -0700
commit0b8ebaccfef829856720c29c3bc00c042a515c71 (patch)
tree19a93e9aca518e68756582bba7062f11e5217cba /lib
parent1f3b8e755883c865026f3d76459000b808f5a3b0 (diff)
downloadpuppet-0b8ebaccfef829856720c29c3bc00c042a515c71.tar.gz
puppet-0b8ebaccfef829856720c29c3bc00c042a515c71.tar.xz
puppet-0b8ebaccfef829856720c29c3bc00c042a515c71.zip
(#7300) Fix instances method of mount provider
The instance method now behaves like the prefetch method: After parsing /etc/(v)fstab run mount to update the ensure state from either :unmounted to :mounted and from :absent to :ghost Reviewed-By: Nick Lewis Reviewed-By: Josh Cooper
Diffstat (limited to 'lib')
-rwxr-xr-xlib/puppet/provider/mount/parsed.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/puppet/provider/mount/parsed.rb b/lib/puppet/provider/mount/parsed.rb
index 11c5e21a9..13613a974 100755
--- a/lib/puppet/provider/mount/parsed.rb
+++ b/lib/puppet/provider/mount/parsed.rb
@@ -47,6 +47,24 @@ Puppet::Type.type(:mount).provide(
end
end
+ def self.instances
+ providers = super
+ mounts = mountinstances.dup
+
+ # Update fstab entries that are mounted
+ providers.each do |prov|
+ if mounts.delete({:name => prov.get(:name), :mounted => :yes}) then
+ prov.set(:ensure => :mounted)
+ end
+ end
+
+ # Add mounts that are not in fstab but mounted
+ mounts.each do |mount|
+ providers << new(:ensure => :ghost, :name => mount[:name])
+ end
+ providers
+ end
+
def self.prefetch(resources = nil)
# Get providers for all resources the user defined and that match
# a record in /etc/fstab.