summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/facter/mountpoints.rb28
1 files changed, 15 insertions, 13 deletions
diff --git a/lib/facter/mountpoints.rb b/lib/facter/mountpoints.rb
index c51e6e6..da2f2a9 100644
--- a/lib/facter/mountpoints.rb
+++ b/lib/facter/mountpoints.rb
@@ -12,21 +12,23 @@ begin
require 'filesystem'
rescue Exception => e
confine :kernel => :linux
- ENV["PATH"]="/bin:/sbin:/usr/bin:/usr/sbin"
- fs_source = nil
- if FileTest.exists?("/etc/mtab")
- fs_source = "/etc/mtab"
- elsif FileTest.exists?("/proc/mounts")
- fs_source = "/proc/mounts"
- end
+ setcode do
+ ENV["PATH"]="/bin:/sbin:/usr/bin:/usr/sbin"
+ fs_source = nil
+ if FileTest.exists?("/etc/mtab")
+ fs_source = "/etc/mtab"
+ elsif FileTest.exists?("/proc/mounts")
+ fs_source = "/proc/mounts"
+ end
- mounts = File.read(fs_source).split("\n")
- mounts.each do |mount|
- mount = mount.split(" ")
- if ((not ignorefs.include?(mount[2])) && (mount[3] !~ /bind/) && (not devices.include?(mount[0])) && (not mountpoints.include?(mount[1])))
- mountpoints.push(mount[1])
+ mounts = File.read(fs_source).split("\n")
+ mounts.each do |mount|
+ mount = mount.split(" ")
+ if ((not ignorefs.include?(mount[2])) && (mount[3] !~ /bind/) && (not devices.include?(mount[0])) && (not mountpoints.include?(mount[1])))
+ mountpoints.push(mount[1])
+ end
+ devices.push(mount[0]) if not devices.include?(mount[0])
end
- devices.push(mount[0]) if not devices.include?(mount[0])
end
else
FileSystem.mounts.each do |m|