lib/reporter/default/stats_disk.rb in onering-report-plugins-0.0.16 vs lib/reporter/default/stats_disk.rb in onering-report-plugins-0.0.17
- old
+ new
@@ -7,11 +7,11 @@
# mounts
#
mounts = {}
current_dev = nil
- File.open("/etc/mtab").each do |line|
+ File.read("/etc/mtab").lines.each do |line|
dev,mount,fstype,flags,dump,pass = line.split(/\s+/)
mounts[dev] = {
:mount => mount,
:device => dev,
@@ -19,11 +19,11 @@
:flags => flags.split(/\s*,\s*/)
}
end
# logical space utilization
- IO.popen("df").lines.each do |line|
+ Facter::Util::Resolution.exec("df 2> /dev/null").to_s.lines.each do |line|
next if line =~ /^Filesystem/
parts = line.split(/\s+/)
if parts.length == 1
current_dev = parts.first
@@ -46,11 +46,11 @@
# LVM
#
vg = {}
# volume groups
- IO.popen("vgdisplay -c 2> /dev/null").lines.each do |line|
+ Facter::Util::Resolution.exec("vgdisplay -c 2> /dev/null").to_s.lines.each do |line|
line = line.strip.chomp.split(':')
vg[line[0]] = {
:name => line[0],
:uuid => line[16],
@@ -65,11 +65,11 @@
:disks => []
}
end
# logical volumes
- IO.popen("lvdisplay -c 2> /dev/null").lines.each do |line|
+ Facter::Util::Resolution.exec("lvdisplay -c 2> /dev/null").to_s.lines.each do |line|
line = line.strip.chomp.split(':')
unless vg[line[1]].nil?
vg[line[1]][:volumes] << {
:name => line[0],
@@ -80,10 +80,10 @@
end
end
# physical volumes
- IO.popen("pvdisplay -c 2> /dev/null").lines.each do |line|
+ Facter::Util::Resolution.exec("pvdisplay -c 2> /dev/null").to_s.lines.each do |line|
line = line.strip.chomp.split(':')
unless vg[line[1]].nil?
vg[line[1]][:disks] << {
:name => line[0],
\ No newline at end of file