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,44 +0,0 @@
1
- #
2
- # Author:: Adam Jacob (<adam@chef.io>)
3
- # Author:: Tollef Fog Heen <tfheen@err.no>
4
- # Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
5
- # Copyright:: Copyright (c) 2010 Tollef Fog Heen <tfheen@err.no>
6
- # License:: Apache License, Version 2.0
7
- #
8
- # Licensed under the Apache License, Version 2.0 (the "License");
9
- # you may not use this file except in compliance with the License.
10
- # You may obtain a copy of the License at
11
- #
12
- # http://www.apache.org/licenses/LICENSE-2.0
13
- #
14
- # Unless required by applicable law or agreed to in writing, software
15
- # distributed under the License is distributed on an "AS IS" BASIS,
16
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
- # See the License for the specific language governing permissions and
18
- # limitations under the License.
19
- #
20
-
21
- begin
22
- require "spec_helper"
23
- require "chef/version"
24
-
25
- describe Ohai::System, "plugin chef" do
26
- before do
27
- @plugin = get_plugin("chef")
28
- end
29
-
30
- it "sets [:chef_packages][:chef][:version] to the current chef version", if: defined?(Chef) do
31
- @plugin.run
32
- expect(@plugin[:chef_packages][:chef][:version]).to eq(Chef::VERSION)
33
- end
34
-
35
- pending "would set [:chef_packages][:chef][:version] if chef was available", unless: defined?(Chef)
36
- end
37
-
38
- rescue LoadError
39
- # the chef module is not available, ignoring.
40
-
41
- describe Ohai::System, "plugin chef" do
42
- pending "would set [:chef_packages][:chef][:version] if chef was available", unless: defined?(Chef)
43
- end
44
- end
@@ -1,484 +0,0 @@
1
- #
2
- # Author:: Cary Penniman (<cary@rightscale.com>)
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
- require "ipaddr"
20
-
21
- describe "CloudAttrs object" do
22
- before do
23
- @plugin = get_plugin("cloud")
24
- end
25
-
26
- let(:cloud_node) do
27
- { "public_ipv4_addrs" => ["1.2.3.1"],
28
- "local_ipv4_addrs" => ["1.2.4.1"],
29
- "public_ipv6_addrs" => ["3ffe:505:2::1"],
30
- "local_ipv6_addrs" => ["3ffe:506:2::1"],
31
- "public_ipv4" => "1.2.3.1",
32
- "local_ipv4" => "1.2.4.1",
33
- "public_ipv6" => "3ffe:505:2::1",
34
- "local_ipv6" => "3ffe:506:2::1",
35
- "public_hostname" => "myhost.somewhere.com",
36
- "local_hostname" => "my-localhost",
37
- "provider" => "my_awesome_cloud",
38
- }
39
- end
40
-
41
- it "populates cloud mash" do
42
- @cloud_attr_obj = ::CloudAttrs.new
43
- @cloud_attr_obj.add_ipv4_addr("1.2.3.1", :public)
44
- @cloud_attr_obj.add_ipv4_addr("1.2.4.1", :private)
45
- @cloud_attr_obj.add_ipv6_addr("3ffe:505:2::1", :public)
46
- @cloud_attr_obj.add_ipv6_addr("3ffe:506:2::1", :private)
47
- @cloud_attr_obj.public_hostname = "myhost.somewhere.com"
48
- @cloud_attr_obj.local_hostname = "my-localhost"
49
- @cloud_attr_obj.provider = "my_awesome_cloud"
50
- expect(@cloud_attr_obj.cloud_mash).to eq(cloud_node)
51
- end
52
-
53
- it "throws exception with a bad ipv4 address" do
54
- @cloud_attr_obj = ::CloudAttrs.new
55
- expect { @cloud_attr_obj.add_ipv6_addr("somebogusstring", :public) }.to raise_error(RuntimeError)
56
- end
57
-
58
- it "throws exception with a bad ipv6 address" do
59
- @cloud_attr_obj = ::CloudAttrs.new
60
- expect { @cloud_attr_obj.add_ipv6_addr("FEED:B0B:DEAD:BEEF", :public) }.to raise_error(RuntimeError)
61
- end
62
-
63
- it "throws exception with ipv6 address passed to ipv4" do
64
- @cloud_attr_obj = ::CloudAttrs.new
65
- expect { @cloud_attr_obj.add_ipv4_addr("3ffe:506:2::1", :public) }.to raise_error(RuntimeError)
66
- end
67
-
68
- it "throws exception with ipv4 address passed to ipv6" do
69
- @cloud_attr_obj = ::CloudAttrs.new
70
- expect { @cloud_attr_obj.add_ipv6_addr("1.2.3.4", :public) }.to raise_error(RuntimeError)
71
- end
72
-
73
- end
74
-
75
- describe Ohai::System, "plugin cloud" do
76
- before do
77
- @plugin = get_plugin("cloud")
78
- end
79
-
80
- describe "with no cloud mashes" do
81
- it "doesn't populate the cloud data" do
82
- @plugin[:ec2] = nil
83
- @plugin[:rackspace] = nil
84
- @plugin[:eucalyptus] = nil
85
- @plugin[:linode] = nil
86
- @plugin[:azure] = nil
87
- @plugin[:gce] = nil
88
- @plugin[:digital_ocean] = nil
89
- @plugin[:softlayer] = nil
90
- @plugin.run
91
- expect(@plugin[:cloud]).to be_nil
92
- end
93
- end
94
-
95
- describe "with EC2 mash" do
96
- before do
97
- @plugin[:ec2] = Mash.new
98
- end
99
-
100
- it "populates cloud public ip" do
101
- @plugin[:ec2]["public_ipv4"] = "174.129.150.8"
102
- @plugin.run
103
- expect(@plugin[:cloud][:public_ipv4_addrs][0]).to eq(@plugin[:ec2]["public_ipv4"])
104
- end
105
-
106
- it "populates cloud private ip" do
107
- @plugin[:ec2]["local_ipv4"] = "10.252.42.149"
108
- @plugin.run
109
- expect(@plugin[:cloud][:local_ipv4_addrs][0]).to eq(@plugin[:ec2]["local_ipv4"])
110
- end
111
-
112
- it "populates cloud provider" do
113
- @plugin.run
114
- expect(@plugin[:cloud][:provider]).to eq("ec2")
115
- end
116
- end
117
-
118
- describe "with GCE mash" do
119
- describe "with a public IP" do
120
- before do
121
- @plugin[:gce] = Mash.new
122
- @plugin[:gce]["instance"] = Mash.new
123
- @plugin[:gce]["instance"]["networkInterfaces"] = [
124
- {
125
- "accessConfigs" => [ { "externalIp" => "8.35.198.173", "type" => "ONE_TO_ONE_NAT" } ],
126
- "ip" => "10.240.0.102",
127
- "network" => "projects/foo/networks/default",
128
- },
129
- ]
130
- end
131
-
132
- it "populates cloud public ip" do
133
- @plugin.run
134
- expect(@plugin[:cloud][:public_ipv4_addrs][0]).to eq("8.35.198.173")
135
- end
136
-
137
- it "populates cloud private ip" do
138
- @plugin.run
139
- expect(@plugin[:cloud][:local_ipv4_addrs][0]).to eq("10.240.0.102")
140
- end
141
-
142
- it "populates cloud provider" do
143
- @plugin.run
144
- expect(@plugin[:cloud][:provider]).to eq("gce")
145
- end
146
- end
147
-
148
- describe "with no public IP" do
149
- before do
150
- @plugin[:gce] = Mash.new
151
- @plugin[:gce]["instance"] = Mash.new
152
- @plugin[:gce]["instance"]["networkInterfaces"] = [
153
- {
154
- "accessConfigs" => [ { "externalIp" => "", "type" => "ONE_TO_ONE_NAT" } ],
155
- "ip" => "10.240.0.102",
156
- "network" => "projects/foo/networks/default",
157
- },
158
- ]
159
- end
160
-
161
- it "does not populate cloud public ip" do
162
- @plugin.run
163
- expect(@plugin[:cloud][:public_ipv4_addrs]).to be_nil
164
- end
165
-
166
- it "populates cloud private ip" do
167
- @plugin.run
168
- expect(@plugin[:cloud][:local_ipv4_addrs][0]).to eq("10.240.0.102")
169
- end
170
-
171
- it "populates cloud provider" do
172
- @plugin.run
173
- expect(@plugin[:cloud][:provider]).to eq("gce")
174
- end
175
- end
176
- end
177
-
178
- describe "with rackspace" do
179
- before do
180
- @plugin[:rackspace] = Mash.new
181
- end
182
-
183
- it "populates cloud public ip" do
184
- @plugin[:rackspace][:public_ipv4] = "174.129.150.8"
185
- @plugin.run
186
- expect(@plugin[:cloud][:public_ipv4]).to eq(@plugin[:rackspace][:public_ipv4])
187
- end
188
-
189
- it "populates cloud public ipv6" do
190
- @plugin[:rackspace][:public_ipv6] = "2a00:1a48:7805:111:e875:efaf:ff08:75"
191
- @plugin.run
192
- expect(@plugin[:cloud][:public_ipv6]).to eq(@plugin[:rackspace][:public_ipv6])
193
- end
194
-
195
- it "populates cloud private ip" do
196
- @plugin[:rackspace][:local_ipv4] = "10.252.42.149"
197
- @plugin.run
198
- expect(@plugin[:cloud][:local_ipv4]).to eq(@plugin[:rackspace][:local_ipv4])
199
- end
200
-
201
- it "populates cloud private ipv6" do
202
- @plugin[:rackspace][:local_ipv6] = "2a00:1a48:7805:111:e875:efaf:ff08:75"
203
- @plugin.run
204
- expect(@plugin[:cloud][:local_ipv6]).to eq(@plugin[:rackspace][:local_ipv6])
205
- end
206
-
207
- it "populates first cloud public ip" do
208
- @plugin[:rackspace][:public_ipv4] = "174.129.150.8"
209
- @plugin.run
210
- expect(@plugin[:cloud][:public_ipv4_addrs].first).to eq(@plugin[:rackspace][:public_ipv4])
211
- end
212
-
213
- it "populates first cloud public ip" do
214
- @plugin[:rackspace][:local_ipv4] = "174.129.150.8"
215
- @plugin.run
216
- expect(@plugin[:cloud][:local_ipv4_addrs].first).to eq(@plugin[:rackspace][:local_ipv4])
217
- end
218
-
219
- it "populates cloud provider" do
220
- @plugin.run
221
- expect(@plugin[:cloud][:provider]).to eq("rackspace")
222
- end
223
- end
224
-
225
- describe "with linode mash" do
226
- before do
227
- @plugin[:linode] = Mash.new
228
- end
229
-
230
- it "populates cloud public ip" do
231
- @plugin[:linode]["public_ip"] = "174.129.150.8"
232
- @plugin.run
233
- expect(@plugin[:cloud][:public_ipv4_addrs][0]).to eq(@plugin[:linode][:public_ip])
234
- end
235
-
236
- it "populates cloud private ip" do
237
- @plugin[:linode]["private_ip"] = "10.252.42.149"
238
- @plugin.run
239
- expect(@plugin[:cloud][:local_ipv4_addrs][0]).to eq(@plugin[:linode][:private_ip])
240
- end
241
-
242
- it "populates first cloud public ip" do
243
- @plugin[:linode]["public_ip"] = "174.129.150.8"
244
- @plugin.run
245
- expect(@plugin[:cloud][:public_ipv4_addrs].first).to eq(@plugin[:linode][:public_ip])
246
- end
247
-
248
- it "populates cloud provider" do
249
- @plugin.run
250
- expect(@plugin[:cloud][:provider]).to eq("linode")
251
- end
252
- end
253
-
254
- describe "with eucalyptus mash" do
255
- before do
256
- @plugin[:eucalyptus] = Mash.new
257
- end
258
-
259
- it "populates cloud public ip" do
260
- @plugin[:eucalyptus]["public_ipv4"] = "174.129.150.8"
261
- @plugin.run
262
- expect(@plugin[:cloud][:public_ipv4_addrs][0]).to eq(@plugin[:eucalyptus]["public_ipv4"])
263
- end
264
-
265
- it "populates cloud private ip" do
266
- @plugin[:eucalyptus]["local_ipv4"] = "10.252.42.149"
267
- @plugin.run
268
- expect(@plugin[:cloud][:local_ipv4_addrs][0]).to eq(@plugin[:eucalyptus]["local_ipv4"])
269
- end
270
-
271
- it "populates cloud provider" do
272
- @plugin.run
273
- expect(@plugin[:cloud][:provider]).to eq("eucalyptus")
274
- end
275
- end
276
-
277
- describe "with Azure mash" do
278
- before do
279
- @plugin[:azure] = Mash.new
280
- @plugin[:azure][:metadata] = {
281
- "compute" =>
282
- {
283
- "location" => "westus",
284
- "name" => "timtest",
285
- "offer" => "UbuntuServer",
286
- "osType" => "Linux",
287
- "platformFaultDomain" => "0",
288
- "platformUpdateDomain" => "0",
289
- "publisher" => "Canonical",
290
- "sku" => "16.04-LTS",
291
- "version" => "16.04.201707270",
292
- "vmId" => "f78151b3-da8b-4bd8-a592-d9ce8357e365",
293
- "vmSize" => "Standard_DS2_v2",
294
- },
295
- "network" =>
296
- {
297
- "interfaces" =>
298
- {
299
- "000D3A37F080" =>
300
- {
301
- "mac" => "000D3A37F080",
302
- "public_ipv6" => [],
303
- "public_ipv4" => ["40.118.212.225"],
304
- "local_ipv6" => [],
305
- "local_ipv4" => ["10.0.1.6"],
306
- },
307
- },
308
- "public_ipv4" => ["40.118.212.225"],
309
- "local_ipv4" => ["10.0.1.6"],
310
- "public_ipv6" => [],
311
- "local_ipv6" => [],
312
- },
313
- }
314
- end
315
-
316
- it "populates cloud public ip" do
317
- @plugin.run
318
- expect(@plugin[:cloud][:public_ipv4_addrs][0]).to eq("40.118.212.225")
319
- end
320
-
321
- it "doesn't populates cloud vm_name" do
322
- @plugin.run
323
- expect(@plugin[:cloud][:vm_name]).not_to eq("timtest")
324
- end
325
-
326
- it "populates cloud public_hostname" do
327
- @plugin[:azure]["public_fqdn"] = "linux-vm-svc.cloudapp.net"
328
- @plugin.run
329
- expect(@plugin[:cloud][:public_hostname]).to eq("linux-vm-svc.cloudapp.net")
330
- end
331
-
332
- it "doesn't populate cloud public_ssh_port" do
333
- @plugin[:azure]["public_ssh_port"] = "22"
334
- @plugin.run
335
- expect(@plugin[:cloud][:public_ssh_port]).to be_nil
336
- end
337
-
338
- it "does not populate cloud public_ssh_port when winrm is used" do
339
- @plugin[:azure]["public_winrm_port"] = "5985"
340
- @plugin.run
341
- expect(@plugin[:cloud][:public_ssh_port]).to be_nil
342
- end
343
-
344
- it "populates cloud public_winrm_port" do
345
- @plugin[:azure]["public_winrm_port"] = "5985"
346
- @plugin.run
347
- expect(@plugin[:cloud][:public_winrm_port]).to be_nil
348
- end
349
-
350
- it "populates cloud provider" do
351
- @plugin.run
352
- expect(@plugin[:cloud][:provider]).to eq("azure")
353
- end
354
- end
355
-
356
- describe "with digital_ocean mash" do
357
- before do
358
- @plugin[:digital_ocean] = Mash.new
359
- @plugin[:digital_ocean][:interfaces] = Mash.new
360
- @plugin[:digital_ocean][:interfaces] = {
361
- "private" =>
362
- [
363
- {
364
- "ipv4" =>
365
- {
366
- "ip_address" => "10.135.32.4",
367
- "netmask" => "255.255.0.0",
368
- "gateway" => "10.135.0.1",
369
- },
370
- "mac" => "36:9e:23:65:c1:fe",
371
- "type" => "private",
372
- },
373
- ],
374
- "public" =>
375
- [
376
- {
377
- "ipv4" =>
378
- {
379
- "ip_address" => "207.154.221.42",
380
- "netmask" => "255.255.240.0",
381
- "gateway" => "207.154.208.1",
382
- },
383
- "ipv6" =>
384
- {
385
- "ip_address" => "2A03:B0C0:0003:00D0:0000:0000:3B15:B001",
386
- "cidr" => 64,
387
- "gateway" => "2A03:B0C0:0003:00D0:0000:0000:0000:0001",
388
- },
389
- "anchor_ipv4" =>
390
- {
391
- "ip_address" => "10.19.0.5",
392
- "netmask" => "255.255.0.0",
393
- "gateway" => "10.19.0.1",
394
- },
395
- "mac" => "9a:80:15:02:7a:c1",
396
- "type" => "public",
397
- },
398
- ],
399
- }
400
- end
401
-
402
- before do
403
- @plugin.run
404
- end
405
-
406
- it "populates cloud local hostname" do
407
- expect(@plugin[:cloud][:local_hostname]).to be_nil
408
- end
409
-
410
- it "populates cloud public_ipv4_addrs" do
411
- expect(@plugin[:cloud][:public_ipv4_addrs]).to eq(["207.154.221.42"])
412
-
413
- end
414
-
415
- it "populates cloud local_ipv4_addrs" do
416
- expect(@plugin[:cloud][:local_ipv4_addrs]).to eq(["10.135.32.4"])
417
-
418
- end
419
-
420
- it "populates cloud public_ipv4" do
421
- expect(@plugin[:cloud][:public_ipv4]).to eq("207.154.221.42")
422
- end
423
-
424
- it "populates cloud local_ipv4" do
425
- expect(@plugin[:cloud][:local_ipv4]).to eq("10.135.32.4")
426
- end
427
-
428
- it "populates cloud public_ipv6_addrs" do
429
- expect(@plugin[:cloud][:public_ipv6_addrs]).to eq(["2a03:b0c0:3:d0::3b15:b001"])
430
- end
431
-
432
- it "populates cloud local_ipv6_addrs" do
433
- expect(@plugin[:cloud][:local_ipv6_addrs]).to be_nil
434
- end
435
-
436
- it "populates cloud public_ipv6" do
437
- expect(@plugin[:cloud][:public_ipv6]).to eq("2a03:b0c0:3:d0::3b15:b001")
438
- end
439
-
440
- it "populates cloud local_ipv6" do
441
- expect(@plugin[:cloud][:local_ipv6]).to be_nil
442
- end
443
-
444
- it "populates cloud provider" do
445
- expect(@plugin[:cloud][:provider]).to eq("digital_ocean")
446
- end
447
- end
448
-
449
- describe "with softlayer mash" do
450
- before do
451
- @plugin[:softlayer] = Mash.new
452
- @plugin[:softlayer] = { "local_ipv4" => "192.168.0.1",
453
- "public_ipv4" => "8.8.8.8",
454
- "public_fqdn" => "abc1234.public.com",
455
- }
456
- end
457
-
458
- it "populates cloud public ip" do
459
- @plugin.run
460
- expect(@plugin[:cloud][:public_ipv4_addrs][0]).to eq(@plugin[:softlayer][:public_ipv4])
461
- end
462
-
463
- it "populates cloud private ip" do
464
- @plugin.run
465
- expect(@plugin[:cloud][:local_ipv4_addrs][0]).to eq(@plugin[:softlayer][:local_ipv4])
466
- end
467
-
468
- it "populates first cloud public ip" do
469
- @plugin.run
470
- expect(@plugin[:cloud][:public_ipv4_addrs].first).to eq(@plugin[:softlayer][:public_ipv4])
471
- end
472
-
473
- it "populates cloud public_hostname" do
474
- @plugin.run
475
- expect(@plugin[:cloud][:public_hostname]).to eq(@plugin[:softlayer][:public_fqdn])
476
- end
477
-
478
- it "populates cloud provider" do
479
- @plugin.run
480
- expect(@plugin[:cloud][:provider]).to eq("softlayer")
481
- end
482
- end
483
-
484
- end