Module: Puppet::Provider::Mount
- Defined in:
- lib/puppet/provider/mount.rb
Overview
A module just to store the mount/unmount methods. Individual providers still need to add the mount commands manually.
Instance Method Summary collapse
-
#mount ⇒ Object
This only works when the mount point is synced to the fstab.
-
#mounted? ⇒ Boolean
Is the mount currently mounted?.
- #remount ⇒ Object
-
#unmount ⇒ Object
This only works when the mount point is synced to the fstab.
Instance Method Details
#mount ⇒ Object
This only works when the mount point is synced to the fstab.
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/puppet/provider/mount.rb', line 10 def mount # Manually pass the mount options in, since some OSes *cough*OS X*cough* don't # read from /etc/fstab but still want to use this type. args = [] args << "-o" << self. if self. and self. != :absent args << resource[:name] mountcmd(*args) case get(:ensure) when :absent; set(:ensure => :ghost) when :unmounted; set(:ensure => :mounted) end end |
#mounted? ⇒ Boolean
Is the mount currently mounted?
46 47 48 |
# File 'lib/puppet/provider/mount.rb', line 46 def mounted? [:mounted, :ghost].include?(get(:ensure)) end |
#remount ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/puppet/provider/mount.rb', line 24 def remount info "Remounting" if resource[:remounts] == :true mountcmd "-o", "remount", resource[:name] else unmount mount end end |
#unmount ⇒ Object
This only works when the mount point is synced to the fstab.
35 36 37 38 39 40 41 42 43 |
# File 'lib/puppet/provider/mount.rb', line 35 def unmount umount(resource[:name]) # Update property hash for future queries (e.g. refresh is called) case get(:ensure) when :mounted; set(:ensure => :unmounted) when :ghost; set(:ensure => :absent) end end |