summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-10-30 13:24:37 -0700
committerGitHub <noreply@github.com>2020-10-30 13:24:37 -0700
commit9be221cfe5e43860d2e4cba1e8e20b3a3208cfb2 (patch)
tree81589cc9b6ce4584c1e590ab161cae8dab9dfa1f
parentad80cbb070812f016a5f2926095088ab40751218 (diff)
parent3bc62dd32defaa16ded539cbf4365f83c7323b6a (diff)
downloadohai-9be221cfe5e43860d2e4cba1e8e20b3a3208cfb2.tar.gz
Merge pull request #1547 from chef/more_zpool
Gather zpool disks even if zpools uses disk labels/guids
-rw-r--r--lib/ohai/plugins/zpools.rb4
-rw-r--r--spec/unit/plugins/zpools_spec.rb4
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/ohai/plugins/zpools.rb b/lib/ohai/plugins/zpools.rb
index 0bf40a73..e27bf610 100644
--- a/lib/ohai/plugins/zpools.rb
+++ b/lib/ohai/plugins/zpools.rb
@@ -65,7 +65,9 @@ Ohai.plugin(:Zpools) do
if platform_family == "solaris2"
command = "su adm -c \"zpool status #{pool}\""
else
- command = "zpool status #{pool}"
+ # -L is used to give us real device names not label or uuid
+ # for example sda instead of ata-WDC_WD60EZAZ-00SF3B0_WD-WX32D203UXYK
+ command = "zpool status #{pool} -L"
end
so = shell_out(command)
diff --git a/spec/unit/plugins/zpools_spec.rb b/spec/unit/plugins/zpools_spec.rb
index 5ed5a559..931689b7 100644
--- a/spec/unit/plugins/zpools_spec.rb
+++ b/spec/unit/plugins/zpools_spec.rb
@@ -71,8 +71,8 @@ describe Ohai::System, "zpools plugin" do
allow(plugin).to receive(:platform_family).and_return("rhel")
allow(plugin).to receive(:collect_os).and_return(:linux)
allow(plugin).to receive(:shell_out).with("zpool list -H -o name,size,alloc,free,cap,dedup,health,version").and_return(mock_shell_out(0, zpool_out, ""))
- allow(plugin).to receive(:shell_out).with("zpool status rpool").and_return(mock_shell_out(0, zpool_status_rpool, ""))
- allow(plugin).to receive(:shell_out).with("zpool status tank").and_return(mock_shell_out(0, zpool_status_tank, ""))
+ allow(plugin).to receive(:shell_out).with("zpool status rpool -L").and_return(mock_shell_out(0, zpool_status_rpool, ""))
+ allow(plugin).to receive(:shell_out).with("zpool status tank -L").and_return(mock_shell_out(0, zpool_status_tank, ""))
end
it "Has entries for both zpools" do