ohai 8.0.1 → 8.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/lib/ohai/loader.rb +1 -1
- data/lib/ohai/mixin/gce_metadata.rb +2 -1
- data/lib/ohai/plugins/cloud.rb +56 -6
- data/lib/ohai/plugins/cloud_v2.rb +29 -1
- data/lib/ohai/plugins/cloudstack.rb +7 -0
- data/lib/ohai/plugins/digital_ocean.rb +81 -0
- data/lib/ohai/plugins/elixir.rb +32 -0
- data/lib/ohai/plugins/linode.rb +1 -0
- data/lib/ohai/plugins/linux/block_device.rb +5 -0
- data/lib/ohai/plugins/linux/cpu.rb +21 -1
- data/lib/ohai/plugins/linux/filesystem.rb +1 -1
- data/lib/ohai/plugins/linux/network.rb +6 -2
- data/lib/ohai/plugins/linux/platform.rb +2 -0
- data/lib/ohai/plugins/linux/virtualization.rb +14 -3
- data/lib/ohai/plugins/php.rb +13 -6
- data/lib/ohai/plugins/ruby.rb +10 -10
- data/lib/ohai/plugins/rust.rb +32 -0
- data/lib/ohai/plugins/ssh_host_key.rb +6 -0
- data/lib/ohai/util/ip_helper.rb +52 -0
- data/lib/ohai/version.rb +1 -1
- data/spec/data/plugins/php.output +16 -0
- data/spec/unit/plugins/cloud_spec.rb +63 -9
- data/spec/unit/plugins/cloud_v2_spec.rb +123 -25
- data/spec/unit/plugins/cloudstack_spec.rb +1 -1
- data/spec/unit/plugins/digital_ocean_spec.rb +211 -0
- data/spec/unit/plugins/elixir_spec.rb +46 -0
- data/spec/unit/plugins/linux/cpu_spec.rb +112 -35
- data/spec/unit/plugins/linux/filesystem_spec.rb +7 -7
- data/spec/unit/plugins/linux/network_spec.rb +63 -4
- data/spec/unit/plugins/linux/platform_spec.rb +13 -0
- data/spec/unit/plugins/linux/virtualization_spec.rb +146 -21
- data/spec/unit/plugins/php_spec.rb +37 -3
- data/spec/unit/plugins/rust_spec.rb +43 -0
- data/spec/unit/plugins/ssh_host_keys_spec.rb +11 -0
- data/spec/unit/util/ip_helper_spec.rb +128 -0
- metadata +49 -41
data/lib/ohai/plugins/php.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Doug MacEachern <dougm@vmware.com>
|
3
|
+
# Author:: Tim Smith <tim@cozy.co>
|
3
4
|
# Copyright:: Copyright (c) 2009 VMware, Inc.
|
5
|
+
# Copyright:: Copyright (c) 2014 Cozy Services, Ltd.
|
4
6
|
# License:: Apache License, Version 2.0
|
5
7
|
#
|
6
8
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -22,17 +24,22 @@ Ohai.plugin(:PHP) do
|
|
22
24
|
depends "languages"
|
23
25
|
|
24
26
|
collect_data do
|
25
|
-
output = nil
|
26
|
-
|
27
27
|
php = Mash.new
|
28
28
|
|
29
29
|
so = shell_out("php -v")
|
30
30
|
if so.exitstatus == 0
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
so.stdout.each_line do |line|
|
32
|
+
case line
|
33
|
+
when /PHP (\S+).+built: ([^)]+)/
|
34
|
+
php[:version] = $1
|
35
|
+
php[:builddate] = $2
|
36
|
+
when /Zend Engine v([^\s]+),/
|
37
|
+
php[:zend_engine_version] = $1
|
38
|
+
when /Zend OPcache v([^\s]+),/
|
39
|
+
php[:zend_opcache_version] = $1
|
40
|
+
end
|
35
41
|
end
|
42
|
+
|
36
43
|
languages[:php] = php if php[:version]
|
37
44
|
end
|
38
45
|
end
|
data/lib/ohai/plugins/ruby.rb
CHANGED
@@ -34,16 +34,16 @@ Ohai.plugin(:Ruby) do
|
|
34
34
|
:platform => "RUBY_PLATFORM",
|
35
35
|
:version => "RUBY_VERSION",
|
36
36
|
:release_date => "RUBY_RELEASE_DATE",
|
37
|
-
:target => "::
|
38
|
-
:target_cpu => "::
|
39
|
-
:target_vendor => "::
|
40
|
-
:target_os => "::
|
41
|
-
:host => "::
|
42
|
-
:host_cpu => "::
|
43
|
-
:host_os => "::
|
44
|
-
:host_vendor => "::
|
45
|
-
:bin_dir => "::
|
46
|
-
:ruby_bin => "::File.join(::
|
37
|
+
:target => "RbConfig::CONFIG['target']",
|
38
|
+
:target_cpu => "RbConfig::CONFIG['target_cpu']",
|
39
|
+
:target_vendor => "RbConfig::CONFIG['target_vendor']",
|
40
|
+
:target_os => "RbConfig::CONFIG['target_os']",
|
41
|
+
:host => "RbConfig::CONFIG['host']",
|
42
|
+
:host_cpu => "RbConfig::CONFIG['host_cpu']",
|
43
|
+
:host_os => "RbConfig::CONFIG['host_os']",
|
44
|
+
:host_vendor => "RbConfig::CONFIG['host_vendor']",
|
45
|
+
:bin_dir => "RbConfig::CONFIG['bindir']",
|
46
|
+
:ruby_bin => "::File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])"
|
47
47
|
}
|
48
48
|
|
49
49
|
# Create a query string from above hash
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# Author:: Christopher M Luciano (<cmlucian@us.ibm.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.
|
15
|
+
|
16
|
+
Ohai.plugin(:Rust) do
|
17
|
+
provides "languages/rust"
|
18
|
+
|
19
|
+
depends "languages"
|
20
|
+
|
21
|
+
collect_data do
|
22
|
+
output = nil
|
23
|
+
|
24
|
+
rust = Mash.new
|
25
|
+
so = shell_out("rustc --version")
|
26
|
+
if so.exitstatus == 0
|
27
|
+
output = so.stdout.split
|
28
|
+
rust[:version] = output[1]
|
29
|
+
languages[:rust] = rust if rust[:version]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -28,6 +28,8 @@ Ohai.plugin(:SSHHostKey) do
|
|
28
28
|
[ "rsa", nil ]
|
29
29
|
when /^ecdsa/
|
30
30
|
[ "ecdsa", content[0] ]
|
31
|
+
when 'ssh-ed25519'
|
32
|
+
[ 'ed25519', nil ]
|
31
33
|
else
|
32
34
|
[ nil, nil ]
|
33
35
|
end
|
@@ -73,5 +75,9 @@ Ohai.plugin(:SSHHostKey) do
|
|
73
75
|
keys[:ssh][:host_ecdsa_public] = content.split[1]
|
74
76
|
keys[:ssh][:host_ecdsa_type] = content.split[0]
|
75
77
|
end
|
78
|
+
|
79
|
+
if keys[:ssh][:host_ed25519_public].nil? && File.exists?("/etc/ssh/ssh_host_ed25519_key.pub")
|
80
|
+
keys[:ssh][:host_ed25519_public] = IO.read("/etc/ssh/ssh_host_ed25519_key.pub").split[1]
|
81
|
+
end
|
76
82
|
end
|
77
83
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Stafford Brunk (<stafford.brunk@gmail.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
|
+
module Ohai
|
18
|
+
module Util
|
19
|
+
module IpHelper
|
20
|
+
# Corresponding to RFC 4193
|
21
|
+
IPV6_PRIVATE_ADDRESS_BLOCK = IPAddress('fc00::/7')
|
22
|
+
|
23
|
+
def private_address?(addr)
|
24
|
+
ip = IPAddress(addr)
|
25
|
+
|
26
|
+
if ip.respond_to? :private?
|
27
|
+
ip.private?
|
28
|
+
else
|
29
|
+
IPV6_PRIVATE_ADDRESS_BLOCK.include?(ip)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
alias :unique_local_address? :private_address?
|
33
|
+
|
34
|
+
def public_address?(addr)
|
35
|
+
!private_address?(addr)
|
36
|
+
end
|
37
|
+
|
38
|
+
# The ipaddress gem doesn't implement loopback?
|
39
|
+
# for IPv4 addresses
|
40
|
+
# https://github.com/bluemonk/ipaddress/issues/25
|
41
|
+
def loopback?(addr)
|
42
|
+
ip = IPAddress(addr)
|
43
|
+
|
44
|
+
if ip.respond_to? :loopback?
|
45
|
+
ip.loopback?
|
46
|
+
else
|
47
|
+
IPAddress('127.0.0.0/8').include? ip
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/lib/ohai/version.rb
CHANGED
@@ -141,3 +141,19 @@ params "-v"
|
|
141
141
|
stdout "PHP 5.4.9-4ubuntu2.2 (cli) (built: Jul 15 2013 18:23:35) \nCopyright (c) 1997-2012 The PHP Group\nZend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies\n"
|
142
142
|
stderr ""
|
143
143
|
exit_status 0
|
144
|
+
|
145
|
+
platform "ubuntu-14.04"
|
146
|
+
arch "x64"
|
147
|
+
env []
|
148
|
+
params "-v"
|
149
|
+
stdout ""
|
150
|
+
stderr "bash: line 2: php: command not found\n"
|
151
|
+
exit_status 127
|
152
|
+
|
153
|
+
platform "ubuntu-14.04"
|
154
|
+
arch "x64"
|
155
|
+
env ["php"]
|
156
|
+
params "-v"
|
157
|
+
stdout "PHP 5.5.9-1ubuntu4.5 (cli) (built: Oct 29 2014 11:59:10) \nCopyright (c) 1997-2014 The PHP Group\nZend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies\n with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies"
|
158
|
+
stderr ""
|
159
|
+
exit_status 0
|
@@ -30,6 +30,7 @@ describe Ohai::System, "plugin cloud" do
|
|
30
30
|
@plugin[:linode] = nil
|
31
31
|
@plugin[:azure] = nil
|
32
32
|
@plugin[:cloudstack] = nil
|
33
|
+
@plugin[:digital_ocean] = nil
|
33
34
|
@plugin.run
|
34
35
|
expect(@plugin[:cloud]).to be_nil
|
35
36
|
end
|
@@ -61,38 +62,38 @@ describe Ohai::System, "plugin cloud" do
|
|
61
62
|
describe "with rackspace" do
|
62
63
|
before do
|
63
64
|
@plugin[:rackspace] = Mash.new()
|
64
|
-
end
|
65
|
-
|
65
|
+
end
|
66
|
+
|
66
67
|
it "populates cloud public ip" do
|
67
68
|
@plugin[:rackspace][:public_ipv4] = "174.129.150.8"
|
68
69
|
@plugin.run
|
69
70
|
expect(@plugin[:cloud][:public_ipv4]).to eq(@plugin[:rackspace][:public_ipv4])
|
70
71
|
end
|
71
|
-
|
72
|
+
|
72
73
|
it "populates cloud public ipv6" do
|
73
74
|
@plugin[:rackspace][:public_ipv6] = "2a00:1a48:7805:111:e875:efaf:ff08:75"
|
74
75
|
@plugin.run
|
75
76
|
expect(@plugin[:cloud][:public_ipv6]).to eq(@plugin[:rackspace][:public_ipv6])
|
76
77
|
end
|
77
|
-
|
78
|
+
|
78
79
|
it "populates cloud private ip" do
|
79
80
|
@plugin[:rackspace][:local_ipv4] = "10.252.42.149"
|
80
81
|
@plugin.run
|
81
82
|
expect(@plugin[:cloud][:local_ipv4]).to eq(@plugin[:rackspace][:local_ipv4])
|
82
83
|
end
|
83
|
-
|
84
|
+
|
84
85
|
it "populates cloud private ipv6" do
|
85
86
|
@plugin[:rackspace][:local_ipv6] = "2a00:1a48:7805:111:e875:efaf:ff08:75"
|
86
87
|
@plugin.run
|
87
88
|
expect(@plugin[:cloud][:local_ipv6]).to eq(@plugin[:rackspace][:local_ipv6])
|
88
89
|
end
|
89
|
-
|
90
|
+
|
90
91
|
it "populates first cloud public ip" do
|
91
92
|
@plugin[:rackspace][:public_ipv4] = "174.129.150.8"
|
92
93
|
@plugin.run
|
93
94
|
expect(@plugin[:cloud][:public_ips].first).to eq(@plugin[:rackspace][:public_ipv4])
|
94
95
|
end
|
95
|
-
|
96
|
+
|
96
97
|
it "populates first cloud public ip" do
|
97
98
|
@plugin[:rackspace][:local_ipv4] = "174.129.150.8"
|
98
99
|
@plugin.run
|
@@ -212,9 +213,9 @@ describe Ohai::System, "plugin cloud" do
|
|
212
213
|
end
|
213
214
|
|
214
215
|
it "populates cloud public ip" do
|
215
|
-
@plugin[:cloudstack]['
|
216
|
+
@plugin[:cloudstack]['local_ipv4'] = "174.129.150.8"
|
216
217
|
@plugin.run
|
217
|
-
expect(@plugin[:cloud][:public_ips][0]).to eq(@plugin[:cloudstack]['
|
218
|
+
expect(@plugin[:cloud][:public_ips][0]).to eq(@plugin[:cloudstack]['local_ipv4'])
|
218
219
|
end
|
219
220
|
|
220
221
|
it "populates cloud private ip" do
|
@@ -235,5 +236,58 @@ describe Ohai::System, "plugin cloud" do
|
|
235
236
|
end
|
236
237
|
end
|
237
238
|
|
239
|
+
describe "with digital_ocean mash" do
|
240
|
+
before do
|
241
|
+
@plugin[:digital_ocean] = Mash.new
|
242
|
+
@plugin[:digital_ocean][:name] = "public.example.com"
|
243
|
+
@plugin[:digital_ocean][:networks] = Mash.new
|
244
|
+
@plugin[:digital_ocean][:networks][:v4] = [{"ip_address" => "1.2.3.4", "type" => "public"},
|
245
|
+
{"ip_address" => "5.6.7.8", "type" => "private"}]
|
246
|
+
@plugin[:digital_ocean][:networks][:v6] = [{"ip_address" => "fe80::4240:95ff:fe47:6eee", "type" => "public"},
|
247
|
+
{"ip_address" => "fdf8:f53b:82e4::53", "type" => "private"}]
|
248
|
+
end
|
249
|
+
|
250
|
+
before(:each) do
|
251
|
+
@plugin.run
|
252
|
+
end
|
253
|
+
|
254
|
+
it "populates cloud public hostname" do
|
255
|
+
expect(@plugin[:cloud][:public_hostname]).to eq("public.example.com")
|
256
|
+
end
|
257
|
+
|
258
|
+
it "populates cloud local hostname" do
|
259
|
+
expect(@plugin[:cloud][:local_hostname]).to be_nil
|
260
|
+
end
|
261
|
+
|
262
|
+
it "populates cloud public ips" do
|
263
|
+
expect(@plugin[:cloud][:public_ips]).to eq(@plugin[:digital_ocean][:networks][:v4].select{|ip| ip['type'] == 'public'} +
|
264
|
+
@plugin[:digital_ocean][:networks][:v6].select{|ip| ip['type'] == 'public'})
|
265
|
+
end
|
266
|
+
|
267
|
+
it "populates cloud private ips" do
|
268
|
+
expect(@plugin[:cloud][:private_ips]).to eq(@plugin[:digital_ocean][:networks][:v4].select{|ip| ip['type'] == 'private'} +
|
269
|
+
@plugin[:digital_ocean][:networks][:v6].select{|ip| ip['type'] == 'private'})
|
270
|
+
end
|
271
|
+
|
272
|
+
it "populates cloud public_ipv4" do
|
273
|
+
expect(@plugin[:cloud][:public_ipv4]).to eq(@plugin[:digital_ocean][:networks][:v4].find{|ip| ip['type'] == 'public'})
|
274
|
+
end
|
275
|
+
|
276
|
+
it "populates cloud local_ipv4" do
|
277
|
+
expect(@plugin[:cloud][:local_ipv4]).to eq(@plugin[:digital_ocean][:networks][:v4].find{|ip| ip['type'] == 'private'})
|
278
|
+
end
|
279
|
+
|
280
|
+
it "populates cloud public_ipv6" do
|
281
|
+
expect(@plugin[:cloud][:public_ipv6]).to eq(@plugin[:digital_ocean][:networks][:v6].find{|ip| ip['type'] == 'public'})
|
282
|
+
end
|
283
|
+
|
284
|
+
it "populates cloud local_ipv6" do
|
285
|
+
expect(@plugin[:cloud][:local_ipv6]).to eq(@plugin[:digital_ocean][:networks][:v6].find{|ip| ip['type'] == 'private'})
|
286
|
+
end
|
287
|
+
|
288
|
+
it "populates cloud provider" do
|
289
|
+
expect(@plugin[:cloud][:provider]).to eq("digital_ocean")
|
290
|
+
end
|
291
|
+
end
|
238
292
|
|
239
293
|
end
|
@@ -86,6 +86,7 @@ describe Ohai::System, "plugin cloud" do
|
|
86
86
|
@plugin[:linode] = nil
|
87
87
|
@plugin[:azure] = nil
|
88
88
|
@plugin[:gce] = nil
|
89
|
+
@plugin[:digital_ocean] = nil
|
89
90
|
@plugin.run
|
90
91
|
expect(@plugin[:cloud_v2]).to be_nil
|
91
92
|
end
|
@@ -115,31 +116,62 @@ describe Ohai::System, "plugin cloud" do
|
|
115
116
|
end
|
116
117
|
|
117
118
|
describe "with GCE mash" do
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
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_v2][: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_v2][: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_v2][: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_v2][:public_ipv4_addrs]).to be_nil
|
164
|
+
end
|
165
|
+
|
166
|
+
it "populates cloud private ip" do
|
167
|
+
@plugin.run
|
168
|
+
expect(@plugin[:cloud_v2][: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_v2][:provider]).to eq("gce")
|
174
|
+
end
|
143
175
|
end
|
144
176
|
end
|
145
177
|
|
@@ -289,4 +321,70 @@ describe Ohai::System, "plugin cloud" do
|
|
289
321
|
end
|
290
322
|
end
|
291
323
|
|
324
|
+
describe "with digital_ocean mash" do
|
325
|
+
before do
|
326
|
+
@plugin[:digital_ocean] = Mash.new
|
327
|
+
@plugin[:digital_ocean][:name] = "public.example.com"
|
328
|
+
@plugin[:digital_ocean][:networks] = Mash.new
|
329
|
+
@plugin[:digital_ocean][:networks][:v4] = [{"ip_address" => "1.2.3.4", "type" => "public"},
|
330
|
+
{"ip_address" => "5.6.7.8", "type" => "private"}]
|
331
|
+
@plugin[:digital_ocean][:networks][:v6] = [{"ip_address" => "fe80::4240:95ff:fe47:6eee", "type" => "public"},
|
332
|
+
{"ip_address" => "fdf8:f53b:82e4::53", "type" => "private"}]
|
333
|
+
end
|
334
|
+
|
335
|
+
before(:each) do
|
336
|
+
@plugin.run
|
337
|
+
end
|
338
|
+
|
339
|
+
it "populates cloud public hostname" do
|
340
|
+
expect(@plugin[:cloud_v2][:public_hostname]).to eq("public.example.com")
|
341
|
+
end
|
342
|
+
|
343
|
+
it "populates cloud local hostname" do
|
344
|
+
expect(@plugin[:cloud_v2][:local_hostname]).to be_nil
|
345
|
+
end
|
346
|
+
|
347
|
+
it "populates cloud public_ipv4_addrs" do
|
348
|
+
expect(@plugin[:cloud_v2][:public_ipv4_addrs]).to eq(@plugin[:digital_ocean][:networks][:v4].select{|ip| ip['type'] == 'public'}
|
349
|
+
.map{|ip| ip['ip_address']})
|
350
|
+
|
351
|
+
end
|
352
|
+
|
353
|
+
it "populates cloud local_ipv4_addrs" do
|
354
|
+
expect(@plugin[:cloud_v2][:local_ipv4_addrs]).to eq(@plugin[:digital_ocean][:networks][:v4].select{|ip| ip['type'] == 'private'}
|
355
|
+
.map{|ip| ip['ip_address']})
|
356
|
+
|
357
|
+
end
|
358
|
+
|
359
|
+
it "populates cloud public_ipv4" do
|
360
|
+
expect(@plugin[:cloud_v2][:public_ipv4]).to eq(@plugin[:digital_ocean][:networks][:v4].find{|ip| ip['type'] == 'public'}['ip_address'])
|
361
|
+
end
|
362
|
+
|
363
|
+
it "populates cloud local_ipv4" do
|
364
|
+
expect(@plugin[:cloud_v2][:local_ipv4]).to eq(@plugin[:digital_ocean][:networks][:v4].find{|ip| ip['type'] == 'private'}['ip_address'])
|
365
|
+
end
|
366
|
+
|
367
|
+
it "populates cloud public_ipv6_addrs" do
|
368
|
+
expect(@plugin[:cloud_v2][:public_ipv6_addrs]).to eq(@plugin[:digital_ocean][:networks][:v6].select{|ip| ip['type'] == 'public'}
|
369
|
+
.map{|ip| ip['ip_address']})
|
370
|
+
end
|
371
|
+
|
372
|
+
it "populates cloud local_ipv6_addrs" do
|
373
|
+
expect(@plugin[:cloud_v2][:local_ipv6_addrs]).to eq(@plugin[:digital_ocean][:networks][:v6].select{|ip| ip['type'] == 'private'}
|
374
|
+
.map{|ip| ip['ip_address']})
|
375
|
+
end
|
376
|
+
|
377
|
+
it "populates cloud public_ipv6" do
|
378
|
+
expect(@plugin[:cloud_v2][:public_ipv6]).to eq(@plugin[:digital_ocean][:networks][:v6].find{|ip| ip['type'] == 'public'}['ip_address'])
|
379
|
+
end
|
380
|
+
|
381
|
+
it "populates cloud local_ipv6" do
|
382
|
+
expect(@plugin[:cloud_v2][:local_ipv6]).to eq(@plugin[:digital_ocean][:networks][:v6].find{|ip| ip['type'] == 'private'}['ip_address'])
|
383
|
+
end
|
384
|
+
|
385
|
+
it "populates cloud provider" do
|
386
|
+
expect(@plugin[:cloud_v2][:provider]).to eq("digital_ocean")
|
387
|
+
end
|
388
|
+
end
|
389
|
+
|
292
390
|
end
|