Sha256: c268d489324c8170aad0ff16d1482e3a92c955bb8cf744713ec9ca9a8c932f98

Contents?: true

Size: 1.21 KB

Versions: 67

Compression:

Stored size: 1.21 KB

Contents

require 'puppet'

# A module just to store the mount/unmount methods.  Individual providers
# still need to add the mount commands manually.
module Puppet::Provider::Mount
  # This only works when the mount point is synced to the fstab.
  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

  def remount
    info "Remounting"
    if resource[:remounts] == :true
      mountcmd "-o", "remount", resource[:name]
    else
      unmount
      mount
    end
  end

  # This only works when the mount point is synced to the fstab.
  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

  # Is the mount currently mounted?
  def mounted?
    [:mounted, :ghost].include?(get(:ensure))
  end
end

Version data entries

67 entries across 67 versions & 4 rubygems

Version Path
puppet-parse-0.1.4 lib/vendor/puppet/provider/mount.rb
puppet-parse-0.1.3 lib/vendor/puppet/provider/mount.rb
puppet-parse-0.1.2 lib/vendor/puppet/provider/mount.rb
puppet-parse-0.1.1 lib/vendor/puppet/provider/mount.rb
puppet-2.7.26 lib/puppet/provider/mount.rb
puppet-2.7.25 lib/puppet/provider/mount.rb
puppet-2.7.24 lib/puppet/provider/mount.rb
puppet-3.2.4 lib/puppet/provider/mount.rb
puppet-2.7.23 lib/puppet/provider/mount.rb
puppet-3.2.3 lib/puppet/provider/mount.rb
puppet-3.2.3.rc1 lib/puppet/provider/mount.rb
puppet-3.2.2 lib/puppet/provider/mount.rb
puppet-2.7.22 lib/puppet/provider/mount.rb
puppet-3.2.1 lib/puppet/provider/mount.rb
puppet-3.2.1.rc1 lib/puppet/provider/mount.rb
puppet-3.2.0.rc2 lib/puppet/provider/mount.rb
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/lib/puppet/provider/mount.rb
puppet-3.2.0.rc1 lib/puppet/provider/mount.rb
puppet-parse-0.1.0 lib/vendor/puppet/provider/mount.rb
puppet-parse-0.0.6 lib/vendor/puppet/provider/mount.rb