diff options
author | Theodore Nordsieck <theo@opscode.com> | 2013-09-09 20:21:25 -0700 |
---|---|---|
committer | Theodore Nordsieck <theo@opscode.com> | 2013-09-11 16:13:24 -0700 |
commit | 679791e859e98bb76253b6b2cb7159e5b7b06ed0 (patch) | |
tree | 87ce0147c762c6669262ad7cbb69baa62de7d21e /lib/ohai | |
parent | 5e704bc63308c6c40183ddefdff1a9c805118ed7 (diff) | |
download | ohai-679791e859e98bb76253b6b2cb7159e5b7b06ed0.tar.gz |
Converted plugins/openbsd/filesystem to Mixlib::ShellOut.
Diffstat (limited to 'lib/ohai')
-rw-r--r-- | lib/ohai/plugins/openbsd/filesystem.rb | 46 |
1 files changed, 21 insertions, 25 deletions
diff --git a/lib/ohai/plugins/openbsd/filesystem.rb b/lib/ohai/plugins/openbsd/filesystem.rb index 5900f3a4..225b8ef4 100644 --- a/lib/ohai/plugins/openbsd/filesystem.rb +++ b/lib/ohai/plugins/openbsd/filesystem.rb @@ -23,35 +23,31 @@ Ohai.plugin do fs = Mash.new # Grab filesystem data from df - popen4("df") do |pid, stdin, stdout, stderr| - stdin.close - stdout.each do |line| - case line - when /^Filesystem/ - next - when /^(.+?)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+\%)\s+(.+)$/ - filesystem = $1 - fs[filesystem] = Mash.new - fs[filesystem]['kb_size'] = $2 - fs[filesystem]['kb_used'] = $3 - fs[filesystem]['kb_available'] = $4 - fs[filesystem]['percent_used'] = $5 - fs[filesystem]['mount'] = $6 - end + so = shell_out("df") + so.stdout.lines do |line| + case line + when /^Filesystem/ + next + when /^(.+?)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+\%)\s+(.+)$/ + filesystem = $1 + fs[filesystem] = Mash.new + fs[filesystem]['kb_size'] = $2 + fs[filesystem]['kb_used'] = $3 + fs[filesystem]['kb_available'] = $4 + fs[filesystem]['percent_used'] = $5 + fs[filesystem]['mount'] = $6 end end # Grab mount information from mount - popen4("mount -l") do |pid, stdin, stdout, stderr| - stdin.close - stdout.each do |line| - if line =~ /^(.+?) on (.+?) \((.+?), (.+?)\)$/ - filesystem = $1 - fs[filesystem] = Mash.new unless fs.has_key?(filesystem) - fs[filesystem]['mount'] = $2 - fs[filesystem]['fs_type'] = $3 - fs[filesystem]['mount-options'] = $4.split(/,\s*/) - end + so = shell_out("mount -l") + so.stdout.lines do |line| + if line =~ /^(.+?) on (.+?) \((.+?), (.+?)\)$/ + filesystem = $1 + fs[filesystem] = Mash.new unless fs.has_key?(filesystem) + fs[filesystem]['mount'] = $2 + fs[filesystem]['fs_type'] = $3 + fs[filesystem]['mount-options'] = $4.split(/,\s*/) end end |