diff options
author | Lamont Granquist <lamont@opscode.com> | 2021-04-26 17:51:24 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-26 17:51:24 -0700 |
commit | 2ee84c83efdd9d2ca12600413fdf9f0d1628b71e (patch) | |
tree | 2ee204869a6e2f4b2bef57fa3872f08220cabf74 | |
parent | 7f804c26dfc6e830b5ee2407c6eb9547a0cd23a3 (diff) | |
parent | f1396ac921b3ea6a6a7a96eb2de1551389fc3a09 (diff) | |
download | ohai-2ee84c83efdd9d2ca12600413fdf9f0d1628b71e.tar.gz |
Merge pull request #1662 from jaymzh/windows-fs
Chef 17: Set 'filesystem' to be new-style data on Windows
-rw-r--r-- | lib/ohai/plugins/filesystem.rb | 15 | ||||
-rw-r--r-- | spec/unit/plugins/windows/filesystem_spec.rb | 16 |
2 files changed, 12 insertions, 19 deletions
diff --git a/lib/ohai/plugins/filesystem.rb b/lib/ohai/plugins/filesystem.rb index 6214853c..e86d0908 100644 --- a/lib/ohai/plugins/filesystem.rb +++ b/lib/ohai/plugins/filesystem.rb @@ -98,14 +98,6 @@ Ohai.plugin(:Filesystem) do view end - def generate_deprecated_windows_view(fs) - view = generate_mountpoint_view(fs) - view.each do |mp, entry| - view[mp].delete("devices") - end - view - end - def parse_common_df(out) fs = {} out.each_line do |line| @@ -720,9 +712,10 @@ Ohai.plugin(:Filesystem) do fs_data["by_mountpoint"] = by_mountpoint fs_data["by_pair"] = by_pair - # Set the filesystem data - Windows didn't do the conversion when everyone - # else did, so 15 will have both be the new API and 16 will drop the old API - filesystem generate_deprecated_windows_view(fs) + # Chef 16 added 'filesystem2' + # In Chef 17 we made 'filesystem' and 'filesystem2' match (both new-style) + # In Chef 18 we will drop 'filesystem2' + filesystem fs_data filesystem2 fs_data end end diff --git a/spec/unit/plugins/windows/filesystem_spec.rb b/spec/unit/plugins/windows/filesystem_spec.rb index 82095953..ac7a54b9 100644 --- a/spec/unit/plugins/windows/filesystem_spec.rb +++ b/spec/unit/plugins/windows/filesystem_spec.rb @@ -89,8 +89,8 @@ describe Ohai::System, "Windows Filesystem Plugin", :windows_only do "kb_used" => 9900, "percent_used" => 99, }.each do |k, v| - expect(plugin[:filesystem]["C:"][k]).to eq(v) - expect(plugin[:filesystem]["D:"][k]).to eq(v) + expect(plugin[:filesystem]["by_pair"][",C:"][k]).to eq(v) + expect(plugin[:filesystem]["by_pair"][",D:"][k]).to eq(v) expect(plugin[:filesystem2]["by_pair"][",C:"][k]).to eq(v) expect(plugin[:filesystem2]["by_pair"][",D:"][k]).to eq(v) end @@ -105,7 +105,7 @@ describe Ohai::System, "Windows Filesystem Plugin", :windows_only do "volume_name" => "", "encryption_status" => "FullyDecrypted", }.each do |k, v| - expect(plugin[:filesystem]["C:"][k]).to eq(v) + expect(plugin[:filesystem]["by_pair"][",C:"][k]).to eq(v) expect(plugin[:filesystem2]["by_pair"][",C:"][k]).to eq(v) end @@ -117,7 +117,7 @@ describe Ohai::System, "Windows Filesystem Plugin", :windows_only do "volume_name" => "", "encryption_status" => "EncryptionInProgress", }.each do |k, v| - expect(plugin[:filesystem]["D:"][k]).to eq(v) + expect(plugin[:filesystem]["by_pair"][",D:"][k]).to eq(v) expect(plugin[:filesystem2]["by_pair"][",D:"][k]).to eq(v) end end @@ -139,8 +139,8 @@ describe Ohai::System, "Windows Filesystem Plugin", :windows_only do "kb_used" => 9900, "percent_used" => 99, }.each do |k, v| - expect(plugin[:filesystem]["C:"][k]).to eq(v) - expect(plugin[:filesystem]["D:"][k]).to eq(v) + expect(plugin[:filesystem]["by_pair"]["volume 0,C:"][k]).to eq(v) + expect(plugin[:filesystem]["by_pair"]["volume 1,D:"][k]).to eq(v) expect(plugin[:filesystem2]["by_pair"]["volume 0,C:"][k]).to eq(v) expect(plugin[:filesystem2]["by_pair"]["volume 1,D:"][k]).to eq(v) end @@ -155,7 +155,7 @@ describe Ohai::System, "Windows Filesystem Plugin", :windows_only do "volume_name" => "Volume 0", "encryption_status" => "FullyDecrypted", }.each do |k, v| - expect(plugin[:filesystem]["C:"][k]).to eq(v) + expect(plugin[:filesystem]["by_pair"]["volume 0,C:"][k]).to eq(v) expect(plugin[:filesystem2]["by_pair"]["volume 0,C:"][k]).to eq(v) end @@ -167,7 +167,7 @@ describe Ohai::System, "Windows Filesystem Plugin", :windows_only do "volume_name" => "Volume 1", "encryption_status" => "EncryptionInProgress", }.each do |k, v| - expect(plugin[:filesystem]["D:"][k]).to eq(v) + expect(plugin[:filesystem]["by_pair"]["volume 1,D:"][k]).to eq(v) expect(plugin[:filesystem2]["by_pair"]["volume 1,D:"][k]).to eq(v) end end |