diff options
author | Phil Dibowitz <phil@ipom.com> | 2021-04-26 17:16:26 -0700 |
---|---|---|
committer | Phil Dibowitz <phil@ipom.com> | 2021-04-26 17:19:00 -0700 |
commit | f1396ac921b3ea6a6a7a96eb2de1551389fc3a09 (patch) | |
tree | 4fc04a5f510521c58912d5d7be9125c4a3eecdfb | |
parent | 133bd41fea2e6fff3e5106253af11e59ce4f3d61 (diff) | |
download | ohai-f1396ac921b3ea6a6a7a96eb2de1551389fc3a09.tar.gz |
Chef 17: Set 'filesystem' to be new-style data on Windows
For every platform we've had to go through these steps:
* add fs2
* make fs match fs2
* remove fs2
We've completed this on all platforms except windows which was at step
1. This moves Windows to step 2.
Signed-off-by: Phil Dibowitz <phil@ipom.com>
-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 |