ohai 6.14.0 → 6.16.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ohai/mixin/ec2_metadata.rb +61 -6
- data/lib/ohai/plugins/cloud.rb +69 -5
- data/lib/ohai/plugins/darwin/system_profiler.rb +44 -7
- data/lib/ohai/plugins/freebsd/virtualization.rb +16 -0
- data/lib/ohai/plugins/java.rb +1 -1
- data/lib/ohai/plugins/kernel.rb +1 -0
- data/lib/ohai/plugins/linode.rb +53 -0
- data/lib/ohai/plugins/linux/platform.rb +6 -2
- data/lib/ohai/plugins/network.rb +130 -44
- data/lib/ohai/plugins/{aix/ssh_host_key.rb → nodejs.rb} +15 -7
- data/lib/ohai/plugins/openstack.rb +46 -0
- data/lib/ohai/plugins/rackspace.rb +35 -1
- data/lib/ohai/plugins/solaris2/filesystem.rb +1 -1
- data/lib/ohai/plugins/solaris2/network.rb +2 -1
- data/lib/ohai/plugins/solaris2/platform.rb +2 -2
- data/lib/ohai/plugins/ssh_host_key.rb +63 -0
- data/lib/ohai/plugins/virtualization.rb +1 -1
- data/lib/ohai/plugins/windows/cpu.rb +20 -3
- data/lib/ohai/plugins/windows/kernel.rb +0 -19
- data/lib/ohai/plugins/windows/kernel_devices.rb +39 -0
- data/lib/ohai/system.rb +3 -2
- data/lib/ohai/version.rb +1 -1
- data/spec/spec_helper.rb +14 -1
- data/spec/support/platform_helpers.rb +31 -0
- data/spec/{ohai → unit}/mixin/command_spec.rb +0 -0
- data/spec/{ohai → unit}/mixin/from_file_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/c_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/chef_spec.rb +20 -12
- data/spec/unit/plugins/cloud_spec.rb +159 -0
- data/spec/{ohai → unit}/plugins/darwin/hostname_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/darwin/kernel_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/darwin/network_spec.rb +4 -2
- data/spec/{ohai → unit}/plugins/darwin/platform_spec.rb +0 -0
- data/spec/unit/plugins/darwin/system_profiler_output.rb +79525 -0
- data/spec/unit/plugins/darwin/system_profiler_spec.rb +48 -0
- data/spec/{ohai → unit}/plugins/dmi_spec.rb +0 -0
- data/spec/unit/plugins/ec2_spec.rb +199 -0
- data/spec/{ohai → unit}/plugins/erlang_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/eucalyptus_spec.rb +5 -5
- data/spec/{ohai → unit}/plugins/fail_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/freebsd/hostname_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/freebsd/kernel_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/freebsd/platform_spec.rb +0 -0
- data/spec/unit/plugins/freebsd/virtualization_spec.rb +99 -0
- data/spec/{ohai → unit}/plugins/groovy_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/hostname_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/java_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/kernel_spec.rb +0 -0
- data/spec/unit/plugins/linode_spec.rb +156 -0
- data/spec/{ohai → unit}/plugins/linux/cpu_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/linux/filesystem_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/linux/hostname_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/linux/kernel_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/linux/lsb_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/linux/network_spec.rb +3 -60
- data/spec/{ohai → unit}/plugins/linux/platform_spec.rb +10 -0
- data/spec/{ohai → unit}/plugins/linux/uptime_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/linux/virtualization_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/lua_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/mono_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/netbsd/hostname_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/netbsd/kernel_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/netbsd/platform_spec.rb +0 -0
- data/spec/unit/plugins/network_spec.rb +829 -0
- data/spec/unit/plugins/nodejs_spec.rb +51 -0
- data/spec/{ohai → unit}/plugins/ohai_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/ohai_time_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/openbsd/hostname_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/openbsd/kernel_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/openbsd/platform_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/os_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/passwd_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/perl_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/php_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/platform_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/python_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/rackspace_spec.rb +26 -0
- data/spec/{ohai → unit}/plugins/ruby_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/sigar/network_route_spec.rb +1 -0
- data/spec/{ohai → unit}/plugins/solaris2/hostname_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/solaris2/kernel_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/solaris2/network_spec.rb +8 -1
- data/spec/{ohai → unit}/plugins/solaris2/platform_spec.rb +0 -0
- data/spec/{ohai → unit}/plugins/solaris2/virtualization_spec.rb +0 -0
- data/spec/unit/plugins/ssh_host_keys_spec.rb +77 -0
- data/spec/{ohai → unit}/system_spec.rb +0 -0
- metadata +221 -184
- data/lib/ohai/plugins/darwin/ssh_host_key.rb +0 -25
- data/lib/ohai/plugins/freebsd/ssh_host_key.rb +0 -26
- data/lib/ohai/plugins/hpux/ssh_host_key.rb +0 -26
- data/lib/ohai/plugins/linux/ssh_host_key.rb +0 -26
- data/lib/ohai/plugins/netbsd/ssh_host_key.rb +0 -26
- data/lib/ohai/plugins/openbsd/ssh_host_key.rb +0 -26
- data/lib/ohai/plugins/solaris2/ssh_host_key.rb +0 -26
- data/spec/ohai/plugins/cloud_spec.rb +0 -113
- data/spec/ohai/plugins/ec2_spec.rb +0 -120
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,829 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Laurent Desarmes <laurent.desarmes@u-picardie.fr>
|
3
|
+
# Copyright:: Copyright (c) 2012 Laurent Desarmes
|
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 File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
|
20
|
+
|
21
|
+
def it_does_not_fail
|
22
|
+
it "doesn't fail" do
|
23
|
+
Ohai::Log.should_receive(:warn).any_number_of_times
|
24
|
+
Ohai::Log.should_not_receive(:debug).with(/^Plugin network threw exception/)
|
25
|
+
@ohai._require_plugin("network")
|
26
|
+
%w[ ipaddress, macaddress, ip6address ].each do |attribute|
|
27
|
+
@ohai.should have_key(attribute)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe Ohai::System, "Network Plugin" do
|
33
|
+
|
34
|
+
basic_data = {
|
35
|
+
"linux" => {
|
36
|
+
"network" => {
|
37
|
+
# pp Hash[node['network']] from shef to get the network data
|
38
|
+
# have just removed the neighbour and route entries by hand
|
39
|
+
"interfaces" => {
|
40
|
+
"lo" => {
|
41
|
+
"flags" => ["LOOPBACK", "UP"],
|
42
|
+
"addresses" => {
|
43
|
+
"::1" => {
|
44
|
+
"scope" => "Node",
|
45
|
+
"prefixlen" => "128",
|
46
|
+
"family" => "inet6"
|
47
|
+
},
|
48
|
+
"127.0.0.1" => {
|
49
|
+
"scope" => "Node",
|
50
|
+
"netmask" => "255.0.0.0",
|
51
|
+
"prefixlen" => "8",
|
52
|
+
"family" => "inet"
|
53
|
+
}
|
54
|
+
},
|
55
|
+
"mtu" => "16436",
|
56
|
+
"encapsulation" => "Loopback"
|
57
|
+
},
|
58
|
+
"eth0" => {
|
59
|
+
"flags" => ["BROADCAST", "MULTICAST", "UP"],
|
60
|
+
"number" => "0",
|
61
|
+
"addresses" => {
|
62
|
+
"fe80::216:3eff:fe2f:3679" => {
|
63
|
+
"scope" => "Link",
|
64
|
+
"prefixlen" => "64",
|
65
|
+
"family" => "inet6"
|
66
|
+
},
|
67
|
+
"00:16:3E:2F:36:79" => {"family" => "lladdr"},
|
68
|
+
"192.168.66.33" => {
|
69
|
+
"scope" => "Global",
|
70
|
+
"netmask" => "255.255.255.0",
|
71
|
+
"broadcast" => "192.168.66.255",
|
72
|
+
"prefixlen" => "24",
|
73
|
+
"family" => "inet"
|
74
|
+
},
|
75
|
+
"3ffe:1111:2222::33" => {
|
76
|
+
"prefixlen" => "48",
|
77
|
+
"family" => "inet6",
|
78
|
+
"scope" => "Global"
|
79
|
+
}
|
80
|
+
},
|
81
|
+
"mtu" => "1500",
|
82
|
+
"type" => "eth",
|
83
|
+
"encapsulation" => "Ethernet"
|
84
|
+
},
|
85
|
+
"eth1" => {
|
86
|
+
"flags" => ["BROADCAST", "MULTICAST", "UP"],
|
87
|
+
"number" => "1",
|
88
|
+
"addresses" => {
|
89
|
+
"fe80::216:3eff:fe2f:3680" => {
|
90
|
+
"scope" => "Link",
|
91
|
+
"prefixlen" => "64",
|
92
|
+
"family" => "inet6"
|
93
|
+
},
|
94
|
+
"00:16:3E:2F:36:80" => {"family" => "lladdr"},
|
95
|
+
"192.168.99.11" => {
|
96
|
+
"scope" => "Global",
|
97
|
+
"netmask" => "255.255.255.0",
|
98
|
+
"broadcast" => "192.168.99.255",
|
99
|
+
"prefixlen" => "24",
|
100
|
+
"family" => "inet"
|
101
|
+
},
|
102
|
+
"3ffe:1111:3333::1" => {
|
103
|
+
"prefixlen" => "48",
|
104
|
+
"family" => "inet6",
|
105
|
+
"scope" => "Global"
|
106
|
+
}
|
107
|
+
},
|
108
|
+
"mtu" => "1500",
|
109
|
+
"type" => "eth",
|
110
|
+
"encapsulation" => "Ethernet"
|
111
|
+
}
|
112
|
+
},
|
113
|
+
"default_gateway" => "192.168.66.15",
|
114
|
+
"default_interface" => "eth0",
|
115
|
+
"default_inet6_gateway" => "3ffe:1111:2222::",
|
116
|
+
"default_inet6_interface" => "eth0"
|
117
|
+
}
|
118
|
+
},
|
119
|
+
"windows" => {
|
120
|
+
"network" => {
|
121
|
+
"interfaces" => {
|
122
|
+
"0xb" => {
|
123
|
+
"addresses" => {
|
124
|
+
"172.19.0.130" => {
|
125
|
+
"prefixlen" => "24",
|
126
|
+
"netmask" => "255.255.255.0",
|
127
|
+
"broadcast" => "172.19.0.255",
|
128
|
+
"family" => "inet"
|
129
|
+
},
|
130
|
+
"fe80::698d:3e37:7950:b28c" => {
|
131
|
+
"prefixlen" => "64",
|
132
|
+
"family" => "inet6",
|
133
|
+
"scope" => "Link"
|
134
|
+
},
|
135
|
+
"52:54:44:66:66:02" => {
|
136
|
+
"family" => "lladdr"
|
137
|
+
}
|
138
|
+
},
|
139
|
+
"mtu" => nil,
|
140
|
+
"type" => "Ethernet 802.3",
|
141
|
+
"encapsulation" => "Ethernet"
|
142
|
+
}
|
143
|
+
},
|
144
|
+
"default_gateway" => "172.19.0.1",
|
145
|
+
"default_interface" => "0xb"
|
146
|
+
}
|
147
|
+
}
|
148
|
+
}
|
149
|
+
|
150
|
+
describe "with linux" do
|
151
|
+
before(:each) do
|
152
|
+
@ohai = Ohai::System.new
|
153
|
+
@ohai.stub!(:require_plugin).twice.and_return(true)
|
154
|
+
@ohai["network"] = basic_data["linux"]["network"]
|
155
|
+
end
|
156
|
+
|
157
|
+
describe "when the linux::network plugin hasn't set any of {ip,ip6,mac}address attributes" do
|
158
|
+
describe "simple setup" do
|
159
|
+
it_does_not_fail
|
160
|
+
|
161
|
+
it "logs 2 debug messages" do
|
162
|
+
Ohai::Log.should_receive(:debug).with(/^Loading plugin network/).once
|
163
|
+
Ohai::Log.should_receive(:debug).with(/^\[inet\] Using default/).once
|
164
|
+
Ohai::Log.should_receive(:debug).with(/^\[inet6\] Using default/).once
|
165
|
+
@ohai._require_plugin("network")
|
166
|
+
end
|
167
|
+
|
168
|
+
it "detects {ip,ip6,mac}address" do
|
169
|
+
@ohai._require_plugin("network")
|
170
|
+
@ohai["ipaddress"].should == "192.168.66.33"
|
171
|
+
@ohai["macaddress"].should == "00:16:3E:2F:36:79"
|
172
|
+
@ohai["ip6address"].should == "3ffe:1111:2222::33"
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
describe "default ipv4 and ipv6 gateway on different interfaces" do
|
177
|
+
describe "both interfaces have an ARP" do
|
178
|
+
before do
|
179
|
+
@ohai["network"]["default_inet6_gateway"] = "3ffe:1111:3333::"
|
180
|
+
@ohai["network"]["default_inet6_interface"] = "eth1"
|
181
|
+
end
|
182
|
+
|
183
|
+
it_does_not_fail
|
184
|
+
|
185
|
+
it "detects {ip,ip6}address" do
|
186
|
+
@ohai._require_plugin("network")
|
187
|
+
@ohai["ipaddress"].should == "192.168.66.33"
|
188
|
+
@ohai["ip6address"].should == "3ffe:1111:3333::1"
|
189
|
+
end
|
190
|
+
|
191
|
+
it "set macaddress from the ipv4 setup" do
|
192
|
+
@ohai._require_plugin("network")
|
193
|
+
@ohai["macaddress"].should == "00:16:3E:2F:36:79"
|
194
|
+
end
|
195
|
+
|
196
|
+
it "informs about this setup" do
|
197
|
+
Ohai::Log.should_receive(:info).with(/^ipaddress and ip6address are set from different interfaces/)
|
198
|
+
@ohai._require_plugin("network")
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
describe "ipv4 interface has no ARP" do
|
203
|
+
before do
|
204
|
+
@ohai["network"]["interfaces"]["eth0"]["addresses"].delete_if{|k,kv| kv["family"] == "lladdr" }
|
205
|
+
# not really checked by this pluging
|
206
|
+
@ohai["network"]["interfaces"]["eth0"]["flags"] << "NOARP"
|
207
|
+
@ohai["network"]["default_inet6_gateway"] = "3ffe:1111:3333::"
|
208
|
+
@ohai["network"]["default_inet6_interface"] = "eth1"
|
209
|
+
end
|
210
|
+
|
211
|
+
it_does_not_fail
|
212
|
+
|
213
|
+
it "detects {ip,ip6}address" do
|
214
|
+
@ohai._require_plugin("network")
|
215
|
+
@ohai["ipaddress"].should == "192.168.66.33"
|
216
|
+
@ohai["ip6address"].should == "3ffe:1111:3333::1"
|
217
|
+
end
|
218
|
+
|
219
|
+
it "doesn't set macaddress, ipv4 setup is valid and has precedence over ipv6" do
|
220
|
+
Ohai::Log.should_not_receive(:warn).with(/^unable to detect macaddress/)
|
221
|
+
@ohai._require_plugin("network")
|
222
|
+
@ohai["macaddress"].should be_nil
|
223
|
+
end
|
224
|
+
|
225
|
+
it "informs about this setup" do
|
226
|
+
Ohai::Log.should_receive(:info).with(/^ipaddress and ip6address are set from different interfaces/)
|
227
|
+
@ohai._require_plugin("network")
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
describe "conflicting results from the linux::network plugin" do
|
233
|
+
describe "default interface doesn't match the default_gateway" do
|
234
|
+
before do
|
235
|
+
@ohai["network"]["default_interface"] = "eth1"
|
236
|
+
@ohai["network"]["default_inet6_interface"] = "eth1"
|
237
|
+
end
|
238
|
+
|
239
|
+
it_does_not_fail
|
240
|
+
|
241
|
+
it "doesn't detect {ip,ip6,mac}address" do
|
242
|
+
Ohai::Log.should_receive(:warn).any_number_of_times
|
243
|
+
@ohai._require_plugin("network")
|
244
|
+
@ohai["ipaddress"].should be_nil
|
245
|
+
@ohai["macaddress"].should be_nil
|
246
|
+
@ohai["ip6address"].should be_nil
|
247
|
+
end
|
248
|
+
|
249
|
+
it "warns about this conflict" do
|
250
|
+
Ohai::Log.should_receive(:warn).with(/^\[inet\] no ipaddress\/mask on eth1/).once
|
251
|
+
Ohai::Log.should_receive(:warn).with(/^unable to detect ipaddress/).once
|
252
|
+
Ohai::Log.should_receive(:warn).with(/^unable to detect macaddress/).once
|
253
|
+
Ohai::Log.should_receive(:warn).with(/^\[inet6\] no ipaddress\/mask on eth1/).once
|
254
|
+
Ohai::Log.should_receive(:warn).with(/^unable to detect ip6address/).once
|
255
|
+
@ohai._require_plugin("network")
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
describe "no ip address for the given default interface/gateway" do
|
260
|
+
before do
|
261
|
+
@ohai["network"]["interfaces"]["eth0"]["addresses"].delete_if{|k,v| %w[inet inet6].include? v["family"]}
|
262
|
+
end
|
263
|
+
|
264
|
+
it_does_not_fail
|
265
|
+
|
266
|
+
it "doesn't detect {ip,ip6,mac}address" do
|
267
|
+
Ohai::Log.should_receive(:warn).any_number_of_times
|
268
|
+
@ohai._require_plugin("network")
|
269
|
+
@ohai["ipaddress"].should be_nil
|
270
|
+
@ohai["macaddress"].should be_nil
|
271
|
+
@ohai["ip6address"].should be_nil
|
272
|
+
end
|
273
|
+
|
274
|
+
it "warns about this conflict" do
|
275
|
+
Ohai::Log.should_receive(:warn).with(/^unable to detect ipaddress/).once
|
276
|
+
Ohai::Log.should_receive(:warn).with(/^unable to detect macaddress/).once
|
277
|
+
Ohai::Log.should_receive(:warn).with(/^\[inet\] no ip on eth0/).once
|
278
|
+
Ohai::Log.should_receive(:warn).with(/^unable to detect ip6address/).once
|
279
|
+
Ohai::Log.should_receive(:warn).with(/^\[inet6\] no ip on eth0/).once
|
280
|
+
@ohai._require_plugin("network")
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
284
|
+
describe "no ip at all" do
|
285
|
+
before do
|
286
|
+
@ohai["network"]["default_gateway"] = nil
|
287
|
+
@ohai["network"]["default_interface"] = nil
|
288
|
+
@ohai["network"]["default_inet6_gateway"] = nil
|
289
|
+
@ohai["network"]["default_inet6_interface"] = nil
|
290
|
+
@ohai["network"]["interfaces"].each do |i,iv|
|
291
|
+
iv["addresses"].delete_if{|k,kv| %w[inet inet6].include? kv["family"]}
|
292
|
+
end
|
293
|
+
end
|
294
|
+
|
295
|
+
it_does_not_fail
|
296
|
+
|
297
|
+
it "doesn't detect {ip,ip6,mac}address" do
|
298
|
+
Ohai::Log.should_receive(:warn).any_number_of_times
|
299
|
+
@ohai._require_plugin("network")
|
300
|
+
@ohai["ipaddress"].should be_nil
|
301
|
+
@ohai["macaddress"].should be_nil
|
302
|
+
@ohai["ip6address"].should be_nil
|
303
|
+
end
|
304
|
+
|
305
|
+
it "should warn about it" do
|
306
|
+
Ohai::Log.should_receive(:warn).with(/^unable to detect ipaddress/).once
|
307
|
+
Ohai::Log.should_receive(:warn).with(/^unable to detect macaddress/).once
|
308
|
+
Ohai::Log.should_receive(:warn).with(/^unable to detect ip6address/).once
|
309
|
+
@ohai._require_plugin("network")
|
310
|
+
end
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
314
|
+
describe "several ipaddresses matching the default route" do
|
315
|
+
describe "bigger prefix not set on the default interface" do
|
316
|
+
before do
|
317
|
+
@ohai["network"]["interfaces"]["eth2"] = {
|
318
|
+
"flags" => ["BROADCAST", "MULTICAST", "UP"],
|
319
|
+
"number" => "2",
|
320
|
+
"addresses" => {
|
321
|
+
"fe80::216:3eff:fe2f:3681" => {
|
322
|
+
"scope" => "Link",
|
323
|
+
"prefixlen" => "64",
|
324
|
+
"family" => "inet6"
|
325
|
+
},
|
326
|
+
"00:16:3E:2F:36:81" => {"family" => "lladdr"},
|
327
|
+
"192.168.66.99" => {
|
328
|
+
"scope" => "Global",
|
329
|
+
"netmask" => "255.255.255.128",
|
330
|
+
"broadcast" => "192.168.99.127",
|
331
|
+
"prefixlen" => "25",
|
332
|
+
"family" => "inet"
|
333
|
+
},
|
334
|
+
"3ffe:1111:2222:0:4444::1" => {
|
335
|
+
"prefixlen" => "64",
|
336
|
+
"family" => "inet6",
|
337
|
+
"scope" => "Global"
|
338
|
+
}
|
339
|
+
}
|
340
|
+
}
|
341
|
+
end
|
342
|
+
|
343
|
+
it_does_not_fail
|
344
|
+
|
345
|
+
it "sets {ip,ip6,mac}address correctly" do
|
346
|
+
@ohai._require_plugin("network")
|
347
|
+
@ohai["ipaddress"].should == "192.168.66.33"
|
348
|
+
@ohai["macaddress"].should == "00:16:3E:2F:36:79"
|
349
|
+
@ohai["ip6address"].should == "3ffe:1111:2222::33"
|
350
|
+
end
|
351
|
+
end
|
352
|
+
|
353
|
+
describe "bigger prefix set on the default interface" do
|
354
|
+
before do
|
355
|
+
@ohai["network"]["interfaces"]["eth0"]["addresses"]["192.168.66.99"] = {
|
356
|
+
"scope" => "Global",
|
357
|
+
"netmask" => "255.255.255.128",
|
358
|
+
"broadcast" => "192.168.66.127",
|
359
|
+
"prefixlen" => "25",
|
360
|
+
"family" => "inet"
|
361
|
+
}
|
362
|
+
@ohai["network"]["interfaces"]["eth0"]["addresses"]["3ffe:1111:2222:0:4444::1"] = {
|
363
|
+
"prefixlen" => "64",
|
364
|
+
"family" => "inet6",
|
365
|
+
"scope" => "Global"
|
366
|
+
}
|
367
|
+
end
|
368
|
+
|
369
|
+
it_does_not_fail
|
370
|
+
|
371
|
+
it "sets {ip,ip6,mac}address correctly" do
|
372
|
+
@ohai._require_plugin("network")
|
373
|
+
@ohai["ipaddress"].should == "192.168.66.99"
|
374
|
+
@ohai["macaddress"].should == "00:16:3E:2F:36:79"
|
375
|
+
@ohai["ip6address"].should == "3ffe:1111:2222:0:4444::1"
|
376
|
+
end
|
377
|
+
end
|
378
|
+
|
379
|
+
describe "smallest ip not set on the default_interface" do
|
380
|
+
before do
|
381
|
+
@ohai["network"]["interfaces"]["eth2"] = {
|
382
|
+
"flags" => ["BROADCAST", "MULTICAST", "UP"],
|
383
|
+
"number" => "2",
|
384
|
+
"addresses" => {
|
385
|
+
"fe80::216:3eff:fe2f:3681" => {
|
386
|
+
"scope" => "Link",
|
387
|
+
"prefixlen" => "64",
|
388
|
+
"family" => "inet6"
|
389
|
+
},
|
390
|
+
"00:16:3E:2F:36:81" => {"family" => "lladdr"},
|
391
|
+
"192.168.66.32" => {
|
392
|
+
"scope" => "Global",
|
393
|
+
"netmask" => "255.255.255.0",
|
394
|
+
"broadcast" => "192.168.66.255",
|
395
|
+
"prefixlen" => "24",
|
396
|
+
"family" => "inet"
|
397
|
+
},
|
398
|
+
"3ffe:1111:2222::32" => {
|
399
|
+
"prefixlen" => "48",
|
400
|
+
"family" => "inet6",
|
401
|
+
"scope" => "Global"
|
402
|
+
}
|
403
|
+
}
|
404
|
+
}
|
405
|
+
end
|
406
|
+
|
407
|
+
it_does_not_fail
|
408
|
+
|
409
|
+
it "sets {ip,ip6,mac}address correctly" do
|
410
|
+
@ohai._require_plugin("network")
|
411
|
+
@ohai["ipaddress"].should == "192.168.66.33"
|
412
|
+
@ohai["macaddress"].should == "00:16:3E:2F:36:79"
|
413
|
+
@ohai["ip6address"].should == "3ffe:1111:2222::33"
|
414
|
+
end
|
415
|
+
end
|
416
|
+
|
417
|
+
describe "smallest ip set on the default_interface" do
|
418
|
+
before do
|
419
|
+
@ohai["network"]["interfaces"]["eth0"]["addresses"]["192.168.66.32"] = {
|
420
|
+
"scope" => "Global",
|
421
|
+
"netmask" => "255.255.255.0",
|
422
|
+
"broadcast" => "192.168.66.255",
|
423
|
+
"prefixlen" => "24",
|
424
|
+
"family" => "inet"
|
425
|
+
}
|
426
|
+
@ohai["network"]["interfaces"]["eth0"]["addresses"]["3ffe:1111:2222::32"] = {
|
427
|
+
"prefixlen" => "48",
|
428
|
+
"family" => "inet6",
|
429
|
+
"scope" => "Global"
|
430
|
+
}
|
431
|
+
end
|
432
|
+
|
433
|
+
it_does_not_fail
|
434
|
+
|
435
|
+
it "sets {ip,ip6,mac}address correctly" do
|
436
|
+
@ohai._require_plugin("network")
|
437
|
+
@ohai["ipaddress"].should == "192.168.66.32"
|
438
|
+
@ohai["macaddress"].should == "00:16:3E:2F:36:79"
|
439
|
+
@ohai["ip6address"].should == "3ffe:1111:2222::32"
|
440
|
+
end
|
441
|
+
end
|
442
|
+
end
|
443
|
+
|
444
|
+
describe "no default route" do
|
445
|
+
describe "first interface is not the best choice" do
|
446
|
+
before do
|
447
|
+
@ohai["network"]["default_gateway"] = nil
|
448
|
+
@ohai["network"]["default_interface"] = nil
|
449
|
+
@ohai["network"]["default_inet6_gateway"] = nil
|
450
|
+
@ohai["network"]["default_inet6_interface"] = nil
|
451
|
+
# removing inet* addresses from eth0, to complicate things a bit
|
452
|
+
@ohai["network"]["interfaces"]["eth0"]["addresses"].delete_if{|k,v| %w[inet inet6].include? v["family"]}
|
453
|
+
end
|
454
|
+
|
455
|
+
it_does_not_fail
|
456
|
+
|
457
|
+
it "picks {ip,mac,ip6}address from the first interface" do
|
458
|
+
Ohai::Log.should_receive(:info).with(/^\[inet\] no default interface/).once
|
459
|
+
Ohai::Log.should_receive(:info).with(/^\[inet6\] no default interface/).once
|
460
|
+
@ohai._require_plugin("network")
|
461
|
+
@ohai["ipaddress"].should == "192.168.99.11"
|
462
|
+
@ohai["macaddress"].should == "00:16:3E:2F:36:80"
|
463
|
+
@ohai["ip6address"].should == "3ffe:1111:3333::1"
|
464
|
+
end
|
465
|
+
end
|
466
|
+
|
467
|
+
describe "can choose from addresses with different scopes" do
|
468
|
+
before do
|
469
|
+
@ohai["network"]["default_gateway"] = nil
|
470
|
+
@ohai["network"]["default_interface"] = nil
|
471
|
+
@ohai["network"]["default_inet6_gateway"] = nil
|
472
|
+
@ohai["network"]["default_inet6_interface"] = nil
|
473
|
+
# just changing scopes to lInK for eth0 addresses
|
474
|
+
@ohai["network"]["interfaces"]["eth0"]["addresses"].each{|k,v| v[:scope]="lInK" if %w[inet inet6].include? v["family"]}
|
475
|
+
end
|
476
|
+
|
477
|
+
it_does_not_fail
|
478
|
+
|
479
|
+
it "prefers global scope addressses to set {ip,mac,ip6}address" do
|
480
|
+
Ohai::Log.should_receive(:info).with(/^\[inet\] no default interface/).once
|
481
|
+
Ohai::Log.should_receive(:info).with(/^\[inet6\] no default interface/).once
|
482
|
+
@ohai._require_plugin("network")
|
483
|
+
@ohai["ipaddress"].should == "192.168.99.11"
|
484
|
+
@ohai["macaddress"].should == "00:16:3E:2F:36:80"
|
485
|
+
@ohai["ip6address"].should == "3ffe:1111:3333::1"
|
486
|
+
end
|
487
|
+
end
|
488
|
+
end
|
489
|
+
|
490
|
+
describe "link level default route" do
|
491
|
+
describe "simple setup" do
|
492
|
+
before do
|
493
|
+
@ohai["network"]["default_gateway"] = "0.0.0.0"
|
494
|
+
@ohai["network"]["default_interface"] = "eth1"
|
495
|
+
@ohai["network"]["default_inet6_gateway"] = "::"
|
496
|
+
@ohai["network"]["default_inet6_interface"] = "eth1"
|
497
|
+
end
|
498
|
+
|
499
|
+
it_does_not_fail
|
500
|
+
|
501
|
+
it "displays debug messages" do
|
502
|
+
Ohai::Log.should_receive(:debug).with(/^Loading plugin network/).once
|
503
|
+
Ohai::Log.should_receive(:debug).with(/^link level default inet /).once
|
504
|
+
Ohai::Log.should_receive(:debug).with(/^link level default inet6 /).once
|
505
|
+
@ohai._require_plugin("network")
|
506
|
+
end
|
507
|
+
|
508
|
+
it "picks {ip,mac,ip6}address from the default interface" do
|
509
|
+
@ohai._require_plugin("network")
|
510
|
+
@ohai["ipaddress"].should == "192.168.99.11"
|
511
|
+
@ohai["macaddress"].should == "00:16:3E:2F:36:80"
|
512
|
+
@ohai["ip6address"].should == "3ffe:1111:3333::1"
|
513
|
+
end
|
514
|
+
end
|
515
|
+
|
516
|
+
describe "can choose from addresses with different scopes" do
|
517
|
+
before do
|
518
|
+
@ohai["network"]["default_gateway"] = "0.0.0.0"
|
519
|
+
@ohai["network"]["default_interface"] = "eth1"
|
520
|
+
@ohai["network"]["default_inet6_gateway"] = "::"
|
521
|
+
@ohai["network"]["default_inet6_interface"] = "eth1"
|
522
|
+
@ohai["network"]["interfaces"]["eth1"]["addresses"]["127.0.0.2"] = {
|
523
|
+
"scope" => "host",
|
524
|
+
"netmask" => "255.255.255.255",
|
525
|
+
"prefixlen" => "32",
|
526
|
+
"family" => "inet"
|
527
|
+
}
|
528
|
+
end
|
529
|
+
|
530
|
+
it_does_not_fail
|
531
|
+
|
532
|
+
it "displays debug messages" do
|
533
|
+
Ohai::Log.should_receive(:debug).with(/^Loading plugin network/).once
|
534
|
+
Ohai::Log.should_receive(:debug).with(/^link level default inet /).once
|
535
|
+
Ohai::Log.should_receive(:debug).with(/^link level default inet6 /).once
|
536
|
+
@ohai._require_plugin("network")
|
537
|
+
end
|
538
|
+
|
539
|
+
it "picks {ip,mac,ip6}address from the default interface" do
|
540
|
+
@ohai._require_plugin("network")
|
541
|
+
@ohai["ipaddress"].should == "192.168.99.11"
|
542
|
+
@ohai["macaddress"].should == "00:16:3E:2F:36:80"
|
543
|
+
@ohai["ip6address"].should == "3ffe:1111:3333::1"
|
544
|
+
end
|
545
|
+
end
|
546
|
+
end
|
547
|
+
|
548
|
+
describe "point to point address" do
|
549
|
+
before do
|
550
|
+
@ohai["network"]["interfaces"]["eth2"] = {
|
551
|
+
"flags" => ["POINTOPOINT", "BROADCAST", "MULTICAST", "UP"],
|
552
|
+
"number" => "2",
|
553
|
+
"addresses" => {
|
554
|
+
"fe80::216:3eff:fe2f:3681" => {
|
555
|
+
"scope" => "Link",
|
556
|
+
"prefixlen" => "64",
|
557
|
+
"family" => "inet6"
|
558
|
+
},
|
559
|
+
"00:16:3E:2F:36:81" => {"family" => "lladdr"},
|
560
|
+
"192.168.66.99" => {
|
561
|
+
"scope" => "Global",
|
562
|
+
"netmask" => "255.255.255.255",
|
563
|
+
"peer" => "192.168.99.126",
|
564
|
+
"prefixlen" => "32",
|
565
|
+
"family" => "inet"
|
566
|
+
},
|
567
|
+
"3ffe:1111:2222:0:4444::1" => {
|
568
|
+
"prefixlen" => "128",
|
569
|
+
"peer" => "3ffe:1111:2222:0:4444::2",
|
570
|
+
"family" => "inet6",
|
571
|
+
"scope" => "Global"
|
572
|
+
}
|
573
|
+
}
|
574
|
+
}
|
575
|
+
@ohai["network"]["default_gateway"] = "192.168.99.126"
|
576
|
+
@ohai["network"]["default_interface"] = "eth2"
|
577
|
+
@ohai["network"]["default_inet6_gateway"] = "3ffe:1111:2222:0:4444::2"
|
578
|
+
@ohai["network"]["default_inet6_interface"] = "eth2"
|
579
|
+
end
|
580
|
+
|
581
|
+
it_does_not_fail
|
582
|
+
|
583
|
+
it "picks {ip,mac,ip6}address from the default interface" do
|
584
|
+
@ohai._require_plugin("network")
|
585
|
+
@ohai["ipaddress"].should == "192.168.66.99"
|
586
|
+
@ohai["macaddress"].should == "00:16:3E:2F:36:81"
|
587
|
+
@ohai["ip6address"].should == "3ffe:1111:2222:0:4444::1"
|
588
|
+
end
|
589
|
+
end
|
590
|
+
|
591
|
+
describe "ipv6 only node" do
|
592
|
+
before do
|
593
|
+
@ohai["network"]["default_gateway"] = nil
|
594
|
+
@ohai["network"]["default_interface"] = nil
|
595
|
+
@ohai["network"]["interfaces"].each do |i,iv|
|
596
|
+
iv["addresses"].delete_if{|k,kv| kv["family"] == "inet" }
|
597
|
+
end
|
598
|
+
end
|
599
|
+
|
600
|
+
it_does_not_fail
|
601
|
+
|
602
|
+
it "can't detect ipaddress" do
|
603
|
+
Ohai::Log.should_receive(:warn).any_number_of_times
|
604
|
+
@ohai._require_plugin("network")
|
605
|
+
@ohai["ipaddress"].should be_nil
|
606
|
+
end
|
607
|
+
|
608
|
+
it "warns about not being able to set {ip,mac}address (ipv4)" do
|
609
|
+
Ohai::Log.should_receive(:warn).with(/^unable to detect ipaddress/).once
|
610
|
+
Ohai::Log.should_receive(:warn).with(/^unable to detect macaddress/).once
|
611
|
+
@ohai._require_plugin("network")
|
612
|
+
end
|
613
|
+
|
614
|
+
it "sets {ip6,mac}address" do
|
615
|
+
Ohai::Log.should_receive(:warn).any_number_of_times
|
616
|
+
@ohai._require_plugin("network")
|
617
|
+
@ohai["ip6address"].should == "3ffe:1111:2222::33"
|
618
|
+
@ohai["macaddress"].should == "00:16:3E:2F:36:79"
|
619
|
+
end
|
620
|
+
|
621
|
+
it "informs about macaddress being set using the ipv6 setup" do
|
622
|
+
Ohai::Log.should_receive(:warn).any_number_of_times
|
623
|
+
Ohai::Log.should_receive(:info).with(/^macaddress set to 00:16:3E:2F:36:79 from the ipv6 setup/).once
|
624
|
+
@ohai._require_plugin("network")
|
625
|
+
end
|
626
|
+
end
|
627
|
+
|
628
|
+
end
|
629
|
+
|
630
|
+
basic_data.keys.sort.each do |os|
|
631
|
+
describe "the #{os}::network has already set some of the {ip,mac,ip6}address attributes" do
|
632
|
+
before(:each) do
|
633
|
+
@ohai = Ohai::System.new
|
634
|
+
@ohai.stub!(:require_plugin).twice.and_return(true)
|
635
|
+
@ohai["network"] = basic_data[os]["network"]
|
636
|
+
end
|
637
|
+
|
638
|
+
describe "{ip,mac}address are already set" do
|
639
|
+
before do
|
640
|
+
@ohai["ipaddress"] = "10.11.12.13"
|
641
|
+
@ohai["macaddress"] = "00:AA:BB:CC:DD:EE"
|
642
|
+
@expected_results = {
|
643
|
+
"linux" => {
|
644
|
+
"ip6address" => "3ffe:1111:2222::33"
|
645
|
+
},
|
646
|
+
"windows" => {
|
647
|
+
"ip6address" => "fe80::698d:3e37:7950:b28c"
|
648
|
+
}
|
649
|
+
}
|
650
|
+
end
|
651
|
+
|
652
|
+
it_does_not_fail
|
653
|
+
|
654
|
+
it "detects ip6address" do
|
655
|
+
@ohai._require_plugin("network")
|
656
|
+
@ohai["ip6address"].should == @expected_results[os]["ip6address"]
|
657
|
+
end
|
658
|
+
|
659
|
+
it "doesn't overwrite {ip,mac}address" do
|
660
|
+
@ohai._require_plugin("network")
|
661
|
+
@ohai["ipaddress"].should == "10.11.12.13"
|
662
|
+
@ohai["macaddress"].should == "00:AA:BB:CC:DD:EE"
|
663
|
+
end
|
664
|
+
end
|
665
|
+
|
666
|
+
describe "ip6address is already set" do
|
667
|
+
describe "node has ipv4 and ipv6" do
|
668
|
+
before do
|
669
|
+
@ohai["ip6address"] = "3ffe:8888:9999::1"
|
670
|
+
@expected_results = {
|
671
|
+
"linux" => {
|
672
|
+
"ipaddress" => "192.168.66.33",
|
673
|
+
"macaddress" => "00:16:3E:2F:36:79"
|
674
|
+
},
|
675
|
+
"windows" => {
|
676
|
+
"ipaddress" => "172.19.0.130",
|
677
|
+
"macaddress" => "52:54:44:66:66:02"
|
678
|
+
}
|
679
|
+
}
|
680
|
+
end
|
681
|
+
|
682
|
+
it_does_not_fail
|
683
|
+
|
684
|
+
it "detects {ip,mac}address" do
|
685
|
+
@ohai._require_plugin("network")
|
686
|
+
@ohai["ipaddress"].should == @expected_results[os]["ipaddress"]
|
687
|
+
@ohai["macaddress"].should == @expected_results[os]["macaddress"]
|
688
|
+
end
|
689
|
+
|
690
|
+
it "doesn't overwrite ip6address" do
|
691
|
+
@ohai._require_plugin("network")
|
692
|
+
@ohai["ip6address"].should == "3ffe:8888:9999::1"
|
693
|
+
end
|
694
|
+
end
|
695
|
+
|
696
|
+
describe "ipv6 only node" do
|
697
|
+
before do
|
698
|
+
@ohai["network"]["default_gateway"] = nil
|
699
|
+
@ohai["network"]["default_interface"] = nil
|
700
|
+
@ohai["network"]["interfaces"].each do |i,iv|
|
701
|
+
iv["addresses"].delete_if{|k,kv| kv["family"] == "inet" }
|
702
|
+
end
|
703
|
+
@ohai["ip6address"] = "3ffe:8888:9999::1"
|
704
|
+
end
|
705
|
+
|
706
|
+
it_does_not_fail
|
707
|
+
|
708
|
+
it "can't detect ipaddress (ipv4)" do
|
709
|
+
Ohai::Log.should_receive(:warn).any_number_of_times
|
710
|
+
@ohai._require_plugin("network")
|
711
|
+
@ohai["ipaddress"].should be_nil
|
712
|
+
end
|
713
|
+
|
714
|
+
it "can't detect macaddress either" do
|
715
|
+
Ohai::Log.should_receive(:warn).any_number_of_times
|
716
|
+
@ohai._require_plugin("network")
|
717
|
+
@ohai["macaddress"].should be_nil
|
718
|
+
end
|
719
|
+
|
720
|
+
it "warns about not being able to set {ip,mac}address" do
|
721
|
+
Ohai::Log.should_receive(:warn).with(/^unable to detect ipaddress/).once
|
722
|
+
Ohai::Log.should_receive(:warn).with(/^unable to detect macaddress/).once
|
723
|
+
@ohai._require_plugin("network")
|
724
|
+
end
|
725
|
+
|
726
|
+
it "doesn't overwrite ip6address" do
|
727
|
+
Ohai::Log.should_receive(:warn).any_number_of_times
|
728
|
+
@ohai._require_plugin("network")
|
729
|
+
@ohai["ip6address"].should == "3ffe:8888:9999::1"
|
730
|
+
end
|
731
|
+
end
|
732
|
+
end
|
733
|
+
|
734
|
+
describe "{mac,ip6}address are already set" do
|
735
|
+
describe "valid ipv4 setup" do
|
736
|
+
before do
|
737
|
+
@ohai["macaddress"] = "00:AA:BB:CC:DD:EE"
|
738
|
+
@ohai["ip6address"] = "3ffe:8888:9999::1"
|
739
|
+
@expected_results = {
|
740
|
+
"linux" => {
|
741
|
+
"ipaddress" => "192.168.66.33",
|
742
|
+
"macaddress" => "00:16:3E:2F:36:79"
|
743
|
+
},
|
744
|
+
"windows" => {
|
745
|
+
"ipaddress" => "172.19.0.130",
|
746
|
+
"macaddress" => "52:54:44:66:66:02"
|
747
|
+
}
|
748
|
+
}
|
749
|
+
end
|
750
|
+
|
751
|
+
it_does_not_fail
|
752
|
+
|
753
|
+
it "detects ipaddress and overwrite macaddress" do
|
754
|
+
@ohai._require_plugin("network")
|
755
|
+
@ohai["ipaddress"].should == @expected_results[os]["ipaddress"]
|
756
|
+
@ohai["macaddress"].should == @expected_results[os]["macaddress"]
|
757
|
+
end
|
758
|
+
|
759
|
+
it "doesn't overwrite ip6address" do
|
760
|
+
@ohai._require_plugin("network")
|
761
|
+
@ohai["ip6address"].should == "3ffe:8888:9999::1"
|
762
|
+
end
|
763
|
+
end
|
764
|
+
|
765
|
+
describe "ipv6 only node" do
|
766
|
+
before do
|
767
|
+
@ohai["network"]["default_gateway"] = nil
|
768
|
+
@ohai["network"]["default_interface"] = nil
|
769
|
+
@ohai["network"]["interfaces"].each do |i,iv|
|
770
|
+
iv["addresses"].delete_if{|k,kv| kv["family"] == "inet" }
|
771
|
+
end
|
772
|
+
@ohai["macaddress"] = "00:AA:BB:CC:DD:EE"
|
773
|
+
@ohai["ip6address"] = "3ffe:8888:9999::1"
|
774
|
+
end
|
775
|
+
|
776
|
+
it_does_not_fail
|
777
|
+
|
778
|
+
it "can't set ipaddress" do
|
779
|
+
Ohai::Log.should_receive(:warn).any_number_of_times
|
780
|
+
@ohai._require_plugin("network")
|
781
|
+
@ohai["ipaddress"].should be_nil
|
782
|
+
end
|
783
|
+
|
784
|
+
it "doesn't overwrite {ip6,mac}address" do
|
785
|
+
Ohai::Log.should_receive(:warn).any_number_of_times
|
786
|
+
@ohai._require_plugin("network")
|
787
|
+
@ohai["ip6address"].should == "3ffe:8888:9999::1"
|
788
|
+
@ohai["macaddress"].should == "00:AA:BB:CC:DD:EE"
|
789
|
+
end
|
790
|
+
end
|
791
|
+
end
|
792
|
+
|
793
|
+
describe "{ip,mac,ip6}address are already set" do
|
794
|
+
before do
|
795
|
+
@ohai["ipaddress"] = "10.11.12.13"
|
796
|
+
@ohai["macaddress"] = "00:AA:BB:CC:DD:EE"
|
797
|
+
@ohai["ip6address"] = "3ffe:8888:9999::1"
|
798
|
+
end
|
799
|
+
|
800
|
+
it_does_not_fail
|
801
|
+
|
802
|
+
it "doesn't overwrite {ip,mac,ip6}address" do
|
803
|
+
@ohai._require_plugin("network")
|
804
|
+
@ohai["ipaddress"].should == "10.11.12.13"
|
805
|
+
@ohai["macaddress"].should == "00:AA:BB:CC:DD:EE"
|
806
|
+
@ohai["ip6address"].should == "3ffe:8888:9999::1"
|
807
|
+
end
|
808
|
+
end
|
809
|
+
|
810
|
+
describe "{ip,ip6}address are already set" do
|
811
|
+
before do
|
812
|
+
@ohai["ipaddress"] = "10.11.12.13"
|
813
|
+
@ohai["ip6address"] = "3ffe:8888:9999::1"
|
814
|
+
end
|
815
|
+
|
816
|
+
it_does_not_fail
|
817
|
+
|
818
|
+
it "doesn't overwrite {ip,mac,ip6}address" do
|
819
|
+
@ohai._require_plugin("network")
|
820
|
+
@ohai["ipaddress"].should == "10.11.12.13"
|
821
|
+
@ohai["macaddress"].should == nil
|
822
|
+
@ohai["ip6address"].should == "3ffe:8888:9999::1"
|
823
|
+
end
|
824
|
+
end
|
825
|
+
|
826
|
+
end
|
827
|
+
end
|
828
|
+
end
|
829
|
+
end
|