From 8af6b759363c6b8d95559c44efbfbd99927cdab2 Mon Sep 17 00:00:00 2001 From: Phil Dibowitz Date: Tue, 16 Dec 2014 09:26:10 -0800 Subject: Always use posix output Otherwise you get multiline and end up with garbage entries. --- lib/ohai/plugins/linux/filesystem.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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/ -- cgit v1.2.1 From 7af3bcd103aee76a645bf2d548cb486f33129097 Mon Sep 17 00:00:00 2001 From: Phil Dibowitz Date: Tue, 16 Dec 2014 10:14:19 -0800 Subject: Fix up tests --- spec/unit/plugins/linux/filesystem_spec.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 -- cgit v1.2.1