ohai 15.3.1 → 15.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -6
  3. data/lib/ohai/mixin/{network_constants.rb → network_helper.rb} +8 -1
  4. data/lib/ohai/plugins/aix/network.rb +3 -8
  5. data/lib/ohai/plugins/darwin/network.rb +6 -4
  6. data/lib/ohai/plugins/filesystem.rb +166 -0
  7. data/lib/ohai/plugins/network.rb +5 -5
  8. data/lib/ohai/plugins/openstack.rb +2 -1
  9. data/lib/ohai/plugins/solaris2/network.rb +6 -4
  10. data/lib/ohai/version.rb +1 -1
  11. data/ohai.gemspec +1 -1
  12. metadata +3 -162
  13. data/Rakefile +0 -42
  14. data/lib/ohai/plugins/windows/filesystem.rb +0 -147
  15. data/spec/data/plugins/dpkg-query.output +0 -4
  16. data/spec/data/plugins/lslpp.output +0 -50
  17. data/spec/data/plugins/pacman.output +0 -51
  18. data/spec/data/plugins/pkg-query.output +0 -58
  19. data/spec/data/plugins/pkginfo.output +0 -50
  20. data/spec/data/plugins/pkglist.output +0 -24
  21. data/spec/data/plugins/rpmquery.output +0 -7
  22. data/spec/functional/application_spec.rb +0 -107
  23. data/spec/functional/loader_spec.rb +0 -53
  24. data/spec/functional/plugins/powershell_spec.rb +0 -88
  25. data/spec/functional/plugins/root_group_spec.rb +0 -41
  26. data/spec/functional/plugins/windows/uptime_spec.rb +0 -51
  27. data/spec/ohai_spec.rb +0 -27
  28. data/spec/rcov.opts +0 -2
  29. data/spec/spec.opts +0 -2
  30. data/spec/spec_helper.rb +0 -124
  31. data/spec/support/integration_helper.rb +0 -61
  32. data/spec/support/platform_helpers.rb +0 -38
  33. data/spec/unit/application_spec.rb +0 -96
  34. data/spec/unit/config_spec.rb +0 -57
  35. data/spec/unit/dsl/plugin_spec.rb +0 -634
  36. data/spec/unit/hints_spec.rb +0 -65
  37. data/spec/unit/loader_spec.rb +0 -195
  38. data/spec/unit/mixin/azure_metadata_spec.rb +0 -72
  39. data/spec/unit/mixin/command_spec.rb +0 -151
  40. data/spec/unit/mixin/dmi_decode.rb +0 -75
  41. data/spec/unit/mixin/ec2_metadata_spec.rb +0 -88
  42. data/spec/unit/mixin/softlayer_metadata_spec.rb +0 -72
  43. data/spec/unit/plugin_config_spec.rb +0 -117
  44. data/spec/unit/plugins/abort_spec.rb +0 -69
  45. data/spec/unit/plugins/aix/cpu_spec.rb +0 -127
  46. data/spec/unit/plugins/aix/filesystem_spec.rb +0 -238
  47. data/spec/unit/plugins/aix/hostname_spec.rb +0 -33
  48. data/spec/unit/plugins/aix/kernel_spec.rb +0 -61
  49. data/spec/unit/plugins/aix/memory_spec.rb +0 -49
  50. data/spec/unit/plugins/aix/network_spec.rb +0 -313
  51. data/spec/unit/plugins/aix/platform_spec.rb +0 -44
  52. data/spec/unit/plugins/aix/uptime_spec.rb +0 -42
  53. data/spec/unit/plugins/aix/virtualization_spec.rb +0 -319
  54. data/spec/unit/plugins/azure_spec.rb +0 -243
  55. data/spec/unit/plugins/bsd/filesystem_spec.rb +0 -138
  56. data/spec/unit/plugins/bsd/virtualization_spec.rb +0 -145
  57. data/spec/unit/plugins/c_spec.rb +0 -341
  58. data/spec/unit/plugins/chef_spec.rb +0 -44
  59. data/spec/unit/plugins/cloud_spec.rb +0 -484
  60. data/spec/unit/plugins/darwin/cpu_spec.rb +0 -124
  61. data/spec/unit/plugins/darwin/filesystem_spec.rb +0 -140
  62. data/spec/unit/plugins/darwin/hardware_spec.rb +0 -105
  63. data/spec/unit/plugins/darwin/hardware_system_profiler_output.rb +0 -1110
  64. data/spec/unit/plugins/darwin/hostname_spec.rb +0 -43
  65. data/spec/unit/plugins/darwin/kernel_spec.rb +0 -65
  66. data/spec/unit/plugins/darwin/memory_spec.rb +0 -64
  67. data/spec/unit/plugins/darwin/network_spec.rb +0 -849
  68. data/spec/unit/plugins/darwin/platform_spec.rb +0 -71
  69. data/spec/unit/plugins/darwin/virtualization_spec.rb +0 -156
  70. data/spec/unit/plugins/digital_ocean_spec.rb +0 -106
  71. data/spec/unit/plugins/dmi_spec.rb +0 -156
  72. data/spec/unit/plugins/docker_spec.rb +0 -100
  73. data/spec/unit/plugins/ec2_spec.rb +0 -452
  74. data/spec/unit/plugins/elixir_spec.rb +0 -55
  75. data/spec/unit/plugins/erlang_spec.rb +0 -71
  76. data/spec/unit/plugins/eucalyptus_spec.rb +0 -109
  77. data/spec/unit/plugins/fail_spec.rb +0 -260
  78. data/spec/unit/plugins/freebsd/cpu_spec.rb +0 -129
  79. data/spec/unit/plugins/freebsd/hostname_spec.rb +0 -35
  80. data/spec/unit/plugins/freebsd/kernel_spec.rb +0 -36
  81. data/spec/unit/plugins/freebsd/platform_spec.rb +0 -38
  82. data/spec/unit/plugins/gce_spec.rb +0 -81
  83. data/spec/unit/plugins/go_spec.rb +0 -48
  84. data/spec/unit/plugins/groovy_spec.rb +0 -66
  85. data/spec/unit/plugins/haskell_spec.rb +0 -231
  86. data/spec/unit/plugins/hostname_spec.rb +0 -162
  87. data/spec/unit/plugins/init_package_spec.rb +0 -60
  88. data/spec/unit/plugins/java_spec.rb +0 -230
  89. data/spec/unit/plugins/joyent_spec.rb +0 -100
  90. data/spec/unit/plugins/kernel_spec.rb +0 -38
  91. data/spec/unit/plugins/linode_spec.rb +0 -135
  92. data/spec/unit/plugins/linux/block_device_spec.rb +0 -75
  93. data/spec/unit/plugins/linux/cpu_spec.rb +0 -441
  94. data/spec/unit/plugins/linux/filesystem_spec.rb +0 -550
  95. data/spec/unit/plugins/linux/fips_spec.rb +0 -60
  96. data/spec/unit/plugins/linux/hostname_spec.rb +0 -52
  97. data/spec/unit/plugins/linux/hostnamectl_spec.rb +0 -59
  98. data/spec/unit/plugins/linux/kernel_spec.rb +0 -71
  99. data/spec/unit/plugins/linux/lsb_spec.rb +0 -147
  100. data/spec/unit/plugins/linux/lspci_spec.rb +0 -133
  101. data/spec/unit/plugins/linux/machineid_spec.rb +0 -46
  102. data/spec/unit/plugins/linux/mdadm_spec.rb +0 -170
  103. data/spec/unit/plugins/linux/memory_spec.rb +0 -256
  104. data/spec/unit/plugins/linux/network_spec.rb +0 -1392
  105. data/spec/unit/plugins/linux/platform_spec.rb +0 -812
  106. data/spec/unit/plugins/linux/sessions_spec.rb +0 -98
  107. data/spec/unit/plugins/linux/sysctl_spec.rb +0 -53
  108. data/spec/unit/plugins/linux/systemd_paths_spec.rb +0 -122
  109. data/spec/unit/plugins/linux/uptime_spec.rb +0 -48
  110. data/spec/unit/plugins/linux/virtualization_spec.rb +0 -650
  111. data/spec/unit/plugins/lua_spec.rb +0 -60
  112. data/spec/unit/plugins/mono_spec.rb +0 -67
  113. data/spec/unit/plugins/netbsd/hostname_spec.rb +0 -43
  114. data/spec/unit/plugins/netbsd/kernel_spec.rb +0 -35
  115. data/spec/unit/plugins/netbsd/platform_spec.rb +0 -38
  116. data/spec/unit/plugins/network_spec.rb +0 -1078
  117. data/spec/unit/plugins/nodejs_spec.rb +0 -55
  118. data/spec/unit/plugins/ohai_spec.rb +0 -32
  119. data/spec/unit/plugins/ohai_time_spec.rb +0 -44
  120. data/spec/unit/plugins/openbsd/hostname_spec.rb +0 -43
  121. data/spec/unit/plugins/openbsd/kernel_spec.rb +0 -36
  122. data/spec/unit/plugins/openbsd/platform_spec.rb +0 -33
  123. data/spec/unit/plugins/openstack_spec.rb +0 -311
  124. data/spec/unit/plugins/os_spec.rb +0 -115
  125. data/spec/unit/plugins/packages_spec.rb +0 -353
  126. data/spec/unit/plugins/passwd_spec.rb +0 -65
  127. data/spec/unit/plugins/perl_spec.rb +0 -62
  128. data/spec/unit/plugins/php_spec.rb +0 -97
  129. data/spec/unit/plugins/platform_spec.rb +0 -65
  130. data/spec/unit/plugins/powershell_spec.rb +0 -71
  131. data/spec/unit/plugins/python_spec.rb +0 -51
  132. data/spec/unit/plugins/rackspace_spec.rb +0 -350
  133. data/spec/unit/plugins/root_group_spec.rb +0 -90
  134. data/spec/unit/plugins/ruby_spec.rb +0 -60
  135. data/spec/unit/plugins/rust_spec.rb +0 -43
  136. data/spec/unit/plugins/scala_spec.rb +0 -58
  137. data/spec/unit/plugins/scaleway_spec.rb +0 -93
  138. data/spec/unit/plugins/scsi_spec.rb +0 -69
  139. data/spec/unit/plugins/shard_spec.rb +0 -121
  140. data/spec/unit/plugins/shells_spec.rb +0 -56
  141. data/spec/unit/plugins/softlayer_spec.rb +0 -60
  142. data/spec/unit/plugins/solaris2/cpu_spec.rb +0 -2926
  143. data/spec/unit/plugins/solaris2/dmi_spec.rb +0 -153
  144. data/spec/unit/plugins/solaris2/filesystem.rb +0 -407
  145. data/spec/unit/plugins/solaris2/hostname_spec.rb +0 -37
  146. data/spec/unit/plugins/solaris2/kernel_spec.rb +0 -183
  147. data/spec/unit/plugins/solaris2/memory_spec.rb +0 -43
  148. data/spec/unit/plugins/solaris2/network_spec.rb +0 -201
  149. data/spec/unit/plugins/solaris2/platform_spec.rb +0 -108
  150. data/spec/unit/plugins/solaris2/virtualization_spec.rb +0 -97
  151. data/spec/unit/plugins/ssh_host_keys_spec.rb +0 -116
  152. data/spec/unit/plugins/sysconf_spec.rb +0 -680
  153. data/spec/unit/plugins/timezone_spec.rb +0 -30
  154. data/spec/unit/plugins/vbox_host_spec.rb +0 -14
  155. data/spec/unit/plugins/virtualbox_spec.rb +0 -375
  156. data/spec/unit/plugins/vmware_spec.rb +0 -81
  157. data/spec/unit/plugins/windows/cpu_spec.rb +0 -118
  158. data/spec/unit/plugins/windows/filesystem_spec.rb +0 -226
  159. data/spec/unit/plugins/windows/fips_spec.rb +0 -60
  160. data/spec/unit/plugins/windows/kernel_spec.rb +0 -79
  161. data/spec/unit/plugins/windows/memory_spec.rb +0 -52
  162. data/spec/unit/plugins/windows/network_spec.rb +0 -137
  163. data/spec/unit/plugins/windows/system_enclosure_spec.rb +0 -45
  164. data/spec/unit/plugins/windows/uptime_spec.rb +0 -38
  165. data/spec/unit/plugins/windows/virtualization_spec.rb +0 -63
  166. data/spec/unit/plugins/zpools_spec.rb +0 -244
  167. data/spec/unit/provides_map_spec.rb +0 -208
  168. data/spec/unit/runner_spec.rb +0 -422
  169. data/spec/unit/system_spec.rb +0 -416
  170. data/spec/unit/util/file_helper_spec.rb +0 -47
  171. data/spec/unit/util/ip_helper_spec.rb +0 -128
