summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJerome Charaoui <jcharaoui@cmaisonneuve.qc.ca>2015-02-12 15:02:40 -0500
committerJerome Charaoui <jcharaoui@cmaisonneuve.qc.ca>2015-02-12 15:02:40 -0500
commit92569fe8cf9770fde6a5e2bde79ad2f5978e0224 (patch)
tree2adf57c2bc189eb06a35420176d10e723b166eaa /lib
parentf87223c4cbd6445010b7189f06b043286c3b1958 (diff)
Don't screw up ENV["PATH"] for other platforms
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|