diff options
author | Luke Kanies <luke@madstop.com> | 2007-11-08 17:06:00 -0600 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2007-11-08 17:06:00 -0600 |
commit | 3f583dc133ce50ae34bfc151474c6d4196f803ca (patch) | |
tree | 5bbca2e0a72425b34cdf39facdee8d9f14e7831c /lib | |
parent | 964aebb96416984815f5ef74e36825915d52fe2a (diff) | |
download | puppet-3f583dc133ce50ae34bfc151474c6d4196f803ca.tar.gz puppet-3f583dc133ce50ae34bfc151474c6d4196f803ca.tar.xz puppet-3f583dc133ce50ae34bfc151474c6d4196f803ca.zip |
Adding unit tests for the module that handles the
logic around mounting and unmounting. This includes a fix for
bug #761, which required a different regex for Solaris.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/provider/mount.rb | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/puppet/provider/mount.rb b/lib/puppet/provider/mount.rb index 6a05d9826..a63a0402c 100644 --- a/lib/puppet/provider/mount.rb +++ b/lib/puppet/provider/mount.rb @@ -14,7 +14,7 @@ module Puppet::Provider::Mount if self.options and self.options != :absent args << "-o" << self.options end - args << @resource[:name] + args << resource[:name] if respond_to?(:flush) flush @@ -24,8 +24,8 @@ module Puppet::Provider::Mount def remount info "Remounting" - if @resource[:remounts] == :true - mountcmd "-o", "remount", @resource[:name] + if resource[:remounts] == :true + mountcmd "-o", "remount", resource[:name] else unmount() mount() @@ -34,16 +34,19 @@ module Puppet::Provider::Mount # This only works when the mount point is synced to the fstab. def unmount - umount @resource[:name] + umount resource[:name] end # Is the mount currently mounted? def mounted? - platform = Facter["operatingsystem"].value - name = @resource[:name] + platform = Facter.value("operatingsystem") + name = resource[:name] mounts = mountcmd.split("\n").find do |line| - if platform == "Darwin" + case platform + when "Darwin" line =~ / on #{name} / or line =~ %r{ on /private/var/automount#{name}} + when "Solaris" + line =~ /^#{name} on / else line =~ / on #{name} / end |