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,238 +0,0 @@
1
- #
2
- # Author:: Prabhu Das (<prabhu.das@clogeny.com>)
3
- # Author:: Isa Farnik (<isa@chef.io>)
4
- # Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
5
- # License:: Apache License, Version 2.0
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
-
19
- require "spec_helper"
20
-
21
- describe Ohai::System, "AIX filesystem plugin" do
22
- before do
23
- @df_pk_lpar = <<~DF_PK
24
- Filesystem 1024-blocks Used Available Capacity Mounted on
25
- /dev/hd4 2097152 219796 1877356 11% /
26
- /dev/hd2 5242880 2416828 2826052 47% /usr
27
- /dev/hd9var 5242880 395540 4847340 8% /var
28
- /dev/hd3 5242880 1539508 3703372 30% /tmp
29
- /dev/hd1 10485760 1972 10483788 1% /home
30
- /dev/hd11admin 131072 380 130692 1% /admin
31
- /proc - - - - /proc
32
- /dev/hd10opt 5242880 1286720 3956160 25% /opt
33
- /dev/livedump 262144 368 261776 1% /var/adm/ras/livedump
34
- /dev/fslv00 524288 45076 479212 9% /wpars/sink-thinker-541ba3
35
- /dev/fslv01 2097152 8956 2088196 1% /wpars/sink-thinker-541ba3/home
36
- /dev/fslv02 5242880 1307352 3935528 25% /wpars/sink-thinker-541ba3/opt
37
- /proc - - - - /wpars/sink-thinker-541ba3/proc
38
- /dev/fslv03 1048576 168840 879736 17% /wpars/sink-thinker-541ba3/tmp
39
- /dev/fslv04 5242880 2725040 2517840 52% /wpars/sink-thinker-541ba3/usr
40
- /dev/fslv05 524288 76000 448288 15% /wpars/sink-thinker-541ba3/var
41
- /dev/fslv07 10485760 130872 10354888 2% /wpars/toolchain-tester-5c969f
42
- /dev/fslv08 5242880 39572 5203308 1% /wpars/toolchain-tester-5c969f/home
43
- /dev/fslv09 5242880 1477164 3765716 29% /wpars/toolchain-tester-5c969f/opt
44
- /proc - - - - /wpars/toolchain-tester-5c969f/proc
45
- /dev/fslv10 5242880 42884 5199996 1% /wpars/toolchain-tester-5c969f/tmp
46
- /dev/fslv11 5242880 2725048 2517832 52% /wpars/toolchain-tester-5c969f/usr
47
- /dev/fslv12 10485760 272376 10213384 3% /wpars/toolchain-tester-5c969f/var
48
- DF_PK
49
-
50
- @df_pk_wpar = <<~DF_PK
51
- Filesystem 1024-blocks Used Available Capacity Mounted on
52
- Global 10485760 130872 10354888 2% /
53
- Global 5242880 39572 5203308 1% /home
54
- Global 5242880 1477164 3765716 29% /opt
55
- Global - - - - /proc
56
- Global 5242880 42884 5199996 1% /tmp
57
- Global 5242880 2725048 2517832 52% /usr
58
- Global 10485760 272376 10213384 3% /var
59
- DF_PK
60
-
61
- @mount_lpar = <<~MOUNT
62
- node mounted mounted over vfs date options
63
- -------- --------------- --------------- ------ ------------ ---------------
64
- /dev/hd4 / jfs2 Jul 17 13:22 rw,log=/dev/hd8
65
- /dev/hd2 /usr jfs2 Jul 17 13:22 rw,log=/dev/hd8
66
- /dev/hd9var /var jfs2 Jul 17 13:22 rw,log=/dev/hd8
67
- /dev/hd3 /tmp jfs2 Jul 17 13:22 rw,log=/dev/hd8
68
- /dev/hd1 /home jfs2 Jul 17 13:22 rw,log=/dev/hd8
69
- /dev/hd11admin /admin jfs2 Jul 17 13:22 rw,log=/dev/hd8
70
- /proc /proc procfs Jul 17 13:22 rw
71
- /dev/hd10opt /opt jfs2 Jul 17 13:22 rw,log=/dev/hd8
72
- 192.168.1.11 /stage/middleware1 /stage/middleware2 nfs3 Jul 17 13:24 ro,bg,hard,intr,sec=sys
73
- MOUNT
74
-
75
- @mount_wpar = <<~MOUNT
76
- node mounted mounted over vfs date options
77
- -------- --------------- --------------- ------ ------------ ---------------
78
- Global / jfs2 Nov 23 21:03 rw,log=NULL
79
- Global /home jfs2 Nov 23 21:03 rw,log=NULL
80
- Global /opt jfs2 Nov 23 21:03 rw,log=NULL
81
- Global /proc namefs Nov 23 21:03 rw
82
- Global /tmp jfs2 Nov 23 21:03 rw,log=NULL
83
- Global /usr jfs2 Nov 23 21:03 rw,log=NULL
84
- Global /var jfs2 Nov 23 21:03 rw,log=NULL
85
- 192.168.1.11 /stage/middleware3 /stage/middleware4 nfs3 Jul 17 13:24 ro,bg,hard,intr,sec=sys
86
- MOUNT
87
-
88
- @plugin = get_plugin("filesystem")
89
- allow(@plugin).to receive(:collect_os).and_return(:aix)
90
- @plugin[:filesystem] = Mash.new
91
- end
92
-
93
- context "when run within an LPAR" do
94
- before do
95
- allow(@plugin).to receive(:shell_out).with("df -Pk").and_return(mock_shell_out(0, @df_pk_lpar, nil))
96
- allow(@plugin).to receive(:shell_out).with("mount").and_return(mock_shell_out(0, @mount_lpar, nil))
97
- @plugin.run
98
- end
99
-
100
- describe "df -Pk" do
101
-
102
- it "returns the filesystem block size" do
103
- expect(@plugin[:filesystem]["/dev/hd4"]["kb_size"]).to eq("2097152")
104
- expect(@plugin[:filesystem2]["by_pair"]["/dev/hd4,/"]["kb_size"]).to eq("2097152")
105
- end
106
-
107
- it "returns the filesystem used space in kb" do
108
- expect(@plugin[:filesystem]["/dev/hd4"]["kb_used"]).to eq("219796")
109
- expect(@plugin[:filesystem2]["by_pair"]["/dev/hd4,/"]["kb_used"]).to eq("219796")
110
- end
111
-
112
- it "returns the filesystem available space in kb" do
113
- expect(@plugin[:filesystem]["/dev/hd4"]["kb_available"]).to eq("1877356")
114
- expect(@plugin[:filesystem2]["by_pair"]["/dev/hd4,/"]["kb_available"]).to eq("1877356")
115
- end
116
-
117
- it "returns the filesystem capacity in percentage" do
118
- expect(@plugin[:filesystem]["/dev/hd4"]["percent_used"]).to eq("11%")
119
- expect(@plugin[:filesystem2]["by_pair"]["/dev/hd4,/"]["percent_used"]).to eq("11%")
120
- end
121
-
122
- it "returns the filesystem mounted location" do
123
- expect(@plugin[:filesystem]["/dev/hd4"]["mount"]).to eq("/")
124
- expect(@plugin[:filesystem2]["by_pair"]["/dev/hd4,/"]["mount"]).to eq("/")
125
- end
126
- end
127
-
128
- describe "mount" do
129
-
130
- it "returns the filesystem mount location" do
131
- expect(@plugin[:filesystem]["/dev/hd4"]["mount"]).to eq("/")
132
- expect(@plugin[:filesystem2]["by_pair"]["/dev/hd4,/"]["mount"]).to eq("/")
133
- end
134
-
135
- it "returns the filesystem type" do
136
- expect(@plugin[:filesystem]["/dev/hd4"]["fs_type"]).to eq("jfs2")
137
- expect(@plugin[:filesystem2]["by_pair"]["/dev/hd4,/"]["fs_type"]).to eq("jfs2")
138
- end
139
-
140
- it "returns the filesystem mount options" do
141
- expect(@plugin[:filesystem]["/dev/hd4"]["mount_options"]).to eq(["rw", "log=/dev/hd8"])
142
- expect(@plugin[:filesystem2]["by_pair"]["/dev/hd4,/"]["mount_options"]).to eq(["rw", "log=/dev/hd8"])
143
- end
144
-
145
- # For entries like 192.168.1.11 /stage/middleware1 /stage/middleware2 nfs3 Jul 17 13:24 ro,bg,hard,intr,sec=sys
146
- context "having node values" do
147
-
148
- it "returns the filesystem mount location" do
149
- expect(@plugin[:filesystem]["192.168.1.11:/stage/middleware1"]["mount"]).to eq("/stage/middleware2")
150
- expect(@plugin[:filesystem2]["by_pair"]["192.168.1.11:/stage/middleware1,/stage/middleware2"]["mount"]).to eq("/stage/middleware2")
151
- end
152
-
153
- it "returns the filesystem type" do
154
- expect(@plugin[:filesystem]["192.168.1.11:/stage/middleware1"]["fs_type"]).to eq("nfs3")
155
- expect(@plugin[:filesystem2]["by_pair"]["192.168.1.11:/stage/middleware1,/stage/middleware2"]["fs_type"]).to eq("nfs3")
156
- end
157
-
158
- it "returns the filesystem mount options" do
159
- expect(@plugin[:filesystem]["192.168.1.11:/stage/middleware1"]["mount_options"]).to eq(["ro", "bg", "hard", "intr", "sec=sys"])
160
- expect(@plugin[:filesystem2]["by_pair"]["192.168.1.11:/stage/middleware1,/stage/middleware2"]["mount_options"]).to eq(["ro", "bg", "hard", "intr", "sec=sys"])
161
- end
162
- end
163
- end
164
- end
165
-
166
- context "when run within a WPAR" do
167
- before do
168
- allow(@plugin).to receive(:shell_out).with("df -Pk").and_return(mock_shell_out(0, @df_pk_wpar, nil))
169
- allow(@plugin).to receive(:shell_out).with("mount").and_return(mock_shell_out(0, @mount_wpar, nil))
170
- @plugin.run
171
- end
172
-
173
- describe "df -Pk" do
174
-
175
- it "returns the filesystem block size" do
176
- expect(@plugin[:filesystem]["Global:/"]["kb_size"]).to eq("10485760")
177
- expect(@plugin[:filesystem2]["by_pair"]["Global:/,/"]["kb_size"]).to eq("10485760")
178
- end
179
-
180
- it "returns the filesystem used space in kb" do
181
- expect(@plugin[:filesystem]["Global:/"]["kb_used"]).to eq("130872")
182
- expect(@plugin[:filesystem2]["by_pair"]["Global:/,/"]["kb_used"]).to eq("130872")
183
- end
184
-
185
- it "returns the filesystem available space in kb" do
186
- expect(@plugin[:filesystem]["Global:/"]["kb_available"]).to eq("10354888")
187
- expect(@plugin[:filesystem2]["by_pair"]["Global:/,/"]["kb_available"]).to eq("10354888")
188
- end
189
-
190
- it "returns the filesystem capacity in percentage" do
191
- expect(@plugin[:filesystem]["Global:/"]["percent_used"]).to eq("2%")
192
- expect(@plugin[:filesystem2]["by_pair"]["Global:/,/"]["percent_used"]).to eq("2%")
193
- end
194
-
195
- it "returns the filesystem mounted location" do
196
- expect(@plugin[:filesystem]["Global:/"]["mount"]).to eq("/")
197
- expect(@plugin[:filesystem2]["by_pair"]["Global:/,/"]["mount"]).to eq("/")
198
- end
199
- end
200
-
201
- describe "mount" do
202
-
203
- it "returns the filesystem mount location" do
204
- expect(@plugin[:filesystem]["Global:/"]["mount"]).to eq("/")
205
- expect(@plugin[:filesystem2]["by_pair"]["Global:/,/"]["mount"]).to eq("/")
206
- end
207
-
208
- it "returns the filesystem type" do
209
- expect(@plugin[:filesystem]["Global:/"]["fs_type"]).to eq("jfs2")
210
- expect(@plugin[:filesystem2]["by_pair"]["Global:/,/"]["fs_type"]).to eq("jfs2")
211
- end
212
-
213
- it "returns the filesystem mount options" do
214
- expect(@plugin[:filesystem]["Global:/"]["mount_options"]).to eq(["rw", "log=NULL"])
215
- expect(@plugin[:filesystem2]["by_pair"]["Global:/,/"]["mount_options"]).to eq(["rw", "log=NULL"])
216
- end
217
-
218
- # For entries like 192.168.1.11 /stage/middleware3 /stage/middleware4 nfs3 Jul 17 13:24 ro,bg,hard,intr,sec=sys
219
- context "having node values" do
220
-
221
- it "returns the filesystem mount location" do
222
- expect(@plugin[:filesystem]["192.168.1.11:/stage/middleware3"]["mount"]).to eq("/stage/middleware4")
223
- expect(@plugin[:filesystem2]["by_pair"]["192.168.1.11:/stage/middleware3,/stage/middleware4"]["mount"]).to eq("/stage/middleware4")
224
- end
225
-
226
- it "returns the filesystem type" do
227
- expect(@plugin[:filesystem]["192.168.1.11:/stage/middleware3"]["fs_type"]).to eq("nfs3")
228
- expect(@plugin[:filesystem2]["by_pair"]["192.168.1.11:/stage/middleware3,/stage/middleware4"]["fs_type"]).to eq("nfs3")
229
- end
230
-
231
- it "returns the filesystem mount options" do
232
- expect(@plugin[:filesystem]["192.168.1.11:/stage/middleware3"]["mount_options"]).to eq(["ro", "bg", "hard", "intr", "sec=sys"])
233
- expect(@plugin[:filesystem2]["by_pair"]["192.168.1.11:/stage/middleware3,/stage/middleware4"]["mount_options"]).to eq(["ro", "bg", "hard", "intr", "sec=sys"])
234
- end
235
- end
236
- end
237
- end
238
- end
@@ -1,33 +0,0 @@
1
- #
2
- # Author:: Prabhu Das (<prabhu.das@clogeny.com>)
3
- # Author:: Isa Farnik (<isa@chef.io>)
4
- # Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
5
- # License:: Apache License, Version 2.0
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
-
19
- require "spec_helper"
20
-
21
- describe Ohai::System, "AIX hostname plugin" do
22
- before do
23
- @plugin = get_plugin("hostname")
24
- allow(@plugin).to receive(:collect_os).and_return(:aix)
25
- allow(@plugin).to receive(:from_cmd).with("hostname -s").and_return("aix_admin")
26
- allow(@plugin).to receive(:from_cmd).with("hostname").and_return("aix_admin.ponyville.com")
27
- @plugin.run
28
- end
29
-
30
- it "sets the machinename" do
31
- expect(@plugin[:machinename]).to eql("aix_admin")
32
- end
33
- end
@@ -1,61 +0,0 @@
1
- #
2
- # Author:: Prabhu Das (<prabhu.das@clogeny.com>)
3
- # Author:: Isa Farnik (<isa@chef.io>)
4
- # Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
5
- # License:: Apache License, Version 2.0
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
-
19
- require "spec_helper"
20
-
21
- describe Ohai::System, "AIX kernel plugin" do
22
- before do
23
- @plugin = get_plugin("aix/kernel")
24
- allow(@plugin).to receive(:collect_os).and_return(:aix)
25
- allow(@plugin).to receive(:shell_out).with("uname -s").and_return(mock_shell_out(0, "AIX", nil))
26
- allow(@plugin).to receive(:shell_out).with("uname -r").and_return(mock_shell_out(0, "1", nil))
27
- allow(@plugin).to receive(:shell_out).with("uname -v").and_return(mock_shell_out(0, "6", nil))
28
- allow(@plugin).to receive(:shell_out).with("uname -p").and_return(mock_shell_out(0, "powerpc", nil))
29
- allow(@plugin).to receive(:shell_out).with("genkex -d").and_return(mock_shell_out(0, " Text address Size Data address Size File\nf1000000c0338000 77000 f1000000c0390000 1ec8c /usr/lib/drivers/cluster\n 6390000 20000 63a0000 ba8 /usr/lib/drivers/if_en", nil))
30
- allow(@plugin).to receive(:shell_out).with("getconf KERNEL_BITMODE").and_return(mock_shell_out(0, "64", nil))
31
- @plugin.run
32
- end
33
-
34
- it "uname -s detects the name" do
35
- expect(@plugin[:kernel][:name]).to eq("aix")
36
- end
37
-
38
- it "uname -r detects the release" do
39
- expect(@plugin[:kernel][:release]).to eq("1")
40
- end
41
-
42
- it "uname -v detects the version" do
43
- expect(@plugin[:kernel][:version]).to eq("6")
44
- end
45
-
46
- it "uname -p detects the machine" do
47
- expect(@plugin[:kernel][:machine]).to eq("powerpc")
48
- end
49
-
50
- it "getconf KERNEL_BITMODE detects the kernel's bittiness" do
51
- expect(@plugin[:kernel][:bits]).to eq("64")
52
- end
53
-
54
- it "detects the modules" do
55
- expect(@plugin[:kernel][:modules]["/usr/lib/drivers/cluster"]["text"]).to eq({ "address" => "f1000000c0338000", "size" => "77000" })
56
- expect(@plugin[:kernel][:modules]["/usr/lib/drivers/cluster"]["data"]).to eq({ "address" => "f1000000c0390000", "size" => "1ec8c" })
57
- expect(@plugin[:kernel][:modules]["/usr/lib/drivers/if_en"]["text"]).to eq({ "address" => "6390000", "size" => "20000" })
58
- expect(@plugin[:kernel][:modules]["/usr/lib/drivers/if_en"]["data"]).to eq({ "address" => "63a0000", "size" => "ba8" })
59
-
60
- end
61
- end
@@ -1,49 +0,0 @@
1
- #
2
- # Author:: Isa Farnik (<isa@chef.io>)
3
- # Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
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
- describe Ohai::System, "AIX memory plugin" do
22
- before do
23
- @plugin = get_plugin("aix/memory")
24
- allow(@plugin).to receive(:collect_os).and_return(:aix)
25
- allow(@plugin).to receive(:shell_out).with("svmon -G -O unit=MB,summary=longreal | grep '[0-9]'").and_return(mock_shell_out(0, " 513280.00 340034.17 173245.83 62535.17 230400.05 276950.14 70176.00\n", nil))
26
- @swap_s = "allocated = 23887872 blocks used = 288912 blocks free = 23598960 blocks\n"
27
- allow(@plugin).to receive(:shell_out).with("swap -s").and_return(mock_shell_out(0, @swap_s, nil))
28
- end
29
-
30
- it "gets total memory" do
31
- @plugin.run
32
- expect(@plugin["memory"]["total"]).to eql("#{513280 * 1024}kB")
33
- end
34
-
35
- it "gets free memory" do
36
- @plugin.run
37
- expect(@plugin["memory"]["free"]).to eql("#{173245.83.to_i * 1024}kB")
38
- end
39
-
40
- it "gets total swap" do
41
- @plugin.run
42
- expect(@plugin["memory"]["swap"]["total"]).to eql( "#{23887872 * 4}kB")
43
- end
44
-
45
- it "gets free swap" do
46
- @plugin.run
47
- expect(@plugin["memory"]["swap"]["free"]).to eql( "#{23598960 * 4}kB")
48
- end
49
- end
@@ -1,313 +0,0 @@
1
- #
2
- # Author:: Prabhu Das (<prabhu.das@clogeny.com>)
3
- # Author:: Isa Farnik (<isa@chef.io>)
4
- # Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
5
- # License:: Apache License, Version 2.0
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
-
19
- require "spec_helper"
20
-
21
- describe Ohai::System, "AIX network plugin" do
22
-
23
- before do
24
- @netstat_rn_grep_default = <<~NETSTAT_RN_GREP_DEFAULT
25
- default 172.31.8.1 UG 2 121789 en0 - -
26
- NETSTAT_RN_GREP_DEFAULT
27
-
28
- @ifconfig = <<~IFCONFIG
29
- en0: flags=1e080863,480<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),CHAIN> metric 1
30
- inet 172.29.174.58 netmask 0xffffc000 broadcast 172.29.191.255
31
- inet 172.29.174.59 broadcast 172.29.191.255
32
- inet 172.29.174.60 netmask 0xffffc000 broadcast 172.29.191.255
33
- inet6 ::1%1/0
34
- tcp_sendspace 262144 tcp_recvspace 262144 rfc1323 1
35
- en1: flags=1e084863,480<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),CHAIN>
36
- inet 172.31.10.211 netmask 0xfffffc00 broadcast 172.31.11.255
37
- tcp_sendspace 262144 tcp_recvspace 262144 rfc1323 1
38
- lo0: flags=e08084b,c0<UP,BROADCAST,LOOPBACK,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,LARGESEND,CHAIN>
39
- inet 127.0.0.1 netmask 0xff000000 broadcast 127.255.255.255
40
- inet6 ::1%1/0
41
- tcp_sendspace 131072 tcp_recvspace 131072 rfc1323 1
42
- IFCONFIG
43
-
44
- @netstat_nrf_inet = <<~NETSTAT_NRF_INET
45
- Destination Gateway Flags Refs Use If Exp Groups
46
- Route Tree for Protocol Family 2 (Internet):
47
- default 172.29.128.13 UG 0 587683 en0 - -
48
- 172.29.128.0 172.29.174.58 UHSb 0 0 en0 - - =>
49
- 172.29.128/18 172.29.174.58 U 7 1035485 en0 - -
50
- 172.29.191.255 172.29.174.58 UHSb 0 1 en0 - -
51
- NETSTAT_NRF_INET
52
-
53
- @entstat_err = <<~ENSTAT_ERR
54
-
55
-
56
- entstat: 0909-002 Unable to open device en0, errno = 13
57
- grep: 0652-033 Cannot open Address".
58
- ENSTAT_ERR
59
-
60
- @aix_arp_an = <<~ARP_AN
61
- ? (172.29.131.16) at 6e:87:70:0:40:3 [ethernet] stored in bucket 16
62
-
63
- ? (10.153.50.202) at 34:40:b5:ab:fb:5a [ethernet] stored in bucket 40
64
-
65
- ? (10.153.1.99) at 52:54:0:8e:f2:fb [ethernet] stored in bucket 58
66
-
67
- ? (172.29.132.250) at 34:40:b5:a5:d7:1e [ethernet] stored in bucket 59
68
-
69
- ? (172.29.132.253) at 34:40:b5:a5:d7:2a [ethernet] stored in bucket 62
70
-
71
- ? (172.29.128.13) at 60:73:5c:69:42:44 [ethernet] stored in bucket 139
72
-
73
- bucket: 0 contains: 0 entries
74
- There are 6 entries in the arp table.
75
- ARP_AN
76
-
77
- @plugin = get_plugin("aix/network")
78
- allow(@plugin).to receive(:collect_os).and_return(:aix)
79
- @plugin[:network] = Mash.new
80
- allow(@plugin).to receive(:shell_out).with("uname -W").and_return(mock_shell_out(0, "0", nil))
81
- allow(@plugin).to receive(:shell_out).with("netstat -rn |grep default").and_return(mock_shell_out(0, @netstat_rn_grep_default, nil))
82
- allow(@plugin).to receive(:shell_out).with("ifconfig -a").and_return(mock_shell_out(0, @ifconfig, nil))
83
- allow(@plugin).to receive(:shell_out).with("entstat -d en0 | grep \"Hardware Address\"").and_return(mock_shell_out(0, "Hardware Address: be:42:80:00:b0:05", nil))
84
- allow(@plugin).to receive(:shell_out).with("entstat -d en1 | grep \"Hardware Address\"").and_return(mock_shell_out(0, @entstat_err, nil))
85
- allow(@plugin).to receive(:shell_out).with("entstat -d lo0 | grep \"Hardware Address\"").and_return(mock_shell_out(0, @entstat_err, nil))
86
- allow(@plugin).to receive(:shell_out).with("netstat -nrf inet").and_return(mock_shell_out(0, @netstat_nrf_inet, nil))
87
- allow(@plugin).to receive(:shell_out).with("netstat -nrf inet6").and_return(mock_shell_out(0, "::1%1 ::1%1 UH 1 109392 en0 - -", nil))
88
- allow(@plugin).to receive(:shell_out).with("arp -an").and_return(mock_shell_out(0, @aix_arp_an, nil))
89
- end
90
-
91
- describe "run" do
92
- before do
93
- @plugin.run
94
- end
95
-
96
- it "detects network information" do
97
- expect(@plugin["network"]).not_to be_nil
98
- end
99
-
100
- it "detects the interfaces" do
101
- expect(@plugin["network"]["interfaces"].keys.sort).to eq(%w{en0 en1 lo0})
102
- end
103
-
104
- it "detects the ip addresses of the interfaces" do
105
- expect(@plugin["network"]["interfaces"]["en0"]["addresses"].keys).to include("172.29.174.58")
106
- end
107
- end
108
-
109
- describe "when running on an LPAR" do
110
-
111
- describe "sets the top-level attribute correctly" do
112
- before do
113
- @plugin.run
114
- end
115
-
116
- it "for 'macaddress'" do
117
- expect(@plugin[:macaddress]).to eq("BE:42:80:00:B0:05")
118
- end
119
- end
120
-
121
- describe "netstat -rn |grep default" do
122
- before do
123
- @plugin.run
124
- end
125
-
126
- it "returns the default gateway of the system's network" do
127
- expect(@plugin[:network][:default_gateway]).to eq("172.31.8.1")
128
- end
129
-
130
- it "returns the default interface of the system's network" do
131
- expect(@plugin[:network][:default_interface]).to eq("en0")
132
- end
133
- end
134
- end
135
-
136
- describe "when running on a WPAR" do
137
- before do
138
- allow(@plugin).to receive(:shell_out).with("uname -W").and_return(mock_shell_out(0, "6", nil))
139
- @plugin.run
140
- end
141
-
142
- it "avoids collecting routing information" do
143
- expect(@plugin[:network][:default_gateway]).to be_nil
144
- end
145
-
146
- it "avoids collecting default interface" do
147
- expect(@plugin[:network][:default_gateway]).to be_nil
148
- end
149
-
150
- it "avoids collecting a macaddress" do
151
- expect(@plugin[:macaddress]).to be_nil
152
- end
153
- end
154
-
155
- describe "lsdev -Cc if" do
156
- it "detects the state of the interfaces in the system" do
157
- @plugin.run
158
- expect(@plugin["network"]["interfaces"]["en0"][:state]).to eq("up")
159
- end
160
-
161
- describe "ifconfig interface" do
162
- it "detects the CHAIN network flag" do
163
- @plugin.run
164
- expect(@plugin["network"]["interfaces"]["en0"][:flags]).to include("CHAIN")
165
- end
166
-
167
- it "detects the metric network flag" do
168
- @plugin.run
169
- expect(@plugin["network"]["interfaces"]["en0"][:metric]).to eq("1")
170
- end
171
-
172
- context "inet entries" do
173
- before do
174
- @plugin.run
175
- @inet_entry = @plugin["network"]["interfaces"]["en0"][:addresses]["172.29.174.58"]
176
- end
177
-
178
- it "detects the family" do
179
- expect(@inet_entry[:family]).to eq("inet")
180
- end
181
-
182
- it "detects the netmask" do
183
- expect(@inet_entry[:netmask]).to eq("255.255.192.0")
184
- end
185
-
186
- it "detects the broadcast" do
187
- expect(@inet_entry[:broadcast]).to eq("172.29.191.255")
188
- end
189
-
190
- it "detects all key-values" do
191
- expect(@plugin["network"]["interfaces"]["en0"][:tcp_sendspace]).to eq("262144")
192
- expect(@plugin["network"]["interfaces"]["en0"][:tcp_recvspace]).to eq("262144")
193
- expect(@plugin["network"]["interfaces"]["en0"][:rfc1323]).to eq("1")
194
- end
195
-
196
- # For an output with no netmask like inet 172.29.174.59 broadcast 172.29.191.255
197
- context "with no netmask in the output" do
198
- before do
199
- allow(@plugin).to receive(:shell_out).with("ifconfig en0").and_return(mock_shell_out(0, "inet 172.29.174.59 broadcast 172.29.191.255", nil))
200
- end
201
-
202
- it "detects the default prefixlen" do
203
- @inet_entry = @plugin["network"]["interfaces"]["en0"][:addresses]["172.29.174.59"]
204
- expect(@inet_entry[:prefixlen]).to eq("32")
205
- end
206
-
207
- it "detects the default netmask" do
208
- @inet_entry = @plugin["network"]["interfaces"]["en0"][:addresses]["172.29.174.59"]
209
- expect(@inet_entry[:netmask]).to eq("255.255.255.255")
210
- end
211
- end
212
- end
213
-
214
- context "inet6 entries" do
215
- before do
216
- @plugin.run
217
- @inet_entry = @plugin["network"]["interfaces"]["en0"][:addresses]["::1"]
218
- end
219
-
220
- it "detects the prefixlen" do
221
- expect(@inet_entry[:prefixlen]).to eq("0")
222
- end
223
-
224
- it "detects the family" do
225
- expect(@inet_entry[:family]).to eq("inet6")
226
- end
227
- end
228
- end
229
-
230
- context "entstat -d interface" do
231
- before do
232
- @plugin.run
233
- @inet_interface_addresses = @plugin["network"]["interfaces"]["en0"][:addresses]["BE:42:80:00:B0:05"]
234
- end
235
-
236
- it "detects the family" do
237
- expect(@inet_interface_addresses[:family]).to eq("lladdr")
238
- end
239
- end
240
- end
241
-
242
- describe "netstat -nrf family" do
243
- before do
244
- @plugin.run
245
- end
246
-
247
- context "inet" do
248
- it "detects the route destinations" do
249
- expect(@plugin["network"]["interfaces"]["en0"][:routes][0][:destination]).to eq("default")
250
- expect(@plugin["network"]["interfaces"]["en0"][:routes][1][:destination]).to eq("172.29.128.0")
251
- end
252
-
253
- it "detects the route family" do
254
- expect(@plugin["network"]["interfaces"]["en0"][:routes][0][:family]).to eq("inet")
255
- end
256
-
257
- it "detects the route gateway" do
258
- expect(@plugin["network"]["interfaces"]["en0"][:routes][0][:via]).to eq("172.29.128.13")
259
- end
260
-
261
- it "detects the route flags" do
262
- expect(@plugin["network"]["interfaces"]["en0"][:routes][0][:flags]).to eq("UG")
263
- end
264
- end
265
-
266
- context "inet6" do
267
-
268
- it "detects the route destinations" do
269
- expect(@plugin["network"]["interfaces"]["en0"][:routes][4][:destination]).to eq("::1%1")
270
- end
271
-
272
- it "detects the route family" do
273
- expect(@plugin["network"]["interfaces"]["en0"][:routes][4][:family]).to eq("inet6")
274
- end
275
-
276
- it "detects the route gateway" do
277
- expect(@plugin["network"]["interfaces"]["en0"][:routes][4][:via]).to eq("::1%1")
278
- end
279
-
280
- it "detects the route flags" do
281
- expect(@plugin["network"]["interfaces"]["en0"][:routes][4][:flags]).to eq("UH")
282
- end
283
- end
284
- end
285
-
286
- describe "arp -an" do
287
- before do
288
- @plugin.run
289
- end
290
-
291
- it "supresses the hostname entries" do
292
- expect(@plugin["network"]["arp"][0][:remote_host]).to eq("?")
293
- end
294
-
295
- it "detects the remote ip entry" do
296
- expect(@plugin["network"]["arp"][0][:remote_ip]).to eq("172.29.131.16")
297
- end
298
-
299
- it "detects the remote mac entry" do
300
- expect(@plugin["network"]["arp"][0][:remote_mac]).to eq("6e:87:70:0:40:3")
301
- end
302
- end
303
-
304
- describe "hex_to_dec_netmask method" do
305
- before do
306
- @plugin.run
307
- end
308
-
309
- it "converts a netmask from hexadecimal form to decimal form" do
310
- expect(@plugin.hex_to_dec_netmask("0xffff0000")).to eq("255.255.0.0")
311
- end
312
- end
313
- end