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,30 +0,0 @@
1
- #
2
- # Author:: John Bellone (<jbellone@bloomberg.net>)
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 "spec_helper"
19
-
20
- describe Ohai::System, "timezone plugin" do
21
- before do
22
- @plugin = get_plugin("timezone")
23
- allow(Time).to receive_message_chain(:now, :getlocal, :zone) { "ZZZ" }
24
- end
25
-
26
- it "gets the local timezone" do
27
- @plugin.run
28
- expect(@plugin["time"]["timezone"]).to eq("ZZZ")
29
- end
30
- end
@@ -1,14 +0,0 @@
1
- # Author:: "Joshua Colson" <joshua.colson@gmail.com>
2
- # License:: Apache License, Version 2.0
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
@@ -1,375 +0,0 @@
1
- # Author:: Tim Smith (<tsmith@chef.io>)
2
- # Copyright:: Copyright (c) 2015-2019 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 "spec_helper"
19
-
20
- vbox_list_vms_stdout = <<~EOF
21
- "ubuntu-18.04-amd64_1549746024485_35372" {6294f16b-4f05-4430-afb9-773bdb237aec}
22
- EOF
23
-
24
- vbox_vminfo_stdout = <<~EOF
25
- name="ubuntu-18.04-amd64_1549746024485_35372"
26
- groups="/"
27
- ostype="Ubuntu (64-bit)"
28
- UUID="6294f16b-4f05-4430-afb9-773bdb237aec"
29
- CfgFile="/virtual/machines/ubuntu-18.04-amd64_1549746024485_35372/ubuntu-18.04-amd64_1549746024485_35372.vbox"
30
- SnapFldr="/virtual/machines/ubuntu-18.04-amd64_1549746024485_35372/Snapshots"
31
- LogFldr="/virtual/machines/ubuntu-18.04-amd64_1549746024485_35372/Logs"
32
- hardwareuuid="6294f16b-4f05-4430-afb9-773bdb237aec"
33
- memory=1024
34
- pagefusion="off"
35
- vram=8
36
- cpuexecutioncap=100
37
- hpet="off"
38
- chipset="piix3"
39
- firmware="BIOS"
40
- cpus=1
41
- pae="on"
42
- longmode="on"
43
- triplefaultreset="off"
44
- apic="on"
45
- x2apic="on"
46
- cpuid-portability-level=0
47
- bootmenu="messageandmenu"
48
- boot1="disk"
49
- boot2="dvd"
50
- boot3="none"
51
- boot4="none"
52
- acpi="on"
53
- ioapic="on"
54
- biosapic="apic"
55
- biossystemtimeoffset=0
56
- rtcuseutc="off"
57
- hwvirtex="on"
58
- nestedpaging="on"
59
- largepages="on"
60
- vtxvpid="on"
61
- vtxux="on"
62
- paravirtprovider="default"
63
- effparavirtprovider="kvm"
64
- VMState="poweroff"
65
- VMStateChangeTime="2019-02-09T21:00:33.575000000"
66
- monitorcount=1
67
- accelerate3d="off"
68
- accelerate2dvideo="off"
69
- teleporterenabled="off"
70
- teleporterport=0
71
- teleporteraddress=""
72
- teleporterpassword=""
73
- tracing-enabled="off"
74
- tracing-allow-vm-access="off"
75
- tracing-config=""
76
- autostart-enabled="off"
77
- autostart-delay=0
78
- defaultfrontend=""
79
- storagecontrollername0="IDE Controller"
80
- storagecontrollertype0="PIIX4"
81
- storagecontrollerinstance0="0"
82
- storagecontrollermaxportcount0="2"
83
- storagecontrollerportcount0="2"
84
- storagecontrollerbootable0="on"
85
- storagecontrollername1="SATA Controller"
86
- storagecontrollertype1="IntelAhci"
87
- storagecontrollerinstance1="0"
88
- storagecontrollermaxportcount1="30"
89
- storagecontrollerportcount1="1"
90
- storagecontrollerbootable1="on"
91
- "IDE Controller-0-0"="none"
92
- "IDE Controller-0-1"="none"
93
- "IDE Controller-1-0"="none"
94
- "IDE Controller-1-1"="none"
95
- "SATA Controller-0-0"="/virtual/machines/ubuntu-18.04-amd64_1549746024485_35372/Snapshots/{1c182745-4b09-41a1-a147-d3ced46f72f6}.vmdk"
96
- "SATA Controller-ImageUUID-0-0"="1c182745-4b09-41a1-a147-d3ced46f72f6"
97
- natnet1="nat"
98
- macaddress1="080027E5FA8F"
99
- cableconnected1="on"
100
- nic1="nat"
101
- nictype1="82540EM"
102
- nicspeed1="0"
103
- mtu="0"
104
- sockSnd="64"
105
- sockRcv="64"
106
- tcpWndSnd="64"
107
- tcpWndRcv="64"
108
- nic2="none"
109
- nic3="none"
110
- nic4="none"
111
- nic5="none"
112
- nic6="none"
113
- nic7="none"
114
- nic8="none"
115
- hidpointing="ps2mouse"
116
- hidkeyboard="ps2kbd"
117
- uart1="off"
118
- uart2="off"
119
- uart3="off"
120
- uart4="off"
121
- lpt1="off"
122
- lpt2="off"
123
- audio="pulse"
124
- audio_in="false"
125
- audio_out="false"
126
- clipboard="disabled"
127
- draganddrop="disabled"
128
- vrde="on"
129
- vrdeport=-1
130
- vrdeports="5947"
131
- vrdeaddress="127.0.0.1"
132
- vrdeauthtype="null"
133
- vrdemulticon="off"
134
- vrdereusecon="off"
135
- vrdevideochannel="off"
136
- vrdeproperty[TCP/Ports]="5947"
137
- vrdeproperty[TCP/Address]="127.0.0.1"
138
- usb="off"
139
- ehci="off"
140
- xhci="off"
141
- GuestMemoryBalloon=0
142
- SnapshotName="base"
143
- SnapshotUUID="085cbbec-70cd-4864-9208-5d938dcabb71"
144
- CurrentSnapshotName="base"
145
- CurrentSnapshotUUID="085cbbec-70cd-4864-9208-5d938dcabb71"
146
- CurrentSnapshotNode="SnapshotName"
147
- EOF
148
-
149
- vbox_list_hdds_stdout = <<~EOF
150
- UUID: ebb6dca0-879f-480b-a50e-9efe330bd021
151
- Parent UUID: base
152
- State: locked read
153
- Type: normal (base)
154
- Location: /virtual/machines/ubuntu-18.04-amd64_1549746024485_35372/ubuntu-18.04-amd64-disk001.vmdk
155
- Storage format: VMDK
156
- Capacity: 65536 MBytes
157
- Encryption: disabled
158
-
159
- UUID: 1c182745-4b09-41a1-a147-d3ced46f72f6
160
- Parent UUID: ebb6dca0-879f-480b-a50e-9efe330bd021
161
- State: created
162
- Type: normal (differencing)
163
- Location: /virtual/machines/ubuntu-18.04-amd64_1549746024485_35372/Snapshots/{1c182745-4b09-41a1-a147-d3ced46f72f6}.vmdk
164
- Storage format: VMDK
165
- Capacity: 65536 MBytes
166
- Encryption: disabled
167
-
168
- EOF
169
-
170
- vbox_list_dvds_stdout = <<~EOF
171
- UUID: 897aa7bc-1ec1-4e13-a16d-101d3716c72d
172
- State: created
173
- Type: normal (base)
174
- Location: /tmp/test.dvd
175
- Storage format: RAW
176
- Capacity: 100 MBytes
177
- Encryption: disabled
178
-
179
- EOF
180
-
181
- vbox_list_hostdvds_stdout = <<~EOF
182
- UUID: 00445644-0000-0000-2f64-65762f737230
183
- Name: /dev/sr0
184
-
185
- EOF
186
-
187
- vbox_list_hostfloppies_stdout = <<~EOF
188
-
189
- EOF
190
-
191
- vbox_list_hostonlyifs_stdout = <<~EOF
192
- Name: vboxnet0
193
- GUID: 786f6276-656e-4074-8000-0a0027000000
194
- DHCP: Disabled
195
- IPAddress: 192.168.33.1
196
- NetworkMask: 255.255.255.0
197
- IPV6Address:
198
- IPV6NetworkMaskPrefixLength: 0
199
- HardwareAddress: 0a:00:27:00:00:00
200
- MediumType: Ethernet
201
- Wireless: No
202
- Status: Down
203
- VBoxNetworkName: HostInterfaceNetworking-vboxnet0
204
-
205
- Name: vboxnet1
206
- GUID: 786f6276-656e-4174-8000-0a0027000001
207
- DHCP: Disabled
208
- IPAddress: 192.168.19.1
209
- NetworkMask: 255.255.255.0
210
- IPV6Address: fe80::800:27ff:fe00:1
211
- IPV6NetworkMaskPrefixLength: 64
212
- HardwareAddress: 0a:00:27:00:00:01
213
- MediumType: Ethernet
214
- Wireless: No
215
- Status: Up
216
- VBoxNetworkName: HostInterfaceNetworking-vboxnet1
217
-
218
- EOF
219
-
220
- vbox_list_bridgedifs_stdout = <<~EOF
221
- Name: eno1
222
- GUID: 316f6e65-0000-4000-8000-309c233b62a9
223
- DHCP: Disabled
224
- IPAddress: 10.143.72.133
225
- NetworkMask: 255.255.255.224
226
- IPV6Address: fe80::9226:82e9:1101:60e6
227
- IPV6NetworkMaskPrefixLength: 64
228
- HardwareAddress: 30:9c:23:3b:62:a9
229
- MediumType: Ethernet
230
- Wireless: No
231
- Status: Up
232
- VBoxNetworkName: HostInterfaceNetworking-eno1
233
-
234
- EOF
235
-
236
- vbox_list_dhcpservers_stdout = <<~EOF
237
- NetworkName: HostInterfaceNetworking-vboxnet0
238
- IP: 192.168.56.100
239
- NetworkMask: 255.255.255.0
240
- lowerIPAddress: 192.168.56.101
241
- upperIPAddress: 192.168.56.254
242
- Enabled: Yes
243
-
244
- NetworkName: HostInterfaceNetworking-vboxnet1
245
- IP: 192.168.19.2
246
- NetworkMask: 255.255.255.0
247
- lowerIPAddress: 192.168.19.3
248
- upperIPAddress: 192.168.19.254
249
- Enabled: Yes
250
-
251
- EOF
252
-
253
- # output of: VBoxManage list --sorted natnets
254
- vbox_list_natnets_stdout = <<~EOF
255
- NetworkName: NatNetwork
256
- IP: 10.0.2.1
257
- Network: 10.0.2.0/24
258
- IPv6 Enabled: No
259
- IPv6 Prefix: fd17:625c:f037:2::/64
260
- DHCP Enabled: Yes
261
- Enabled: Yes
262
- loopback mappings (ipv4)
263
- 127.0.0.1=2
264
-
265
- EOF
266
-
267
- expected_output = { "guests" => { "ubuntu-18.04-amd64_1549746024485_35372" => { "groups" => "/", "ostype" => "Ubuntu (64-bit)", "uuid" => "6294f16b-4f05-4430-afb9-773bdb237aec", "cfgfile" => "/virtual/machines/ubuntu-18.04-amd64_1549746024485_35372/ubuntu-18.04-amd64_1549746024485_35372.vbox", "snapfldr" => "/virtual/machines/ubuntu-18.04-amd64_1549746024485_35372/Snapshots", "logfldr" => "/virtual/machines/ubuntu-18.04-amd64_1549746024485_35372/Logs", "hardwareuuid" => "6294f16b-4f05-4430-afb9-773bdb237aec", "memory" => "1024", "pagefusion" => "off", "vram" => "8", "cpuexecutioncap" => "100", "hpet" => "off", "chipset" => "piix3", "firmware" => "BIOS", "cpus" => "1", "pae" => "on", "longmode" => "on", "triplefaultreset" => "off", "apic" => "on", "x2apic" => "on", "cpuid-portability-level" => "0", "bootmenu" => "messageandmenu", "boot1" => "disk", "boot2" => "dvd", "boot3" => "none", "boot4" => "none", "acpi" => "on", "ioapic" => "on", "biosapic" => "apic", "biossystemtimeoffset" => "0", "rtcuseutc" => "off", "hwvirtex" => "on", "nestedpaging" => "on", "largepages" => "on", "vtxvpid" => "on", "vtxux" => "on", "paravirtprovider" => "default", "effparavirtprovider" => "kvm", "vmstate" => "poweroff", "vmstatechangetime" => "2019-02-09T21:00:33.575000000", "monitorcount" => "1", "accelerate3d" => "off", "accelerate2dvideo" => "off", "teleporterenabled" => "off", "teleporterport" => "0", "teleporteraddress" => "", "teleporterpassword" => "", "tracing-enabled" => "off", "tracing-allow-vm-access" => "off", "tracing-config" => "", "autostart-enabled" => "off", "autostart-delay" => "0", "defaultfrontend" => "", "storagecontrollername0" => "IDE Controller", "storagecontrollertype0" => "PIIX4", "storagecontrollerinstance0" => "0", "storagecontrollermaxportcount0" => "2", "storagecontrollerportcount0" => "2", "storagecontrollerbootable0" => "on", "storagecontrollername1" => "SATA Controller", "storagecontrollertype1" => "IntelAhci", "storagecontrollerinstance1" => "0", "storagecontrollermaxportcount1" => "30", "storagecontrollerportcount1" => "1", "storagecontrollerbootable1" => "on", "ide controller-0-0" => "none", "ide controller-0-1" => "none", "ide controller-1-0" => "none", "ide controller-1-1" => "none", "sata controller-0-0" => "/virtual/machines/ubuntu-18.04-amd64_1549746024485_35372/Snapshots/{1c182745-4b09-41a1-a147-d3ced46f72f6}.vmdk", "sata controller-imageuuid-0-0" => "1c182745-4b09-41a1-a147-d3ced46f72f6", "natnet1" => "nat", "macaddress1" => "080027E5FA8F", "cableconnected1" => "on", "nic1" => "nat", "nictype1" => "82540EM", "nicspeed1" => "0", "mtu" => "0", "socksnd" => "64", "sockrcv" => "64", "tcpwndsnd" => "64", "tcpwndrcv" => "64", "nic2" => "none", "nic3" => "none", "nic4" => "none", "nic5" => "none", "nic6" => "none", "nic7" => "none", "nic8" => "none", "hidpointing" => "ps2mouse", "hidkeyboard" => "ps2kbd", "uart1" => "off", "uart2" => "off", "uart3" => "off", "uart4" => "off", "lpt1" => "off", "lpt2" => "off", "audio" => "pulse", "audio_in" => "false", "audio_out" => "false", "clipboard" => "disabled", "draganddrop" => "disabled", "vrde" => "on", "vrdeport" => "-1", "vrdeports" => "5947", "vrdeaddress" => "127.0.0.1", "vrdeauthtype" => "null", "vrdemulticon" => "off", "vrdereusecon" => "off", "vrdevideochannel" => "off", "vrdeproperty[tcp/ports]" => "5947", "vrdeproperty[tcp/address]" => "127.0.0.1", "usb" => "off", "ehci" => "off", "xhci" => "off", "guestmemoryballoon" => "0", "snapshotname" => "base", "snapshotuuid" => "085cbbec-70cd-4864-9208-5d938dcabb71", "currentsnapshotname" => "base", "currentsnapshotuuid" => "085cbbec-70cd-4864-9208-5d938dcabb71", "currentsnapshotnode" => "SnapshotName" } }, "hdds" => { "/virtual/machines/ubuntu-18.04-amd64_1549746024485_35372/ubuntu-18.04-amd64-disk001.vmdk" => { "uuid" => "ebb6dca0-879f-480b-a50e-9efe330bd021", "parent uuid" => "base", "state" => "locked read", "type" => "normal (base)", "storage format" => "VMDK", "capacity" => "65536 MBytes", "encryption" => "disabled" }, "/virtual/machines/ubuntu-18.04-amd64_1549746024485_35372/Snapshots/{1c182745-4b09-41a1-a147-d3ced46f72f6}.vmdk" => { "uuid" => "1c182745-4b09-41a1-a147-d3ced46f72f6", "parent uuid" => "ebb6dca0-879f-480b-a50e-9efe330bd021", "state" => "created", "type" => "normal (differencing)", "storage format" => "VMDK", "capacity" => "65536 MBytes", "encryption" => "disabled" } }, "dvds" => { "/tmp/test.dvd" => { "uuid" => "897aa7bc-1ec1-4e13-a16d-101d3716c72d", "state" => "created", "type" => "normal (base)", "storage format" => "RAW", "capacity" => "100 MBytes", "encryption" => "disabled" } }, "hostdvds" => { "/dev/sr0" => { "uuid" => "00445644-0000-0000-2f64-65762f737230" } }, "hostfloppies" => {}, "hostonlyifs" => { "vboxnet0" => { "guid" => "786f6276-656e-4074-8000-0a0027000000", "dhcp" => "Disabled", "ipaddress" => "192.168.33.1", "networkmask" => "255.255.255.0", "ipv6address" => "", "ipv6networkmaskprefixlength" => "0", "hardwareaddress" => "0a:00:27:00:00:00", "mediumtype" => "Ethernet", "wireless" => "No", "status" => "Down", "vboxnetworkname" => "HostInterfaceNetworking-vboxnet0" }, "vboxnet1" => { "guid" => "786f6276-656e-4174-8000-0a0027000001", "dhcp" => "Disabled", "ipaddress" => "192.168.19.1", "networkmask" => "255.255.255.0", "ipv6address" => "fe80::800:27ff:fe00:1", "ipv6networkmaskprefixlength" => "64", "hardwareaddress" => "0a:00:27:00:00:01", "mediumtype" => "Ethernet", "wireless" => "No", "status" => "Up", "vboxnetworkname" => "HostInterfaceNetworking-vboxnet1" } }, "bridgedifs" => { "eno1" => { "guid" => "316f6e65-0000-4000-8000-309c233b62a9", "dhcp" => "Disabled", "ipaddress" => "10.143.72.133", "networkmask" => "255.255.255.224", "ipv6address" => "fe80::9226:82e9:1101:60e6", "ipv6networkmaskprefixlength" => "64", "hardwareaddress" => "30:9c:23:3b:62:a9", "mediumtype" => "Ethernet", "wireless" => "No", "status" => "Up", "vboxnetworkname" => "HostInterfaceNetworking-eno1" } }, "dhcpservers" => { "HostInterfaceNetworking-vboxnet0" => { "ip" => "192.168.56.100", "networkmask" => "255.255.255.0", "loweripaddress" => "192.168.56.101", "upperipaddress" => "192.168.56.254", "enabled" => "Yes" }, "HostInterfaceNetworking-vboxnet1" => { "ip" => "192.168.19.2", "networkmask" => "255.255.255.0", "loweripaddress" => "192.168.19.3", "upperipaddress" => "192.168.19.254", "enabled" => "Yes" } }, "natnets" => { "NatNetwork" => { "ip" => "10.0.2.1", "network" => "10.0.2.0/24", "ipv6 enabled" => "No", "ipv6 prefix" => "fd17:625c:f037:2::/64", "dhcp enabled" => "Yes", "enabled" => "Yes" } } }
268
-
269
- vbox_output = <<~EOF
270
- Oracle VM VirtualBox Guest Additions Command Line Management Interface Version 5.0.2
271
- (C) 2008-2015 Oracle Corporation
272
- All rights reserved.
273
-
274
- Name: /VirtualBox/GuestInfo/OS/Product, value: Linux, timestamp: 1448390422246549000, flags: <NULL>
275
- Name: /VirtualBox/GuestInfo/Net/0/V4/IP, value: 10.0.2.15, timestamp: 1448390422248366000, flags: <NULL>
276
- Name: /VirtualBox/HostInfo/GUI/LanguageID, value: en_US, timestamp: 1448390412061749000, flags: <NULL>
277
- Name: /VirtualBox/GuestInfo/Net/0/MAC, value: 080027FBB38C, timestamp: 1448390422248652000, flags: <NULL>
278
- Name: /VirtualBox/GuestInfo/OS/ServicePack, value: <NULL>, timestamp: 1448390422246976000, flags: <NULL>
279
- Name: /VirtualBox/HostInfo/VBoxVerExt, value: 5.0.10, timestamp: 1448390411701508000, flags: TRANSIENT, RDONLYGUEST
280
- Name: /VirtualBox/GuestInfo/Net/0/V4/Netmask, value: 255.255.255.0, timestamp: 1448390422248569000, flags: <NULL>
281
- Name: /VirtualBox/GuestInfo/OS/Version, value: #36~14.04.1-Ubuntu SMP Thu Oct 8 10:21:08 UTC 2015, timestamp: 1448390422246810000, flags: <NULL>
282
- Name: /VirtualBox/GuestAdd/VersionExt, value: 5.0.2, timestamp: 1448390422247220000, flags: <NULL>
283
- Name: /VirtualBox/GuestAdd/Revision, value: 102096, timestamp: 1448390422247266000, flags: <NULL>
284
- Name: /VirtualBox/HostGuest/SysprepExec, value: <NULL>, timestamp: 1448390411701168000, flags: TRANSIENT, RDONLYGUEST
285
- Name: /VirtualBox/GuestInfo/OS/LoggedInUsers, value: 1, timestamp: 1448390452251425000, flags: TRANSIENT, TRANSRESET
286
- Name: /VirtualBox/GuestInfo/Net/0/Status, value: Up, timestamp: 1448390422248755000, flags: <NULL>
287
- Name: /VirtualBox/GuestInfo/Net/0/Name, value: eth0, timestamp: 1448390422248814000, flags: <NULL>
288
- Name: /VirtualBox/HostGuest/SysprepArgs, value: <NULL>, timestamp: 1448390411701220000, flags: TRANSIENT, RDONLYGUEST
289
- Name: /VirtualBox/GuestAdd/Version, value: 5.0.2, timestamp: 1448390422247066000, flags: <NULL>
290
- Name: /VirtualBox/HostInfo/VBoxRev, value: 104061, timestamp: 1448390411701536000, flags: TRANSIENT, RDONLYGUEST
291
- Name: /VirtualBox/GuestInfo/Net/0/V4/Broadcast, value: 10.0.2.255, timestamp: 1448390422248498000, flags: <NULL>
292
- Name: /VirtualBox/HostInfo/VBoxVer, value: 5.0.10, timestamp: 1448390411701485000, flags: TRANSIENT, RDONLYGUEST
293
- Name: /VirtualBox/GuestInfo/OS/LoggedInUsersList, value: tim, timestamp: 1448390452251274000, flags: TRANSIENT, TRANSRESET
294
- Name: /VirtualBox/GuestInfo/Net/Count, value: 1, timestamp: 1448391352440445000, flags: <NULL>
295
- Name: /VirtualBox/GuestInfo/OS/Release, value: 3.19.0-31-generic, timestamp: 1448390422246638000, flags: <NULL>
296
- Name: /VirtualBox/GuestInfo/OS/NoLoggedInUsers, value: false, timestamp: 1448390452251532000, flags: TRANSIENT, TRANSRESET
297
- EOF
298
-
299
- describe Ohai::System, "plugin virtualbox" do
300
- let(:plugin) { get_plugin("virtualbox") }
301
-
302
- before do
303
- plugin[:virtualization] = Mash.new
304
- plugin[:virtualization][:systems] = Mash.new
305
- end
306
-
307
- context "when not on a virtualbox guest" do
308
- it "does not set the virtualbox attribute" do
309
- plugin[:virtualization][:systems][:vmware] = "host"
310
- plugin.run
311
- expect(plugin).not_to have_key(:virtualbox)
312
- end
313
- end
314
-
315
- context "when on a vbox guest" do
316
- context "when VBoxControl shellout fails" do
317
- it "does not set the virtualbox attribute" do
318
- plugin[:virtualization][:systems][:vbox] = "guest"
319
- allow(plugin).to receive(:shell_out).with("VBoxControl guestproperty enumerate").and_return(mock_shell_out(1, "", ""))
320
- plugin.run
321
- expect(plugin).not_to have_key(:virtualbox)
322
- end
323
- end
324
-
325
- context "when VBoxControl shellout succeeds" do
326
- before do
327
- plugin[:virtualization][:systems][:vbox] = "guest"
328
- allow(plugin).to receive(:shell_out).with("VBoxControl guestproperty enumerate").and_return(mock_shell_out(0, vbox_output, ""))
329
- plugin.run
330
- end
331
-
332
- it "sets the host version" do
333
- expect(plugin[:virtualbox][:host][:version]).to eql("5.0.10")
334
- end
335
-
336
- it "sets the host revision" do
337
- expect(plugin[:virtualbox][:host][:revision]).to eql("104061")
338
- end
339
-
340
- it "sets the host language" do
341
- expect(plugin[:virtualbox][:host][:language]).to eql("en_US")
342
- end
343
-
344
- it "sets the guest additions version" do
345
- expect(plugin[:virtualbox][:guest][:guest_additions_version]).to eql("5.0.2")
346
- end
347
-
348
- it "sets the guest additions revision" do
349
- expect(plugin[:virtualbox][:guest][:guest_additions_revision]).to eql("102096")
350
- end
351
- end
352
- end
353
-
354
- context "when on a vbox host" do
355
- context "if the host has virtualbox installed" do
356
- it "creates a vbox attribute with accurate data" do
357
- plugin[:virtualization][:systems][:vbox] = "host"
358
- allow(plugin).to receive(:which).with("VBoxManage").and_return("/usr/bin/VBoxManage")
359
- allow(plugin).to receive(:shell_out).with("VBoxManage list --sorted vms").and_return(mock_shell_out(0, vbox_list_vms_stdout, ""))
360
- allow(plugin).to receive(:shell_out).with("VBoxManage showvminfo 6294f16b-4f05-4430-afb9-773bdb237aec --machinereadable").and_return(mock_shell_out(0, vbox_vminfo_stdout, ""))
361
- allow(plugin).to receive(:shell_out).with("VBoxManage list --sorted hdds").and_return(mock_shell_out(0, vbox_list_hdds_stdout, ""))
362
- allow(plugin).to receive(:shell_out).with("VBoxManage list --sorted dvds").and_return(mock_shell_out(0, vbox_list_dvds_stdout, ""))
363
- allow(plugin).to receive(:shell_out).with("VBoxManage list --sorted hostdvds").and_return(mock_shell_out(0, vbox_list_hostdvds_stdout, ""))
364
- allow(plugin).to receive(:shell_out).with("VBoxManage list --sorted hostfloppies").and_return(mock_shell_out(0, vbox_list_hostfloppies_stdout, ""))
365
- allow(plugin).to receive(:shell_out).with("VBoxManage list --sorted hostonlyifs").and_return(mock_shell_out(0, vbox_list_hostonlyifs_stdout, ""))
366
- allow(plugin).to receive(:shell_out).with("VBoxManage list --sorted bridgedifs").and_return(mock_shell_out(0, vbox_list_bridgedifs_stdout, ""))
367
- allow(plugin).to receive(:shell_out).with("VBoxManage list --sorted dhcpservers").and_return(mock_shell_out(0, vbox_list_dhcpservers_stdout, ""))
368
- allow(plugin).to receive(:shell_out).with("VBoxManage list --sorted natnets").and_return(mock_shell_out(0, vbox_list_natnets_stdout, ""))
369
- plugin.run
370
- expect(plugin).to have_key(:virtualbox)
371
- expect(plugin[:virtualbox]).to eq(expected_output)
372
- end
373
- end
374
- end
375
- end
@@ -1,81 +0,0 @@
1
- #
2
- # Author:: "Christopher M. Luciano" <cmlucian@us.ibm.com>
3
- # Copyright (C) 2015 IBM Corp.
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
- require "spec_helper"
19
-
20
- describe Ohai::System, "plugin vmware" do
21
- let(:plugin) { get_plugin("vmware") }
22
- let(:path) { "/usr/bin/vmware-toolbox-cmd" }
23
-
24
- before do
25
- allow(plugin).to receive(:collect_os).and_return(:linux)
26
- end
27
-
28
- context "on vmware guest with toolbox installed" do
29
- before do
30
- allow(File).to receive(:exist?).with("/usr/bin/vmware-toolbox-cmd").and_return(true)
31
- allow(plugin).to receive(:shell_out).with("#{path} stat speed").and_return(mock_shell_out(0, "2000 MHz", nil))
32
- allow(plugin).to receive(:shell_out).with("#{path} stat hosttime").and_return(mock_shell_out(0, "04 Jun 2015 19:21:16", nil))
33
- allow(plugin).to receive(:shell_out).with("#{path} stat sessionid").and_return(mock_shell_out(0, "0x0000000000000000", nil))
34
- allow(plugin).to receive(:shell_out).with("#{path} stat balloon").and_return(mock_shell_out(0, "0 MB", nil))
35
- allow(plugin).to receive(:shell_out).with("#{path} stat swap").and_return(mock_shell_out(0, "0 MB", nil))
36
- allow(plugin).to receive(:shell_out).with("#{path} stat memlimit").and_return(mock_shell_out(0, "4000000000 MB", nil))
37
- allow(plugin).to receive(:shell_out).with("#{path} stat memres").and_return(mock_shell_out(0, "0 MB", nil))
38
- allow(plugin).to receive(:shell_out).with("#{path} stat cpures").and_return(mock_shell_out(0, "0 MHz", nil))
39
- allow(plugin).to receive(:shell_out).with("#{path} stat cpulimit").and_return(mock_shell_out(0, "4000000000 MB", nil))
40
- allow(plugin).to receive(:shell_out).with("#{path} upgrade status").and_return(mock_shell_out(0, "VMware Tools are up-to-date.", nil))
41
- allow(plugin).to receive(:shell_out).with("#{path} timesync status").and_return(mock_shell_out(0, "Disabled", nil))
42
- plugin[:virtualization] = Mash.new
43
- plugin[:virtualization][:systems] = Mash.new
44
- plugin[:virtualization][:systems][:vmware] = Mash.new
45
- plugin.run
46
- end
47
-
48
- it "gets the speed" do
49
- expect(plugin[:vmware][:speed]).to eq("2000 MHz")
50
- end
51
-
52
- it "gets the hosttime" do
53
- expect(plugin[:vmware][:hosttime]).to eq("04 Jun 2015 19:21:16")
54
- end
55
-
56
- it "gets tools update status" do
57
- expect(plugin[:vmware][:upgrade]).to eq("VMware Tools are up-to-date.")
58
- end
59
- end
60
-
61
- context "on vmware guest without toolbox" do
62
- it "does not create a vmware attribute" do
63
- plugin[:virtualization] = Mash.new
64
- plugin[:virtualization][:systems] = Mash.new
65
- plugin[:virtualization][:systems][:vmware] = Mash.new
66
- allow(File).to receive(:exist?).with("/usr/bin/vmware-toolbox-cmd").and_return(false)
67
- plugin.run
68
- expect(plugin).not_to have_key(:vmware)
69
- end
70
- end
71
-
72
- context "on vbox guest" do
73
- it "does not create a vmware attribute" do
74
- plugin[:virtualization] = Mash.new
75
- plugin[:virtualization][:systems] = Mash.new
76
- plugin[:virtualization][:systems][:vbox] = Mash.new
77
- plugin.run
78
- expect(plugin).not_to have_key(:vmware)
79
- end
80
- end
81
- end