summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-12-23 14:50:48 -0800
committerGitHub <noreply@github.com>2020-12-23 14:50:48 -0800
commit98957d5c093c120aba6799dfab21c6ddf3eaff22 (patch)
treeab23f9f04b08f07b5dfb4198a5b25933af779f61
parentd6ccd995f47034ce8c2b3f31ebd503f610e7ee03 (diff)
parent508f087716c3a3090bda33cf8340eb4cf32c812f (diff)
downloadohai-98957d5c093c120aba6799dfab21c6ddf3eaff22.tar.gz
Merge pull request #1592 from chef/remove_filesystem2_nix
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/ohai/plugins/filesystem.rb6
-rw-r--r--spec/unit/plugins/aix/filesystem_spec.rb22
-rw-r--r--spec/unit/plugins/bsd/filesystem_spec.rb11
-rw-r--r--spec/unit/plugins/solaris2/filesystem_spec.rb (renamed from spec/unit/plugins/solaris2/filesystem.rb)27
4 files changed, 7 insertions, 59 deletions
diff --git a/lib/ohai/plugins/filesystem.rb b/lib/ohai/plugins/filesystem.rb
index 5049e1bd..6214853c 100644
--- a/lib/ohai/plugins/filesystem.rb
+++ b/lib/ohai/plugins/filesystem.rb
@@ -466,9 +466,7 @@ Ohai.plugin(:Filesystem) do
fs_data["by_mountpoint"] = by_mountpoint
fs_data["by_pair"] = by_pair
- # @todo in Chef 17 the filesystem2 part of this goes away
filesystem fs_data
- filesystem2 fs_data
end
collect_data(:darwin) do
@@ -613,9 +611,7 @@ Ohai.plugin(:Filesystem) do
fs_data["by_mountpoint"] = by_mountpoint
fs_data["by_pair"] = by_pair
- # @todo in Chef 17 the filesystem2 plugin goes away
filesystem fs_data
- filesystem2 fs_data
end
collect_data(:aix) do
@@ -705,9 +701,7 @@ Ohai.plugin(:Filesystem) do
fs_data["by_mountpoint"] = by_mountpoint
fs_data["by_pair"] = by_pair
- # @todo in Chef 17 the filesystem2 plugin goes away here
filesystem fs_data
- filesystem2 fs_data
end
collect_data(:windows) do
diff --git a/spec/unit/plugins/aix/filesystem_spec.rb b/spec/unit/plugins/aix/filesystem_spec.rb
index 02bec7fb..a016d8c8 100644
--- a/spec/unit/plugins/aix/filesystem_spec.rb
+++ b/spec/unit/plugins/aix/filesystem_spec.rb
@@ -100,61 +100,50 @@ describe Ohai::System, "AIX filesystem plugin" do
describe "df -Pk" do
it "returns the filesystem block size" do
expect(@plugin[:filesystem]["by_pair"]["/dev/hd4,/"]["kb_size"]).to eq("2097152")
- expect(@plugin[:filesystem2]["by_pair"]["/dev/hd4,/"]["kb_size"]).to eq("2097152")
end
it "returns the filesystem used space in kb" do
expect(@plugin[:filesystem]["by_pair"]["/dev/hd4,/"]["kb_used"]).to eq("219796")
- expect(@plugin[:filesystem2]["by_pair"]["/dev/hd4,/"]["kb_used"]).to eq("219796")
end
it "returns the filesystem available space in kb" do
expect(@plugin[:filesystem]["by_pair"]["/dev/hd4,/"]["kb_available"]).to eq("1877356")
- expect(@plugin[:filesystem2]["by_pair"]["/dev/hd4,/"]["kb_available"]).to eq("1877356")
end
it "returns the filesystem capacity in percentage" do
expect(@plugin[:filesystem]["by_pair"]["/dev/hd4,/"]["percent_used"]).to eq("11%")
- expect(@plugin[:filesystem2]["by_pair"]["/dev/hd4,/"]["percent_used"]).to eq("11%")
end
it "returns the filesystem mounted location" do
expect(@plugin[:filesystem]["by_pair"]["/dev/hd4,/"]["mount"]).to eq("/")
- expect(@plugin[:filesystem2]["by_pair"]["/dev/hd4,/"]["mount"]).to eq("/")
end
end
describe "mount" do
it "returns the filesystem mount location" do
expect(@plugin[:filesystem]["by_pair"]["/dev/hd4,/"]["mount"]).to eq("/")
- expect(@plugin[:filesystem2]["by_pair"]["/dev/hd4,/"]["mount"]).to eq("/")
end
it "returns the filesystem type" do
expect(@plugin[:filesystem]["by_pair"]["/dev/hd4,/"]["fs_type"]).to eq("jfs2")
- expect(@plugin[:filesystem2]["by_pair"]["/dev/hd4,/"]["fs_type"]).to eq("jfs2")
end
it "returns the filesystem mount options" do
expect(@plugin[:filesystem]["by_pair"]["/dev/hd4,/"]["mount_options"]).to eq(["rw", "log=/dev/hd8"])
- expect(@plugin[:filesystem2]["by_pair"]["/dev/hd4,/"]["mount_options"]).to eq(["rw", "log=/dev/hd8"])
end
# For entries like 192.168.1.11 /stage/middleware1 /stage/middleware2 nfs3 Jul 17 13:24 ro,bg,hard,intr,sec=sys
context "having node values" do
it "returns the filesystem mount location" do
expect(@plugin[:filesystem]["by_pair"]["192.168.1.11:/stage/middleware1,/stage/middleware2"]["mount"]).to eq("/stage/middleware2")
- expect(@plugin[:filesystem2]["by_pair"]["192.168.1.11:/stage/middleware1,/stage/middleware2"]["mount"]).to eq("/stage/middleware2")
end
it "returns the filesystem type" do
expect(@plugin[:filesystem]["by_pair"]["192.168.1.11:/stage/middleware1,/stage/middleware2"]["fs_type"]).to eq("nfs3")
- expect(@plugin[:filesystem2]["by_pair"]["192.168.1.11:/stage/middleware1,/stage/middleware2"]["fs_type"]).to eq("nfs3")
end
it "returns the filesystem mount options" do
expect(@plugin[:filesystem]["by_pair"]["192.168.1.11:/stage/middleware1,/stage/middleware2"]["mount_options"]).to eq(["ro", "bg", "hard", "intr", "sec=sys"])
- expect(@plugin[:filesystem2]["by_pair"]["192.168.1.11:/stage/middleware1,/stage/middleware2"]["mount_options"]).to eq(["ro", "bg", "hard", "intr", "sec=sys"])
end
end
end
@@ -170,61 +159,50 @@ describe Ohai::System, "AIX filesystem plugin" do
describe "df -Pk" do
it "returns the filesystem block size" do
expect(@plugin[:filesystem]["by_pair"]["Global:/,/"]["kb_size"]).to eq("10485760")
- expect(@plugin[:filesystem2]["by_pair"]["Global:/,/"]["kb_size"]).to eq("10485760")
end
it "returns the filesystem used space in kb" do
expect(@plugin[:filesystem]["by_pair"]["Global:/,/"]["kb_used"]).to eq("130872")
- expect(@plugin[:filesystem2]["by_pair"]["Global:/,/"]["kb_used"]).to eq("130872")
end
it "returns the filesystem available space in kb" do
expect(@plugin[:filesystem]["by_pair"]["Global:/,/"]["kb_available"]).to eq("10354888")
- expect(@plugin[:filesystem2]["by_pair"]["Global:/,/"]["kb_available"]).to eq("10354888")
end
it "returns the filesystem capacity in percentage" do
expect(@plugin[:filesystem]["by_pair"]["Global:/,/"]["percent_used"]).to eq("2%")
- expect(@plugin[:filesystem2]["by_pair"]["Global:/,/"]["percent_used"]).to eq("2%")
end
it "returns the filesystem mounted location" do
expect(@plugin[:filesystem]["by_pair"]["Global:/,/"]["mount"]).to eq("/")
- expect(@plugin[:filesystem2]["by_pair"]["Global:/,/"]["mount"]).to eq("/")
end
end
describe "mount" do
it "returns the filesystem mount location" do
expect(@plugin[:filesystem]["by_pair"]["Global:/,/"]["mount"]).to eq("/")
- expect(@plugin[:filesystem2]["by_pair"]["Global:/,/"]["mount"]).to eq("/")
end
it "returns the filesystem type" do
expect(@plugin[:filesystem]["by_pair"]["Global:/,/"]["fs_type"]).to eq("jfs2")
- expect(@plugin[:filesystem2]["by_pair"]["Global:/,/"]["fs_type"]).to eq("jfs2")
end
it "returns the filesystem mount options" do
expect(@plugin[:filesystem]["by_pair"]["Global:/,/"]["mount_options"]).to eq(["rw", "log=NULL"])
- expect(@plugin[:filesystem2]["by_pair"]["Global:/,/"]["mount_options"]).to eq(["rw", "log=NULL"])
end
# For entries like 192.168.1.11 /stage/middleware3 /stage/middleware4 nfs3 Jul 17 13:24 ro,bg,hard,intr,sec=sys
context "having node values" do
it "returns the filesystem mount location" do
expect(@plugin[:filesystem]["by_pair"]["192.168.1.11:/stage/middleware3,/stage/middleware4"]["mount"]).to eq("/stage/middleware4")
- expect(@plugin[:filesystem2]["by_pair"]["192.168.1.11:/stage/middleware3,/stage/middleware4"]["mount"]).to eq("/stage/middleware4")
end
it "returns the filesystem type" do
expect(@plugin[:filesystem]["by_pair"]["192.168.1.11:/stage/middleware3,/stage/middleware4"]["fs_type"]).to eq("nfs3")
- expect(@plugin[:filesystem2]["by_pair"]["192.168.1.11:/stage/middleware3,/stage/middleware4"]["fs_type"]).to eq("nfs3")
end
it "returns the filesystem mount options" do
expect(@plugin[:filesystem]["by_pair"]["192.168.1.11:/stage/middleware3,/stage/middleware4"]["mount_options"]).to eq(["ro", "bg", "hard", "intr", "sec=sys"])
- expect(@plugin[:filesystem2]["by_pair"]["192.168.1.11:/stage/middleware3,/stage/middleware4"]["mount_options"]).to eq(["ro", "bg", "hard", "intr", "sec=sys"])
end
end
end
diff --git a/spec/unit/plugins/bsd/filesystem_spec.rb b/spec/unit/plugins/bsd/filesystem_spec.rb
index 7629f815..741666e5 100644
--- a/spec/unit/plugins/bsd/filesystem_spec.rb
+++ b/spec/unit/plugins/bsd/filesystem_spec.rb
@@ -56,49 +56,41 @@ describe Ohai::System, "BSD filesystem plugin" do
it "sets kb_size to value from df" do
plugin.run
expect(plugin[:filesystem]["by_pair"]["/dev/ada0p2,/"][:kb_size]).to eq("9637788")
- expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:kb_size]).to eq("9637788")
end
it "sets kb_used to value from df" do
plugin.run
expect(plugin[:filesystem]["by_pair"]["/dev/ada0p2,/"][:kb_used]).to eq("3313504")
- expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:kb_used]).to eq("3313504")
end
it "sets kb_available to value from df" do
plugin.run
expect(plugin[:filesystem]["by_pair"]["/dev/ada0p2,/"][:kb_available]).to eq("5553264")
- expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:kb_available]).to eq("5553264")
end
it "sets percent_used to value from df" do
plugin.run
expect(plugin[:filesystem]["by_pair"]["/dev/ada0p2,/"][:percent_used]).to eq("37%")
- expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:percent_used]).to eq("37%")
end
it "sets mount to value from df" do
plugin.run
expect(plugin[:filesystem]["by_pair"]["/dev/ada0p2,/"][:mount]).to eq("/")
- expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:mount]).to eq("/")
end
it "sets total_inodes to value from df -iP" do
plugin.run
expect(plugin[:filesystem]["by_pair"]["/dev/ada0p2,/"][:total_inodes]).to eq("1043326")
- expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:total_inodes]).to eq("1043326")
end
it "sets inodes_used to value from df -iP" do
plugin.run
expect(plugin[:filesystem]["by_pair"]["/dev/ada0p2,/"][:inodes_used]).to eq("252576")
- expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:inodes_used]).to eq("252576")
end
it "sets inodes_available to value from df -iP" do
plugin.run
expect(plugin[:filesystem]["by_pair"]["/dev/ada0p2,/"][:inodes_available]).to eq("790750")
- expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:inodes_available]).to eq("790750")
end
end
@@ -119,19 +111,16 @@ describe Ohai::System, "BSD filesystem plugin" do
it "sets mount to value from mount" do
plugin.run
expect(plugin[:filesystem]["by_pair"]["/dev/ada0p2,/"][:mount]).to eq("/")
- expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:mount]).to eq("/")
end
it "sets fs_type to value from mount" do
plugin.run
expect(plugin[:filesystem]["by_pair"]["/dev/ada0p2,/"][:fs_type]).to eq("ufs")
- expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:fs_type]).to eq("ufs")
end
it "sets mount_options to an array of values from mount" do
plugin.run
expect(plugin[:filesystem]["by_pair"]["/dev/ada0p2,/"][:mount_options]).to eq(["local", "journaled soft-updates"])
- expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:mount_options]).to eq(["local", "journaled soft-updates"])
end
end
diff --git a/spec/unit/plugins/solaris2/filesystem.rb b/spec/unit/plugins/solaris2/filesystem_spec.rb
index 50f4ac0e..7786ed90 100644
--- a/spec/unit/plugins/solaris2/filesystem.rb
+++ b/spec/unit/plugins/solaris2/filesystem_spec.rb
@@ -346,13 +346,11 @@ describe Ohai::System, "Solaris2.X filesystem plugin" do
end
it "returns kb_used" do
- expect(plugin[:filesystem]["rpool/VARSHARE"]["kb_used"]).to eq("1181")
- expect(plugin[:filesystem2]["by_pair"]["rpool/VARSHARE,/var/share"]["kb_used"]).to eq("1181")
+ expect(plugin[:filesystem]["by_pair"]["rpool/VARSHARE,/var/share"]["kb_used"]).to eq("1181")
end
it "returns mount" do
- expect(plugin[:filesystem]["rpool/VARSHARE"]["mount"]).to eq("/var/share")
- expect(plugin[:filesystem2]["by_pair"]["rpool/VARSHARE,/var/share"]["mount"]).to eq("/var/share")
+ expect(plugin[:filesystem]["by_pair"]["rpool/VARSHARE,/var/share"]["mount"]).to eq("/var/share")
end
it "returns mount_opts" do
@@ -370,8 +368,7 @@ describe Ohai::System, "Solaris2.X filesystem plugin" do
sharezone=151
dev=4bd0b80
}
- expect(plugin[:filesystem]["rpool/VARSHARE"]["mount_options"]).to eq(opts)
- expect(plugin[:filesystem2]["by_pair"]["rpool/VARSHARE,/var/share"]["mount_options"]).to eq(opts)
+ expect(plugin[:filesystem]["by_pair"]["rpool/VARSHARE,/var/share"]["mount_options"]).to eq(opts)
end
end
@@ -384,23 +381,13 @@ describe Ohai::System, "Solaris2.X filesystem plugin" do
end
it "returns top-level stats" do
- # old API
- expect(plugin[:filesystem]["data0"]["fs_type"]).to eq("zfs")
- expect(plugin[:filesystem]["data0"]["mount"]).to eq("/data0")
-
- # new API
- expect(plugin[:filesystem2]["by_pair"]["data0,/data0"]["fs_type"]).to eq("zfs")
- expect(plugin[:filesystem2]["by_pair"]["data0,/data0"]["mount"]).to eq("/data0")
+ expect(plugin[:filesystem]["by_pair"]["data0,/data0"]["fs_type"]).to eq("zfs")
+ expect(plugin[:filesystem]["by_pair"]["data0,/data0"]["mount"]).to eq("/data0")
end
it "returns zfs-specific properties" do
- # old API
- expect(plugin[:filesystem]["data0"]["zfs_values"]["used"]).to eq("7926803118480")
- expect(plugin[:filesystem]["data0"]["zfs_sources"]["used"]).to eq("-")
-
- # new API
- expect(plugin[:filesystem2]["by_pair"]["data0,/data0"]["zfs_properties"]["used"]["value"]).to eq("7926803118480")
- expect(plugin[:filesystem2]["by_pair"]["data0,/data0"]["zfs_properties"]["used"]["source"]).to eq("-")
+ expect(plugin[:filesystem]["by_pair"]["data0,/data0"]["zfs_properties"]["used"]["value"]).to eq("7926803118480")
+ expect(plugin[:filesystem]["by_pair"]["data0,/data0"]["zfs_properties"]["used"]["source"]).to eq("-")
end
end
end