summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhillip Hellewell <sshock@gmail.com>2019-12-31 00:06:15 -0700
committerPhillip Hellewell <sshock@gmail.com>2019-12-31 01:11:43 -0700
commit37bd31de1fb9e138a25fcd3ddbcf8d16b52a46c7 (patch)
tree24dbd379ca9d6f3d7b26850e79658b8e692c7409
parentdd994a596750c6061c744392fc01840d25e9e69e (diff)
downloadohai-37bd31de1fb9e138a25fcd3ddbcf8d16b52a46c7.tar.gz
fix volume name in windows filesystems
it was looking at the wrong property, resulting in the volume name always being blank; now it works Signed-off-by: Phillip Hellewell <sshock@gmail.com>
-rw-r--r--lib/ohai/plugins/filesystem.rb2
-rw-r--r--spec/unit/plugins/windows/filesystem_spec.rb6
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/ohai/plugins/filesystem.rb b/lib/ohai/plugins/filesystem.rb
index 9dfcc719..483986b4 100644
--- a/lib/ohai/plugins/filesystem.rb
+++ b/lib/ohai/plugins/filesystem.rb
@@ -236,7 +236,7 @@ Ohai.plugin(:Filesystem) do
property = Mash.new
# In windows the closet thing we have to a device is the volume_name
# and the "mountpoint" is the drive letter...
- device = disk["volume_name"].to_s.downcase
+ device = disk["volumename"].to_s.downcase
mount = disk["deviceid"]
property[:kb_size] = disk["size"] ? disk["size"].to_i / 1000 : 0
property[:kb_available] = disk["freespace"].to_i / 1000
diff --git a/spec/unit/plugins/windows/filesystem_spec.rb b/spec/unit/plugins/windows/filesystem_spec.rb
index 62996897..d3e17464 100644
--- a/spec/unit/plugins/windows/filesystem_spec.rb
+++ b/spec/unit/plugins/windows/filesystem_spec.rb
@@ -33,7 +33,7 @@ describe Ohai::System, "Windows Filesystem Plugin", :windows_only do
"filesystem" => "NTFS",
"freespace" => "100000",
"name" => "C:",
- "volumename " => "",
+ # omit "volumename"; it will be added in (some) tests below
},
{
"caption" => "D:",
@@ -42,7 +42,7 @@ describe Ohai::System, "Windows Filesystem Plugin", :windows_only do
"filesystem" => "FAT32",
"freespace" => "100000",
"name" => "D:",
- # Lets not pass "volumename" for this drive
+ # omit "volumename"; it will be added in (some) tests below
},
]
end
@@ -116,7 +116,7 @@ describe Ohai::System, "Windows Filesystem Plugin", :windows_only do
context "when there are volume names" do
before do
ldi = logical_disks_instances
- ldi.each_with_index { |d, i| d["volume_name"] = "Volume #{i}" }
+ ldi.each_with_index { |d, i| d["volumename"] = "Volume #{i}" }
allow(plugin).to receive(:logical_info).and_return(plugin.logical_properties(ldi))
allow(plugin).to receive(:encryptable_info).and_return(plugin.encryption_properties(encryptable_volume_instances))
plugin.run