diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-11-12 21:25:13 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-11-12 21:25:13 +0000 |
| commit | 4d5f70f017c744229ea83cda03c2c4334a010d1d (patch) | |
| tree | 54985b8c5f9412efdaa956b5919dd69afd363e7a /lib/puppet/provider/mount.rb | |
| parent | bd169b44a0ce58413fb5b031c3f12cd4ca6f4cbe (diff) | |
| download | puppet-4d5f70f017c744229ea83cda03c2c4334a010d1d.tar.gz puppet-4d5f70f017c744229ea83cda03c2c4334a010d1d.tar.xz puppet-4d5f70f017c744229ea83cda03c2c4334a010d1d.zip | |
Trying to get a netinfo provider for mounts working, but i give up. I am leaving it in place but marked as highly experimental.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1860 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/provider/mount.rb')
| -rw-r--r-- | lib/puppet/provider/mount.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/puppet/provider/mount.rb b/lib/puppet/provider/mount.rb new file mode 100644 index 000000000..d3597ef15 --- /dev/null +++ b/lib/puppet/provider/mount.rb @@ -0,0 +1,39 @@ +# 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 + mountcmd @model[:name] + end + + # This only works when the mount point is synced to the fstab. + def unmount + umount @model[:name] + end + + # Is the mount currently mounted? + def mounted? + platform = Facter["operatingsystem"].value + df = command(:df) + case Facter["operatingsystem"].value + # Solaris's df prints in a very weird format + when "Solaris": df = "#{command(:df)} -k" + end + %x{#{df}}.split("\n").find do |line| + fs = line.split(/\s+/)[-1] + if platform == "Darwin" + fs == "/private/var/automount" + @model[:name] or + fs == @model[:name] + else + fs == @model[:name] + end + end + end +end + +# $Id$
\ No newline at end of file |
