From 3f583dc133ce50ae34bfc151474c6d4196f803ca Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Thu, 8 Nov 2007 17:06:00 -0600 Subject: 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. --- lib/puppet/provider/mount.rb | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'lib/puppet') 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 -- cgit