@@ -1,153 +0,0 @@
1
- #
2
- # Author:: Thom May (<thom@chef.io>)
3
- # Copyright:: Copyright (c) 2015 Chef Software
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- require "spec_helper"
20
-
21
- SOLARIS_DMI_OUT = <<~EOS.freeze
22
- ID SIZE TYPE
23
- 0 64 SMB_TYPE_BIOS (type 0) (BIOS information)
24
-
25
- Vendor: American Megatrends Inc.
26
- Version String: 4701
27
- Release Date: 08/26/2014
28
- Address Segment: 0xf000
29
- ROM Size: 8388608 bytes
30
- Image Size: 65536 bytes
31
- Characteristics: 0x53f8b9c80
32
- SMB_BIOSFL_PCI (PCI is supported)
33
- SMB_BIOSFL_APM (APM is supported)
34
- SMB_BIOSFL_FLASH (BIOS is Flash Upgradeable)
35
- SMB_BIOSFL_SHADOW (BIOS shadowing is allowed)
36
- SMB_BIOSFL_CDBOOT (Boot from CD is supported)
37
- SMB_BIOSFL_SELBOOT (Selectable Boot supported)
38
- SMB_BIOSFL_ROMSOCK (BIOS ROM is socketed)
39
- SMB_BIOSFL_EDD (EDD Spec is supported)
40
- SMB_BIOSFL_525_12M (int 0x13 5.25" 1.2M floppy)
41
- SMB_BIOSFL_35_720K (int 0x13 3.5" 720K floppy)
42
- SMB_BIOSFL_35_288M (int 0x13 3.5" 2.88M floppy)
43
- SMB_BIOSFL_I5_PRINT (int 0x5 print screen svcs)
44
- SMB_BIOSFL_I9_KBD (int 0x9 8042 keyboard svcs)
45
- SMB_BIOSFL_I14_SER (int 0x14 serial svcs)
46
- SMB_BIOSFL_I17_PRINTER (int 0x17 printer svcs)
47
- 0x100000000
48
- 0x400000000
49
- Characteristics Extension Byte 1: 0x3
50
- SMB_BIOSXB1_ACPI (ACPI is supported)
51
- SMB_BIOSXB1_USBL (USB legacy is supported)
52
- Characteristics Extension Byte 2: 0xd
53
- SMB_BIOSXB2_BBOOT (BIOS Boot Specification supported)
54
- SMB_BIOSXB2_ETCDIST (Enable Targeted Content Distrib.)
55
- SMB_BIOSXB2_UEFI (UEFI Specification supported)
56
- Version Number: 0.0
57
- Embedded Ctlr Firmware Version Number: 0.0
58
-
59
- ID SIZE TYPE
60
- 1 129 SMB_TYPE_SYSTEM (type 1) (system information)
61
-
62
- Manufacturer: System manufacturer
63
- Product: System Product Name
64
- Version: System Version
65
- Serial Number: System Serial Number
66
-
67
- UUID: 20b1001e-8c00-0072-5566-10c37b474fc1
68
- Wake-Up Event: 0x6 (power switch)
69
- SKU Number: SKU
70
- Family: To be filled by O.E.M.
71
-
72
- ID SIZE TYPE
73
- 2 116 SMB_TYPE_BASEBOARD (type 2) (base board)
74
-
75
- Manufacturer: ASUSTeK COMPUTER INC.
76
- Product: P9X79 WS
77
- Version: Rev 1.xx
78
- Serial Number: 140525831000250
79
- Asset Tag: To be filled by O.E.M.
80
- Location Tag: To be filled by O.E.M.
81
-
82
- Chassis: 3
83
- Flags: 0x9
84
- SMB_BBFL_MOTHERBOARD (board is a motherboard)
85
- SMB_BBFL_REPLACABLE (board is field-replacable)
86
- Board Type: 0xa (motherboard)
87
-
88
- ID SIZE TYPE
89
- 46 38 SMB_TYPE_OBDEVS (type 10) (on-board devices)
90
-
91
- Onboard Ethernet
92
- Onboard Audio
93
-
94
- ID SIZE TYPE
95
- 3 106 SMB_TYPE_CHASSIS (type 3) (system enclosure or chassis)
96
-
97
- Manufacturer: Chassis Manufacture
98
- Version: Chassis Version
99
- Serial Number: Chassis Serial Number
100
- Asset Tag: PCS
101
-
102
- OEM Data: 0x0
103
- SKU number: ^E
104
- Lock Present: N
105
- Chassis Type: 0x3 (desktop)
106
- Boot-Up State: 0x3 (safe)
107
- Power Supply State: 0x3 (safe)
108
- Thermal State: 0x3 (safe)
109
- Chassis Height: 0u
110
- Power Cords: 1
111
- Element Records: 0
112
- EOS
113
-
114
- describe Ohai::System, "Solaris2.X DMI plugin" do
115
- before do
116
- @plugin = get_plugin("solaris2/dmi")
117
- allow(@plugin).to receive(:collect_os).and_return("solaris2")
118
- @stdout = SOLARIS_DMI_OUT
119
- allow(@plugin).to receive(:shell_out).with("smbios").and_return(mock_shell_out(0, @stdout, ""))
120
- end
121
-
122
- it "runs smbios" do
123
- expect(@plugin).to receive(:shell_out).with("smbios").and_return(mock_shell_out(0, @stdout, ""))
124
- @plugin.run
125
- end
126
-
127
- {
128
- bios: {
129
- vendor: "American Megatrends Inc.",
130
- release_date: "08/26/2014",
131
- },
132
- system: {
133
- manufacturer: "System manufacturer",
134
- product: "System Product Name",
135
- },
136
- chassis: {
137
- lock_present: "N",
138
- asset_tag: "PCS",
139
- },
140
- }.each do |id, data|
141
- data.each do |attribute, value|
142
- it "has [:dmi][:#{id}][:#{attribute}] set" do
143
- @plugin.run
144
- expect(@plugin[:dmi][id][attribute]).to eql(value)
145
- end
146
- end
147
- end
148
-
149
- it "ignores unwanted types" do
150
- @plugin.run
151
- expect(@plugin[:dmi]).not_to have_key(:on_board_devices)
152
- end
153
- end
@@ -1,407 +0,0 @@
1
- #
2
- # Copyright:: Copyright (c) 2015-2016 Chef Software, Inc.
3
- # License:: Apache License, Version 2.0
4
- #
5
- # Licensed under the Apache License, Version 2.0 (the "License");
6
- # you may not use this file except in compliance with the License.
7
- # You may obtain a copy of the License at
8
- #
9
- # http://www.apache.org/licenses/LICENSE-2.0
10
- #
11
- # Unless required by applicable law or agreed to in writing, software
12
- # distributed under the License is distributed on an "AS IS" BASIS,
13
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific language governing permissions and
15
- # limitations under the License.
16
- #
17
-
18
- require_relative "spec_helper"
19
-
20
- describe Ohai::System, "Solaris2.X filesystem plugin" do
21
- let(:plugin) { get_plugin("filesystem") }
22
-
23
- before do
24
- allow(plugin).to receive(:collect_os).and_return("solaris2")
25
- end
26
-
27
- describe "filesystem properties" do
28
- let(:plugin_config) { {} }
29
-
30
- before do
31
- @original_plugin_config = Ohai.config[:plugin]
32
- Ohai.config[:plugin] = plugin_config
33
- allow(plugin).to receive(:shell_out).with("df -Pka").and_return(mock_shell_out(0, "", ""))
34
- allow(plugin).to receive(:shell_out).with("df -na").and_return(mock_shell_out(0, "", ""))
35
- allow(plugin).to receive(:shell_out).with("mount").and_return(mock_shell_out(0, "", ""))
36
- allow(plugin).to receive(:shell_out).with("zfs get -p -H all").and_return(mock_shell_out(0, "", ""))
37
-
38
- @df_pka = <<~DF_PKA
39
- Filesystem 1024-blocks Used Available Capacity Mounted on
40
- rpool/ROOT/solaris-0 730451045 2172071 727373448 1% /
41
- rpool/ROOT/solaris-0/var 730451045 850302 727373448 1% /var
42
- /dev 0 0 0 0% /dev
43
- proc 0 0 0 0% /proc
44
- ctfs 0 0 0 0% /system/contract
45
- mnttab 0 0 0 0% /etc/mnttab
46
- objfs 0 0 0 0% /system/object
47
- swap 18544280 568 18543712 1% /system/volatile
48
- sharefs 0 0 0 0% /etc/dfs/sharetab
49
- fd 0 0 0 0% /dev/fd
50
- swap 18666120 122408 18543712 1% /tmp
51
- rpool/VARSHARE 730451045 1181 727373448 1% /var/share
52
- rpool/export 730451045 32 727373448 1% /export
53
- rpool/export/home 730451045 182277 727373448 1% /export/home
54
- rpool 730451045 31 727373448 1% /rpool
55
- rpool/VARSHARE/pkg 730451045 32 727373448 1% /var/share/pkg
56
- rpool/VARSHARE/pkg/repositories 730451045 31 727373448 1% /var/share/pkg/repositories
57
- rpool/export/home/shian 730451045 37 727373448 1% /export/home/shain
58
- rpool/export/home/phild 730451045 38 727373448 1% /export/home/phild
59
- r
60
- -hosts 0 0 0 0% /net
61
- auto_home 0 0 0 0% /home
62
- -fedfs 0 0 0 0% /nfs4
63
- DF_PKA
64
-
65
- @mount = <<~MOUNT
66
- / on rpool/ROOT/solaris-0 read/write/setuid/nodevices/rstchown/nonbmand/exec/xattr/atime/mountpoint=/zones/servername.chef.internal.dns/root//zone=servername.chef.internal.dns/nozonemod/sharezone=151/dev=4bd0b7e on Fri Feb 2 16:27:36 2018
67
- /var on rpool/ROOT/solaris-0/var read/write/setuid/nodevices/rstchown/nonbmand/exec/xattr/atime/mountpoint=/zones/servername.chef.internal.dns/root/var/zone=servername.chef.internal.dns/nozonemod/sharezone=151/dev=4bd0b7f on Fri Feb 2 16:27:36 2018
68
- /dev on /dev read/write/setuid/devices/rstchown/zone=servername.chef.internal.dns/nozonemod/sharezone=151/dev=8f8003a on Fri Feb 2 16:27:36 2018
69
- /proc on proc read/write/setuid/nodevices/rstchown/zone=servername.chef.internal.dns/sharezone=151/dev=8f40096 on Fri Feb 2 16:27:37 2018
70
- /system/contract on ctfs read/write/setuid/nodevices/rstchown/zone=servername.chef.internal.dns/sharezone=151/dev=8fc0097 on Fri Feb 2 16:27:37 2018
71
- /etc/mnttab on mnttab read/write/setuid/nodevices/rstchown/zone=servername.chef.internal.dns/sharezone=151/dev=9000097 on Fri Feb 2 16:27:37 2018
72
- /system/object on objfs read/write/setuid/nodevices/rstchown/zone=servername.chef.internal.dns/sharezone=151/dev=9080097 on Fri Feb 2 16:27:37 2018
73
- /system/volatile on swap read/write/setuid/nodevices/rstchown/xattr/zone=servername.chef.internal.dns/sharezone=151/dev=90406f0 on Fri Feb 2 16:27:37 2018
74
- /etc/dfs/sharetab on sharefs read/write/setuid/nodevices/rstchown/zone=servername.chef.internal.dns/sharezone=151/dev=90c004d on Fri Feb 2 16:27:37 2018
75
- /dev/fd on fd read/write/setuid/nodevices/rstchown/zone=servername.chef.internal.dns/sharezone=151/dev=91c007d on Fri Feb 2 16:27:44 2018
76
- /tmp on swap read/write/setuid/nodevices/rstchown/xattr/zone=servername.chef.internal.dns/sharezone=151/dev=90406f1 on Fri Feb 2 16:27:45 2018
77
- /var/share on rpool/VARSHARE read/write/setuid/nodevices/rstchown/nonbmand/exec/xattr/atime/zone=servername.chef.internal.dns/sharezone=151/dev=4bd0b80 on Fri Feb 2 16:27:45 2018
78
- /export on rpool/export read/write/setuid/nodevices/rstchown/nonbmand/exec/xattr/atime/zone=servername.chef.internal.dns/sharezone=151/dev=4bd0b81 on Fri Feb 2 16:28:11 2018
79
- /export/home on rpool/export/home read/write/setuid/nodevices/rstchown/nonbmand/exec/xattr/atime/zone=servername.chef.internal.dns/sharezone=151/dev=4bd0b82 on Fri Feb 2 16:28:11 2018
80
- /rpool on rpool read/write/setuid/nodevices/rstchown/nonbmand/exec/xattr/atime/zone=servername.chef.internal.dns/sharezone=151/dev=4bd0b83 on Fri Feb 2 16:28:11 2018
81
- /var/share/pkg on rpool/VARSHARE/pkg read/write/setuid/nodevices/rstchown/nonbmand/exec/xattr/atime/zone=servername.chef.internal.dns/sharezone=151/dev=4bd0b84 on Fri Feb 2 16:28:12 2018
82
- /var/share/pkg/repositories on rpool/VARSHARE/pkg/repositories read/write/setuid/nodevices/rstchown/nonbmand/exec/xattr/atime/zone=servername.chef.internal.dns/sharezone=151/dev=4bd0b85 on Fri Feb 2 16:28:12 2018
83
- /export/home/<usernameredacted> on rpool/export/home/<usernameredacted> read/write/setuid/nodevices/rstchown/nonbmand/exec/xattr/atime/zone=servername.chef.internal.dns/sharezone=151/dev=4bd0b8a on Fri Feb 2 16:39:15 2018
84
- /export/home/<usernameredacted> on rpool/export/home/<usernameredacted> read/write/setuid/nodevices/rstchown/nonbmand/exec/xattr/atime/zone=servername.chef.internal.dns/sharezone=151/dev=4bd0b8b on Fri Feb 2 16:39:16 2018
85
- MOUNT
86
-
87
- @zfs_get = <<~ZFS_GET
88
- data0 type filesystem -
89
- data0 creation 1331514391 -
90
- data0 used 7926803118480 -
91
- data0 available 3666345412208 -
92
- data0 referenced 60350619952 -
93
- data0 compressratio 1.04x -
94
- data0 mounted yes -
95
- data0 quota 0 default
96
- data0 reservation 0 default
97
- data0 recordsize 131072 default
98
- data0 mountpoint /data0 default
99
- data0 sharenfs rw=192.168.130.0/24,rw=[2001:470:1f05:2c9::]/64,rw=[2001:470:8122:dd40::10] local
100
- data0 checksum on default
101
- data0 compression off local
102
- data0 atime off local
103
- data0 devices on default
104
- data0 exec on default
105
- data0 setuid on default
106
- data0 readonly off default
107
- data0 zoned off default
108
- data0 snapdir hidden default
109
- data0 aclinherit restricted default
110
- data0 canmount on default
111
- data0 xattr on default
112
- data0 copies 1 default
113
- data0 version 5 -
114
- data0 utf8only off -
115
- data0 normalization none -
116
- data0 casesensitivity sensitive -
117
- data0 vscan off default
118
- data0 nbmand off default
119
- data0 sharesmb off default
120
- data0 refquota 0 default
121
- data0 refreservation 0 default
122
- data0 primarycache all default
123
- data0 secondarycache all default
124
- data0 usedbysnapshots 157243047152 -
125
- data0 usedbydataset 60350619952 -
126
- data0 usedbychildren 7709209451376 -
127
- data0 usedbyrefreservation 0 -
128
- data0 logbias latency default
129
- data0 dedup off default
130
- data0 mlslabel none default
131
- data0 sync standard default
132
- data0 refcompressratio 1.29x -
133
- data0 written 4183965296 -
134
- data0 logicalused 8240006744576 -
135
- data0 logicalreferenced 75625359872 -
136
- data0 filesystem_limit 18446744073709551615 default
137
- data0 snapshot_limit 18446744073709551615 default
138
- data0 filesystem_count 18446744073709551615 default
139
- data0 snapshot_count 18446744073709551615 default
140
- data0 snapdev hidden default
141
- data0 acltype off default
142
- data0 context none default
143
- data0 fscontext none default
144
- data0 defcontext none default
145
- data0 rootcontext none default
146
- data0 relatime off default
147
- data0 redundant_metadata all default
148
- data0 overlay off default
149
- data0@20130228 type snapshot -
150
- data0@20130228 creation 1362119670 -
151
- data0@20130228 used 0 -
152
- data0@20130228 referenced 57161787648 -
153
- data0@20130228 compressratio 1.30x -
154
- data0@20130228 devices on default
155
- data0@20130228 exec on default
156
- data0@20130228 setuid on default
157
- data0@20130228 xattr on default
158
- data0@20130228 version 5 -
159
- data0@20130228 utf8only off -
160
- data0@20130228 normalization none -
161
- data0@20130228 casesensitivity sensitive -
162
- data0@20130228 nbmand off default
163
- data0@20130228 primarycache all default
164
- data0@20130228 secondarycache all default
165
- data0@20130228 defer_destroy off -
166
- data0@20130228 userrefs 0 -
167
- data0@20130228 mlslabel none default
168
- data0@20130228 refcompressratio 1.30x -
169
- data0@20130228 written 57161787648 -
170
- data0@20130228 clones -
171
- data0@20130228 logicalused 0 -
172
- data0@20130228 logicalreferenced 72138856960 -
173
- data0@20130228 acltype off default
174
- data0@20130228 context none default
175
- data0@20130228 fscontext none default
176
- data0@20130228 defcontext none default
177
- data0@20130228 rootcontext none default
178
- data0@20130301 type snapshot -
179
- data0@20130301 creation 1362122621 -
180
- data0@20130301 used 0 -
181
- data0@20130301 referenced 57161787648 -
182
- data0@20130301 compressratio 1.30x -
183
- data0@20130301 devices on default
184
- data0@20130301 exec on default
185
- data0@20130301 setuid on default
186
- data0@20130301 xattr on default
187
- data0@20130301 version 5 -
188
- data0@20130301 utf8only off -
189
- data0@20130301 normalization none -
190
- data0@20130301 casesensitivity sensitive -
191
- data0@20130301 nbmand off default
192
- data0@20130301 primarycache all default
193
- data0@20130301 secondarycache all default
194
- data0@20130301 defer_destroy off -
195
- data0@20130301 userrefs 0 -
196
- data0@20130301 mlslabel none default
197
- data0@20130301 refcompressratio 1.30x -
198
- data0@20130301 written 0 -
199
- data0@20130301 clones -
200
- data0@20130301 logicalused 0 -
201
- data0@20130301 logicalreferenced 72138856960 -
202
- data0@20130301 acltype off default
203
- data0@20130301 context none default
204
- data0@20130301 fscontext none default
205
- data0@20130301 defcontext none default
206
- data0@20130301 rootcontext none default
207
- data0@20130310 type snapshot -
208
- data0@20130310 creation 1362955150 -
209
- data0@20130310 used 281392 -
210
- data0@20130310 referenced 57173475232 -
211
- data0@20130310 compressratio 1.30x -
212
- data0@20130310 devices on default
213
- data0@20130310 exec on default
214
- data0@20130310 setuid on default
215
- data0@20130310 xattr on default
216
- data0@20130310 version 5 -
217
- data0@20130310 utf8only off -
218
- data0@20130310 normalization none -
219
- data0@20130310 casesensitivity sensitive -
220
- data0@20130310 nbmand off default
221
- data0@20130310 primarycache all default
222
- data0@20130310 secondarycache all default
223
- data0@20130310 defer_destroy off -
224
- data0@20130310 userrefs 0 -
225
- data0@20130310 mlslabel none default
226
- data0@20130310 refcompressratio 1.30x -
227
- data0@20130310 written 11968976 -
228
- data0@20130310 clones -
229
- data0@20130310 logicalused 0 -
230
- data0@20130310 logicalreferenced 72164488192 -
231
- data0@20130310 acltype off default
232
- data0@20130310 context none default
233
- data0@20130310 fscontext none default
234
- data0@20130310 defcontext none default
235
- data0@20130310 rootcontext none default
236
- data0@20160311 type snapshot -
237
- data0@20160311 creation 1457762233 -
238
- data0@20160311 used 155723556528 -
239
- data0@20160311 referenced 211890289712 -
240
- data0@20160311 compressratio 1.24x -
241
- data0@20160311 devices on default
242
- data0@20160311 exec on default
243
- data0@20160311 setuid on default
244
- data0@20160311 xattr on default
245
- data0@20160311 version 5 -
246
- data0@20160311 utf8only off -
247
- data0@20160311 normalization none -
248
- data0@20160311 casesensitivity sensitive -
249
- data0@20160311 nbmand off default
250
- data0@20160311 primarycache all default
251
- data0@20160311 secondarycache all default
252
- data0@20160311 defer_destroy off -
253
- data0@20160311 userrefs 0 -
254
- data0@20160311 mlslabel none default
255
- data0@20160311 refcompressratio 1.24x -
256
- data0@20160311 written 156235945184 -
257
- data0@20160311 clones -
258
- data0@20160311 logicalused 0 -
259
- data0@20160311 logicalreferenced 259598664192 -
260
- data0@20160311 acltype off default
261
- data0@20160311 context none default
262
- data0@20160311 fscontext none default
263
- data0@20160311 defcontext none default
264
- data0@20160311 rootcontext none default
265
- data0/Movies type filesystem -
266
- data0/Movies creation 1331530217 -
267
- data0/Movies used 642640700304 -
268
- data0/Movies available 3666345412208 -
269
- data0/Movies referenced 586525311344 -
270
- data0/Movies compressratio 1.00x -
271
- data0/Movies mounted yes -
272
- data0/Movies quota 0 default
273
- data0/Movies reservation 0 default
274
- data0/Movies recordsize 131072 default
275
- data0/Movies mountpoint /data0/Movies default
276
- data0/Movies sharenfs sec=sys,rw=192.168.130.0/24,rw=192.168.135.0/24,rw=[2001:470:1f05:2c9::]/64,rw=[2001:470:8122::]/48,rw=[2001:470:8122:dd40::10]local
277
- data0/Movies checksum on default
278
- data0/Movies compression off inherited from data0
279
- data0/Movies atime off local
280
- data0/Movies devices on default
281
- data0/Movies exec on default
282
- data0/Movies setuid on default
283
- data0/Movies readonly off default
284
- data0/Movies zoned off default
285
- data0/Movies snapdir hidden default
286
- data0/Movies aclinherit restricted default
287
- data0/Movies canmount on default
288
- data0/Movies xattr on default
289
- data0/Movies copies 1 default
290
- data0/Movies version 5 -
291
- data0/Movies utf8only off -
292
- data0/Movies normalization none -
293
- data0/Movies casesensitivity sensitive -
294
- data0/Movies vscan off default
295
- data0/Movies nbmand off default
296
- data0/Movies sharesmb off local
297
- data0/Movies refquota 0 default
298
- data0/Movies refreservation 0 default
299
- data0/Movies primarycache all default
300
- data0/Movies secondarycache all default
301
- data0/Movies usedbysnapshots 56115388960 -
302
- data0/Movies usedbydataset 586525311344 -
303
- data0/Movies usedbychildren 0 -
304
- data0/Movies usedbyrefreservation 0 -
305
- data0/Movies logbias latency default
306
- data0/Movies dedup off default
307
- data0/Movies mlslabel none default
308
- data0/Movies sync standard default
309
- data0/Movies refcompressratio 1.00x -
310
- data0/Movies written 197038505024 -
311
- data0/Movies logicalused 642795343360 -
312
- data0/Movies logicalreferenced 586666194432 -
313
- data0/Movies filesystem_limit 18446744073709551615 default
314
- data0/Movies snapshot_limit 18446744073709551615 default
315
- data0/Movies filesystem_count 18446744073709551615 default
316
- data0/Movies snapshot_count 18446744073709551615 default
317
- data0/Movies snapdev hidden default
318
- data0/Movies acltype off default
319
- data0/Movies context none default
320
- data0/Movies fscontext none default
321
- data0/Movies defcontext none default
322
- data0/Movies rootcontext none default
323
- data0/Movies relatime off default
324
- data0/Movies redundant_metadata all default
325
- data0/Movies overlay off default:
326
- ZFS_GET
327
- end
328
-
329
- after do
330
- Ohai.config[:plugin] = @original_plugin_config
331
- end
332
-
333
- context "reports filesystem data" do
334
- before do
335
- allow(plugin).to receive(:shell_out)
336
- .with("mount")
337
- .and_return(mock_shell_out(0, @mount, nil))
338
- allow(plugin).to receive(:shell_out)
339
- .with("df -Pka")
340
- .and_return(mock_shell_out(0, @df_pka, nil))
341
- # TODO: get this output
342
- # allow(plugin).to receive(:shell_out)
343
- # .with("df -na")
344
- # .and_return(mock_shell_out(0, @df_na, nil))
345
- plugin.run
346
- end
347
-
348
- it "returns kb_used" do
349
- expect(plugin[:filesystem]["rpool/VARSHARE"]["kb_used"]).to eq("1181")
350
- expect(plugin[:filesystem2]["by_pair"]["rpool/VARSHARE,/var/share"]["kb_used"]).to eq("1181")
351
- end
352
-
353
- it "returns mount" do
354
- expect(plugin[:filesystem]["rpool/VARSHARE"]["mount"]).to eq("/var/share")
355
- expect(plugin[:filesystem2]["by_pair"]["rpool/VARSHARE,/var/share"]["mount"]).to eq("/var/share")
356
- end
357
-
358
- it "returns mount_opts" do
359
- opts = %w{
360
- read
361
- write
362
- setuid
363
- nodevices
364
- rstchown
365
- nonbmand
366
- exec
367
- xattr
368
- atime
369
- zone=servername.chef.internal.dns
370
- sharezone=151
371
- dev=4bd0b80
372
- }
373
- expect(plugin[:filesystem]["rpool/VARSHARE"]["mount_options"]).to eq(opts)
374
- expect(plugin[:filesystem2]["by_pair"]["rpool/VARSHARE,/var/share"]["mount_options"]).to eq(opts)
375
- end
376
- end
377
-
378
- context "handles zfs properties" do
379
- before do
380
- allow(plugin).to receive(:shell_out)
381
- .with("zfs get -p -H all")
382
- .and_return(mock_shell_out(0, @zfs_get, nil))
383
- plugin.run
384
- end
385
-
386
- it "returns top-level stats" do
387
- # old API
388
- expect(plugin[:filesystem]["data0"]["fs_type"]).to eq("zfs")
389
- expect(plugin[:filesystem]["data0"]["mount"]).to eq("/data0")
390
-
391
- # new API
392
- expect(plugin[:filesystem2]["by_pair"]["data0,/data0"]["fs_type"]).to eq("zfs")
393
- expect(plugin[:filesystem2]["by_pair"]["data0,/data0"]["mount"]).to eq("/data0")
394
- end
395
-
396
- it "returns zfs-specific properties" do
397
- # old API
398
- expect(plugin[:filesystem]["data0"]["zfs_values"]["used"]).to eq("7926803118480")
399
- expect(plugin[:filesystem]["data0"]["zfs_sources"]["used"]).to eq("-")
400
-
401
- # new API
402
- expect(plugin[:filesystem2]["by_pair"]["data0,/data0"]["zfs_properties"]["used"]["value"]).to eq("7926803118480")
403
- expect(plugin[:filesystem2]["by_pair"]["data0,/data0"]["zfs_properties"]["used"]["source"]).to eq("-")
404
- end
405
- end
406
- end
407
- end