The instances method now behaves similar to the prefetch method. At first /etc/(v)fstab is parsed to find mounts. After that the mount command is run to update the ensure state from :unmounted to :mounted.
The instances method however does not take mounted devices into account that are currently not present in /etc/fstab because these mounts would also be listed when running »puppet resource mount« which is not desired Signed-off-by: Stefan Schulte <[email protected]> --- lib/puppet/provider/mount/parsed.rb | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/lib/puppet/provider/mount/parsed.rb b/lib/puppet/provider/mount/parsed.rb index 11c5e21..8610e46 100755 --- a/lib/puppet/provider/mount/parsed.rb +++ b/lib/puppet/provider/mount/parsed.rb @@ -47,6 +47,20 @@ Puppet::Type.type(:mount).provide( end end + def self.instances + providers = super + mounts = mountinstances + + # Update fstab entries that are mounted + providers.each do |prov| + if mounts.include?({:name => prov.get(:name), :mounted => :yes}) then + prov.set(:ensure => :mounted) + end + end + + providers + end + def self.prefetch(resources = nil) # Get providers for all resources the user defined and that match # a record in /etc/fstab. -- 1.7.5.rc3 -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
