diff options
| author | Stefan Schulte <stefan.schulte@taunusstein.net> | 2011-05-01 15:22:17 +0200 |
|---|---|---|
| committer | Nick Lewis <nick@puppetlabs.com> | 2011-05-16 14:53:05 -0700 |
| commit | 0b8ebaccfef829856720c29c3bc00c042a515c71 (patch) | |
| tree | 19a93e9aca518e68756582bba7062f11e5217cba /lib | |
| parent | 1f3b8e755883c865026f3d76459000b808f5a3b0 (diff) | |
| download | puppet-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-x | lib/puppet/provider/mount/parsed.rb | 18 |
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. |
