diff --git a/lib/puppet/provider/mount.rb b/lib/puppet/provider/mount.rb index c979f742f..354ddb16d 100644 --- a/lib/puppet/provider/mount.rb +++ b/lib/puppet/provider/mount.rb @@ -1,53 +1,53 @@ # Created by Luke Kanies on 2006-11-12. # Copyright (c) 2006. All rights reserved. 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] flush if respond_to?(:flush) mountcmd(*args) 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] end # Is the mount currently mounted? def mounted? platform = Facter.value("operatingsystem") name = resource[:name] mounts = mountcmd.split("\n").find do |line| case platform when "Darwin" line =~ / on #{name} / or line =~ %r{ on /private/var/automount#{name}} when "Solaris", "HP-UX" line =~ /^#{name} on / when "AIX" - line.split(/\s+/)[1] == name + line.split(/\s+/)[2] == name else line =~ / on #{name} / end end end end diff --git a/spec/fixtures/unit/provider/mount/mount-output.aix.txt b/spec/fixtures/unit/provider/mount/mount-output.aix.txt index 54edb9c1c..380dbc5ae 100644 --- a/spec/fixtures/unit/provider/mount/mount-output.aix.txt +++ b/spec/fixtures/unit/provider/mount/mount-output.aix.txt @@ -1,7 +1,7 @@ -/dev/hd4 / jfs2 Nov 11 12:11 rw,log=/dev/hd8 -/dev/hd2 /usr jfs2 Nov 11 12:11 rw,log=/dev/hd8 -/dev/hd9var /var jfs2 Nov 11 12:11 rw,log=/dev/hd8 -/dev/hd3 /tmp jfs2 Nov 11 12:11 rw,log=/dev/hd8 -/dev/hd1 /home jfs2 Nov 11 12:11 rw,log=/dev/hd8 -/proc /proc procfs Nov 11 12:11 rw -/dev/hd10opt /opt jfs2 Nov 11 12:11 rw,log=/dev/hd8 +node mounted mounted over vfs date options +---- ------- ------------ --- ------------ ------------------- + /dev/hd0 / jfs Dec 17 08:04 rw, log =/dev/hd8 + /dev/hd3 /tmp jfs Dec 17 08:04 rw, log =/dev/hd8 + /dev/hd1 /home jfs Dec 17 08:06 rw, log =/dev/hd8 + /dev/hd2 /usr jfs Dec 17 08:06 rw, log =/dev/hd8 +sue /home/local/src /usr/code nfs Dec 17 08:06 ro, log =/dev/hd8