summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Dibowitz <phil@ipom.com>2014-12-16 18:24:50 -0800
committerPhil Dibowitz <phil@ipom.com>2014-12-16 18:24:50 -0800
commitdbe22154cb0963446bed151751e8e86f698f43d0 (patch)
tree41c4a8b19a76f30162374b75b470f01719f3ee6c
parent4c21cf45891207a8b957cccdec2cd23439cbeceb (diff)
parent7af3bcd103aee76a645bf2d548cb486f33129097 (diff)
downloadohai-dbe22154cb0963446bed151751e8e86f698f43d0.tar.gz
Merge pull request #446 from jaymzh/df
Always use posix output
-rw-r--r--lib/ohai/plugins/linux/filesystem.rb2
-rw-r--r--spec/unit/plugins/linux/filesystem_spec.rb14
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/ohai/plugins/linux/filesystem.rb b/lib/ohai/plugins/linux/filesystem.rb
index d01d5294..ced1a6a9 100644
--- a/lib/ohai/plugins/linux/filesystem.rb
+++ b/lib/ohai/plugins/linux/filesystem.rb
@@ -62,7 +62,7 @@ Ohai.plugin(:Filesystem) do
end
# Grab filesystem inode data from df
- so = shell_out("df -i")
+ so = shell_out("df -iP")
so.stdout.lines do |line|
case line
when /^Filesystem\s+Inodes/
diff --git a/spec/unit/plugins/linux/filesystem_spec.rb b/spec/unit/plugins/linux/filesystem_spec.rb
index 9bbccc45..651c6fd9 100644
--- a/spec/unit/plugins/linux/filesystem_spec.rb
+++ b/spec/unit/plugins/linux/filesystem_spec.rb
@@ -24,7 +24,7 @@ describe Ohai::System, "Linux filesystem plugin" do
allow(@plugin).to receive(:collect_os).and_return(:linux)
allow(@plugin).to receive(:shell_out).with("df -P").and_return(mock_shell_out(0, "", ""))
- allow(@plugin).to receive(:shell_out).with("df -i").and_return(mock_shell_out(0, "", ""))
+ allow(@plugin).to receive(:shell_out).with("df -iP").and_return(mock_shell_out(0, "", ""))
allow(@plugin).to receive(:shell_out).with("mount").and_return(mock_shell_out(0, "", ""))
allow(File).to receive(:exist?).with("/bin/lsblk").and_return(false)
allow(@plugin).to receive(:shell_out).with("blkid -s TYPE").and_return(mock_shell_out(0, "", ""))
@@ -81,12 +81,12 @@ tmpfs 126922 273 126649 1% /run
none 126922 1 126921 1% /run/lock
none 126922 1 126921 1% /run/shm
DFi
- allow(@plugin).to receive(:shell_out).with("df -i").and_return(mock_shell_out(0, @inode_stdout, ""))
+ allow(@plugin).to receive(:shell_out).with("df -iP").and_return(mock_shell_out(0, @inode_stdout, ""))
end
- it "should run df -P and df -i" do
+ it "should run df -P and df -iP" do
expect(@plugin).to receive(:shell_out).ordered.with("df -P").and_return(mock_shell_out(0, @stdout, ""))
- expect(@plugin).to receive(:shell_out).ordered.with("df -i").and_return(mock_shell_out(0, @inode_stdout, ""))
+ expect(@plugin).to receive(:shell_out).ordered.with("df -iP").and_return(mock_shell_out(0, @inode_stdout, ""))
@plugin.run
end
@@ -115,17 +115,17 @@ DFi
expect(@plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:mount]).to eq("/special")
end
- it "should set total_inodes to value from df -i" do
+ it "should set total_inodes to value from df -iP" do
@plugin.run
expect(@plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:total_inodes]).to eq("124865")
end
- it "should set inodes_used to value from df -i" do
+ it "should set inodes_used to value from df -iP" do
@plugin.run
expect(@plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:inodes_used]).to eq("380")
end
- it "should set inodes_available to value from df -i" do
+ it "should set inodes_available to value from df -iP" do
@plugin.run
expect(@plugin[:filesystem]["/dev/mapper/sys.vg-special.lv"][:inodes_available]).to eq("124485")
end