# module Puppet::Provider::Mount

A module just to store the mount/unmount methods. Individual providers still need to add the mount commands manually.

### Public Instance Methods

mount() click to toggle source

This only works when the mount point is synced to the fstab.

    # File lib/puppet/provider/mount.rb, line 7
    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.options if self.options and self.options != :absent
      args << resource[:name]

      mountcmd(*args)
      case get(:ensure)
      when :absent; set(:ensure => :ghost)
      when :unmounted; set(:ensure => :mounted)
      end
    end

mounted?() click to toggle source

Is the mount currently mounted?

    # File lib/puppet/provider/mount.rb, line 43
    def mounted?
      [:mounted, :ghost].include?(get(:ensure))
    end

remount() click to toggle source

    # File lib/puppet/provider/mount.rb, line 21
    def remount
      info "Remounting"
      if resource[:remounts] == :true
        mountcmd "-o", "remount", resource[:name]
      else
        unmount
        mount
      end
    end

unmount() click to toggle source

This only works when the mount point is synced to the fstab.

    # File lib/puppet/provider/mount.rb, line 32
    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