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
|
@@ -282,6 +282,9 @@ IP_ROUTE_SCOPE
|
|
282
282
|
|
283
283
|
@ohai.stub(:popen4).with("ifconfig -a")
|
284
284
|
@ohai.stub(:popen4).with("arp -an")
|
285
|
+
|
286
|
+
Ohai::Log.should_receive(:warn).with(/unable to detect/).exactly(3).times
|
287
|
+
@ohai._require_plugin("network")
|
285
288
|
end
|
286
289
|
|
287
290
|
["ifconfig","iproute2"].each do |network_method|
|
@@ -294,19 +297,16 @@ IP_ROUTE_SCOPE
|
|
294
297
|
|
295
298
|
it "completes the run" do
|
296
299
|
Ohai::Log.should_not_receive(:debug).with(/Plugin linux::network threw exception/)
|
297
|
-
@ohai._require_plugin("network")
|
298
300
|
@ohai._require_plugin("linux::network")
|
299
301
|
@ohai['network'].should_not be_nil
|
300
302
|
end
|
301
303
|
|
302
304
|
it "detects the interfaces" do
|
303
|
-
@ohai._require_plugin("network")
|
304
305
|
@ohai._require_plugin("linux::network")
|
305
306
|
@ohai['network']['interfaces'].keys.sort.should == ["eth0", "eth0.11", "eth0.151", "eth0.152", "eth0.153", "eth0:5", "foo:veth0@eth0", "lo", "tun0", "venet0", "venet0:0"]
|
306
307
|
end
|
307
308
|
|
308
309
|
it "detects the ipv4 addresses of the ethernet interface" do
|
309
|
-
@ohai._require_plugin("network")
|
310
310
|
@ohai._require_plugin("linux::network")
|
311
311
|
@ohai['network']['interfaces']['eth0']['addresses'].keys.should include('10.116.201.76')
|
312
312
|
@ohai['network']['interfaces']['eth0']['addresses']['10.116.201.76']['netmask'].should == '255.255.255.0'
|
@@ -315,7 +315,6 @@ IP_ROUTE_SCOPE
|
|
315
315
|
end
|
316
316
|
|
317
317
|
it "detects the ipv4 addresses of an ethernet subinterface" do
|
318
|
-
@ohai._require_plugin("network")
|
319
318
|
@ohai._require_plugin("linux::network")
|
320
319
|
@ohai['network']['interfaces']['eth0.11']['addresses'].keys.should include('192.168.0.16')
|
321
320
|
@ohai['network']['interfaces']['eth0.11']['addresses']['192.168.0.16']['netmask'].should == '255.255.255.0'
|
@@ -324,7 +323,6 @@ IP_ROUTE_SCOPE
|
|
324
323
|
end
|
325
324
|
|
326
325
|
it "detects the ipv6 addresses of the ethernet interface" do
|
327
|
-
@ohai._require_plugin("network")
|
328
326
|
@ohai._require_plugin("linux::network")
|
329
327
|
@ohai['network']['interfaces']['eth0']['addresses'].keys.should include('fe80::1031:3dff:fe02:bea2')
|
330
328
|
@ohai['network']['interfaces']['eth0']['addresses']['fe80::1031:3dff:fe02:bea2']['scope'].should == 'Link'
|
@@ -333,7 +331,6 @@ IP_ROUTE_SCOPE
|
|
333
331
|
end
|
334
332
|
|
335
333
|
it "detects the ipv6 addresses of an ethernet subinterface" do
|
336
|
-
@ohai._require_plugin("network")
|
337
334
|
@ohai._require_plugin("linux::network")
|
338
335
|
%w[ 1111:2222:3333:4444::2 1111:2222:3333:4444::3 ].each do |addr|
|
339
336
|
@ohai['network']['interfaces']['eth0.11']['addresses'].keys.should include(addr)
|
@@ -344,20 +341,17 @@ IP_ROUTE_SCOPE
|
|
344
341
|
end
|
345
342
|
|
346
343
|
it "detects the mac addresses of the ethernet interface" do
|
347
|
-
@ohai._require_plugin("network")
|
348
344
|
@ohai._require_plugin("linux::network")
|
349
345
|
@ohai['network']['interfaces']['eth0']['addresses'].keys.should include('12:31:3D:02:BE:A2')
|
350
346
|
@ohai['network']['interfaces']['eth0']['addresses']['12:31:3D:02:BE:A2']['family'].should == 'lladdr'
|
351
347
|
end
|
352
348
|
|
353
349
|
it "detects the encapsulation type of the ethernet interface" do
|
354
|
-
@ohai._require_plugin("network")
|
355
350
|
@ohai._require_plugin("linux::network")
|
356
351
|
@ohai['network']['interfaces']['eth0']['encapsulation'].should == 'Ethernet'
|
357
352
|
end
|
358
353
|
|
359
354
|
it "detects the flags of the ethernet interface" do
|
360
|
-
@ohai._require_plugin("network")
|
361
355
|
@ohai._require_plugin("linux::network")
|
362
356
|
if network_method == "ifconfig"
|
363
357
|
@ohai['network']['interfaces']['eth0']['flags'].sort.should == ['BROADCAST','MULTICAST','RUNNING','UP']
|
@@ -367,19 +361,16 @@ IP_ROUTE_SCOPE
|
|
367
361
|
end
|
368
362
|
|
369
363
|
it "detects the number of the ethernet interface" do
|
370
|
-
@ohai._require_plugin("network")
|
371
364
|
@ohai._require_plugin("linux::network")
|
372
365
|
@ohai['network']['interfaces']['eth0']['number'].should == "0"
|
373
366
|
end
|
374
367
|
|
375
368
|
it "detects the mtu of the ethernet interface" do
|
376
|
-
@ohai._require_plugin("network")
|
377
369
|
@ohai._require_plugin("linux::network")
|
378
370
|
@ohai['network']['interfaces']['eth0']['mtu'].should == "1500"
|
379
371
|
end
|
380
372
|
|
381
373
|
it "detects the ipv4 addresses of the loopback interface" do
|
382
|
-
@ohai._require_plugin("network")
|
383
374
|
@ohai._require_plugin("linux::network")
|
384
375
|
@ohai['network']['interfaces']['lo']['addresses'].keys.should include('127.0.0.1')
|
385
376
|
@ohai['network']['interfaces']['lo']['addresses']['127.0.0.1']['netmask'].should == '255.0.0.0'
|
@@ -387,7 +378,6 @@ IP_ROUTE_SCOPE
|
|
387
378
|
end
|
388
379
|
|
389
380
|
it "detects the ipv6 addresses of the loopback interface" do
|
390
|
-
@ohai._require_plugin("network")
|
391
381
|
@ohai._require_plugin("linux::network")
|
392
382
|
@ohai['network']['interfaces']['lo']['addresses'].keys.should include('::1')
|
393
383
|
@ohai['network']['interfaces']['lo']['addresses']['::1']['scope'].should == 'Node'
|
@@ -396,13 +386,11 @@ IP_ROUTE_SCOPE
|
|
396
386
|
end
|
397
387
|
|
398
388
|
it "detects the encapsulation type of the loopback interface" do
|
399
|
-
@ohai._require_plugin("network")
|
400
389
|
@ohai._require_plugin("linux::network")
|
401
390
|
@ohai['network']['interfaces']['lo']['encapsulation'].should == 'Loopback'
|
402
391
|
end
|
403
392
|
|
404
393
|
it "detects the flags of the ethernet interface" do
|
405
|
-
@ohai._require_plugin("network")
|
406
394
|
@ohai._require_plugin("linux::network")
|
407
395
|
if network_method == "ifconfig"
|
408
396
|
@ohai['network']['interfaces']['lo']['flags'].sort.should == ['LOOPBACK','RUNNING','UP']
|
@@ -413,13 +401,11 @@ IP_ROUTE_SCOPE
|
|
413
401
|
|
414
402
|
|
415
403
|
it "detects the mtu of the loopback interface" do
|
416
|
-
@ohai._require_plugin("network")
|
417
404
|
@ohai._require_plugin("linux::network")
|
418
405
|
@ohai['network']['interfaces']['lo']['mtu'].should == "16436"
|
419
406
|
end
|
420
407
|
|
421
408
|
it "detects the arp entries" do
|
422
|
-
@ohai._require_plugin("network")
|
423
409
|
@ohai._require_plugin("linux::network")
|
424
410
|
@ohai['network']['interfaces']['eth0']['arp']['10.116.201.1'].should == 'fe:ff:ff:ff:ff:ff'
|
425
411
|
end
|
@@ -430,7 +416,6 @@ IP_ROUTE_SCOPE
|
|
430
416
|
before do
|
431
417
|
File.stub!(:exist?).with("/sbin/ip").and_return( network_method == "iproute2" )
|
432
418
|
do_stubs
|
433
|
-
@ohai._require_plugin("network")
|
434
419
|
@ohai._require_plugin("linux::network")
|
435
420
|
end
|
436
421
|
|
@@ -474,7 +459,6 @@ IP_ROUTE_SCOPE
|
|
474
459
|
|
475
460
|
describe "without a subinterface" do
|
476
461
|
before do
|
477
|
-
@ohai._require_plugin("network")
|
478
462
|
@ohai._require_plugin("linux::network")
|
479
463
|
end
|
480
464
|
|
@@ -502,7 +486,6 @@ ROUTE_N
|
|
502
486
|
prepare_data
|
503
487
|
do_stubs
|
504
488
|
|
505
|
-
@ohai._require_plugin("network")
|
506
489
|
@ohai._require_plugin("linux::network")
|
507
490
|
end
|
508
491
|
|
@@ -531,7 +514,6 @@ ROUTE_N
|
|
531
514
|
prepare_data
|
532
515
|
do_stubs
|
533
516
|
|
534
|
-
@ohai._require_plugin("network")
|
535
517
|
@ohai._require_plugin("linux::network")
|
536
518
|
end
|
537
519
|
|
@@ -554,31 +536,26 @@ ROUTE_N
|
|
554
536
|
|
555
537
|
it "completes the run" do
|
556
538
|
Ohai::Log.should_not_receive(:debug).with(/Plugin linux::network threw exception/)
|
557
|
-
@ohai._require_plugin("network")
|
558
539
|
@ohai._require_plugin("linux::network")
|
559
540
|
@ohai['network'].should_not be_nil
|
560
541
|
end
|
561
542
|
|
562
543
|
it "finds the default inet6 interface if there's a inet6 default route" do
|
563
|
-
@ohai._require_plugin("network")
|
564
544
|
@ohai._require_plugin("linux::network")
|
565
545
|
@ohai['network']['default_inet6_interface'].should == 'eth0.11'
|
566
546
|
end
|
567
547
|
|
568
548
|
it "finds the default inet6 gateway if there's a inet6 default route" do
|
569
|
-
@ohai._require_plugin("network")
|
570
549
|
@ohai._require_plugin("linux::network")
|
571
550
|
@ohai['network']['default_inet6_gateway'].should == '1111:2222:3333:4444::1'
|
572
551
|
end
|
573
552
|
|
574
553
|
it "finds inet6 neighbours" do
|
575
|
-
@ohai._require_plugin("network")
|
576
554
|
@ohai._require_plugin("linux::network")
|
577
555
|
@ohai['network']['interfaces']['eth0.11']['neighbour_inet6']['1111:2222:3333:4444::1'].should == '00:1c:0e:12:34:56'
|
578
556
|
end
|
579
557
|
|
580
558
|
it "detects the ipv4 addresses of an ethernet interface with a crazy name" do
|
581
|
-
@ohai._require_plugin("network")
|
582
559
|
@ohai._require_plugin("linux::network")
|
583
560
|
@ohai['network']['interfaces']['foo:veth0@eth0']['addresses'].keys.should include('192.168.212.2')
|
584
561
|
@ohai['network']['interfaces']['foo:veth0@eth0']['addresses']['192.168.212.2']['netmask'].should == '255.255.255.0'
|
@@ -586,7 +563,6 @@ ROUTE_N
|
|
586
563
|
end
|
587
564
|
|
588
565
|
it "generates a fake interface for ip aliases for backward compatibility" do
|
589
|
-
@ohai._require_plugin("network")
|
590
566
|
@ohai._require_plugin("linux::network")
|
591
567
|
@ohai['network']['interfaces']['eth0:5']['addresses'].keys.should include('192.168.5.1')
|
592
568
|
@ohai['network']['interfaces']['eth0:5']['addresses']['192.168.5.1']['netmask'].should == '255.255.255.0'
|
@@ -594,21 +570,18 @@ ROUTE_N
|
|
594
570
|
end
|
595
571
|
|
596
572
|
it "adds the vlan information of an interface" do
|
597
|
-
@ohai._require_plugin("network")
|
598
573
|
@ohai._require_plugin("linux::network")
|
599
574
|
@ohai['network']['interfaces']['eth0.11']['vlan']['id'].should == '11'
|
600
575
|
@ohai['network']['interfaces']['eth0.11']['vlan']['flags'].should == [ 'REORDER_HDR' ]
|
601
576
|
end
|
602
577
|
|
603
578
|
it "adds the state of an interface" do
|
604
|
-
@ohai._require_plugin("network")
|
605
579
|
@ohai._require_plugin("linux::network")
|
606
580
|
@ohai['network']['interfaces']['eth0.11']['state'].should == 'up'
|
607
581
|
end
|
608
582
|
|
609
583
|
describe "when dealing with routes" do
|
610
584
|
it "adds routes" do
|
611
|
-
@ohai._require_plugin("network")
|
612
585
|
@ohai._require_plugin("linux::network")
|
613
586
|
@ohai['network']['interfaces']['eth0']['routes'].should include Mash.new( :destination => "10.116.201.0/24", :proto => "kernel", :family =>"inet" )
|
614
587
|
@ohai['network']['interfaces']['foo:veth0@eth0']['routes'].should include Mash.new( :destination => "192.168.212.0/24", :proto => "kernel", :src => "192.168.212.2", :family =>"inet" )
|
@@ -619,19 +592,16 @@ ROUTE_N
|
|
619
592
|
|
620
593
|
describe "when there isn't a source field in route entries " do
|
621
594
|
it "doesn't set ipaddress" do
|
622
|
-
@ohai._require_plugin("network")
|
623
595
|
@ohai._require_plugin("linux::network")
|
624
596
|
@ohai['ipaddress'].should be nil
|
625
597
|
end
|
626
598
|
|
627
599
|
it "doesn't set macaddress" do
|
628
|
-
@ohai._require_plugin("network")
|
629
600
|
@ohai._require_plugin("linux::network")
|
630
601
|
@ohai['macaddress'].should be nil
|
631
602
|
end
|
632
603
|
|
633
604
|
it "doesn't set ip6address" do
|
634
|
-
@ohai._require_plugin("network")
|
635
605
|
@ohai._require_plugin("linux::network")
|
636
606
|
@ohai['ip6address'].should be nil
|
637
607
|
end
|
@@ -661,19 +631,16 @@ IP_ROUTE_SCOPE
|
|
661
631
|
|
662
632
|
it "completes the run" do
|
663
633
|
Ohai::Log.should_not_receive(:debug).with(/Plugin linux::network threw exception/)
|
664
|
-
@ohai._require_plugin("network")
|
665
634
|
@ohai._require_plugin("linux::network")
|
666
635
|
@ohai['network'].should_not be_nil
|
667
636
|
end
|
668
637
|
|
669
638
|
it "sets ipaddress" do
|
670
|
-
@ohai._require_plugin("network")
|
671
639
|
@ohai._require_plugin("linux::network")
|
672
640
|
@ohai['ipaddress'].should == "10.116.201.76"
|
673
641
|
end
|
674
642
|
|
675
643
|
it "sets ip6address" do
|
676
|
-
@ohai._require_plugin("network")
|
677
644
|
@ohai._require_plugin("linux::network")
|
678
645
|
@ohai['ip6address'].should == "1111:2222:3333:4444::3"
|
679
646
|
end
|
@@ -705,20 +672,17 @@ IP_ROUTE_SCOPE
|
|
705
672
|
|
706
673
|
it "completes the run" do
|
707
674
|
Ohai::Log.should_not_receive(:debug).with(/Plugin linux::network threw exception/)
|
708
|
-
@ohai._require_plugin("network")
|
709
675
|
@ohai._require_plugin("linux::network")
|
710
676
|
@ohai['network'].should_not be_nil
|
711
677
|
end
|
712
678
|
|
713
679
|
it "sets default ipv4 interface and gateway" do
|
714
|
-
@ohai._require_plugin("network")
|
715
680
|
@ohai._require_plugin("linux::network")
|
716
681
|
@ohai['network']['default_interface'].should == 'eth0'
|
717
682
|
@ohai['network']['default_gateway'].should == '10.116.201.254'
|
718
683
|
end
|
719
684
|
|
720
685
|
it "sets default ipv6 interface and gateway" do
|
721
|
-
@ohai._require_plugin("network")
|
722
686
|
@ohai._require_plugin("linux::network")
|
723
687
|
@ohai['network']['default_inet6_interface'].should == 'eth0.11'
|
724
688
|
@ohai['network']['default_inet6_gateway'].should == '1111:2222:3333:4444::ffff'
|
@@ -751,19 +715,16 @@ IP_ROUTE_SCOPE
|
|
751
715
|
|
752
716
|
it "completes the run" do
|
753
717
|
Ohai::Log.should_not_receive(:debug).with(/Plugin linux::network threw exception/)
|
754
|
-
@ohai._require_plugin("network")
|
755
718
|
@ohai._require_plugin("linux::network")
|
756
719
|
@ohai['network'].should_not be_nil
|
757
720
|
end
|
758
721
|
|
759
722
|
it "sets ipaddress" do
|
760
|
-
@ohai._require_plugin("network")
|
761
723
|
@ohai._require_plugin("linux::network")
|
762
724
|
@ohai["ipaddress"].should == "10.116.201.74"
|
763
725
|
end
|
764
726
|
|
765
727
|
it "sets ip6address" do
|
766
|
-
@ohai._require_plugin("network")
|
767
728
|
@ohai._require_plugin("linux::network")
|
768
729
|
@ohai["ip6address"].should == "1111:2222:3333:4444::2"
|
769
730
|
end
|
@@ -793,20 +754,17 @@ IP_ROUTE_SCOPE
|
|
793
754
|
|
794
755
|
it "completes the run" do
|
795
756
|
Ohai::Log.should_not_receive(:debug).with(/Plugin linux::network threw exception/)
|
796
|
-
@ohai._require_plugin("network")
|
797
757
|
@ohai._require_plugin("linux::network")
|
798
758
|
@ohai['network'].should_not be_nil
|
799
759
|
end
|
800
760
|
|
801
761
|
it "sets ipaddress" do
|
802
|
-
@ohai._require_plugin("network")
|
803
762
|
@ohai._require_plugin("linux::network")
|
804
763
|
@ohai['ipaddress'].should == "10.116.201.76"
|
805
764
|
end
|
806
765
|
|
807
766
|
describe "when about to set macaddress" do
|
808
767
|
it "sets macaddress" do
|
809
|
-
@ohai._require_plugin("network")
|
810
768
|
@ohai._require_plugin("linux::network")
|
811
769
|
@ohai['macaddress'].should == "12:31:3D:02:BE:A2"
|
812
770
|
end
|
@@ -824,13 +782,11 @@ IP_ROUTE
|
|
824
782
|
|
825
783
|
it "completes the run" do
|
826
784
|
Ohai::Log.should_not_receive(:debug).with(/Plugin linux::network threw exception/)
|
827
|
-
@ohai._require_plugin("network")
|
828
785
|
@ohai._require_plugin("linux::network")
|
829
786
|
@ohai['network'].should_not be_nil
|
830
787
|
end
|
831
788
|
|
832
789
|
it "doesn't set macaddress" do
|
833
|
-
@ohai._require_plugin("network")
|
834
790
|
@ohai._require_plugin("linux::network")
|
835
791
|
@ohai['macaddress'].should be_nil
|
836
792
|
end
|
@@ -838,7 +794,6 @@ IP_ROUTE
|
|
838
794
|
end
|
839
795
|
|
840
796
|
it "sets ip6address" do
|
841
|
-
@ohai._require_plugin("network")
|
842
797
|
@ohai._require_plugin("linux::network")
|
843
798
|
@ohai['ip6address'].should == "1111:2222:3333:4444::3"
|
844
799
|
end
|
@@ -856,13 +811,11 @@ IP_ROUTE
|
|
856
811
|
|
857
812
|
it "completes the run" do
|
858
813
|
Ohai::Log.should_not_receive(:debug).with(/Plugin linux::network threw exception/)
|
859
|
-
@ohai._require_plugin("network")
|
860
814
|
@ohai._require_plugin("linux::network")
|
861
815
|
@ohai['network'].should_not be_nil
|
862
816
|
end
|
863
817
|
|
864
818
|
it "doesn't set ipaddress" do
|
865
|
-
@ohai._require_plugin("network")
|
866
819
|
@ohai._require_plugin("linux::network")
|
867
820
|
@ohai['ipaddress'].should be_nil
|
868
821
|
end
|
@@ -881,13 +834,11 @@ IP_ROUTE_SCOPE
|
|
881
834
|
|
882
835
|
it "completes the run" do
|
883
836
|
Ohai::Log.should_not_receive(:debug).with(/Plugin linux::network threw exception/)
|
884
|
-
@ohai._require_plugin("network")
|
885
837
|
@ohai._require_plugin("linux::network")
|
886
838
|
@ohai['network'].should_not be_nil
|
887
839
|
end
|
888
840
|
|
889
841
|
it "doesn't set ip6address" do
|
890
|
-
@ohai._require_plugin("network")
|
891
842
|
@ohai._require_plugin("linux::network")
|
892
843
|
@ohai['ip6address'].should be_nil
|
893
844
|
end
|
@@ -916,19 +867,16 @@ IP_ROUTE
|
|
916
867
|
|
917
868
|
it "completes the run" do
|
918
869
|
Ohai::Log.should_not_receive(:debug).with(/Plugin linux::network threw exception/)
|
919
|
-
@ohai._require_plugin("network")
|
920
870
|
@ohai._require_plugin("linux::network")
|
921
871
|
@ohai['network'].should_not be_nil
|
922
872
|
end
|
923
873
|
|
924
874
|
it "doesn't set ipaddress" do
|
925
|
-
@ohai._require_plugin("network")
|
926
875
|
@ohai._require_plugin("linux::network")
|
927
876
|
@ohai['ipaddress'].should be_nil
|
928
877
|
end
|
929
878
|
|
930
879
|
it "doesn't set ip6address" do
|
931
|
-
@ohai._require_plugin("network")
|
932
880
|
@ohai._require_plugin("linux::network")
|
933
881
|
@ohai['ip6address'].should be_nil
|
934
882
|
end
|
@@ -957,13 +905,11 @@ IP_ROUTE
|
|
957
905
|
|
958
906
|
it "completes the run" do
|
959
907
|
Ohai::Log.should_not_receive(:debug).with(/Plugin linux::network threw exception/)
|
960
|
-
@ohai._require_plugin("network")
|
961
908
|
@ohai._require_plugin("linux::network")
|
962
909
|
@ohai['network'].should_not be_nil
|
963
910
|
end
|
964
911
|
|
965
912
|
it "doesn't add bogus routes" do
|
966
|
-
@ohai._require_plugin("network")
|
967
913
|
@ohai._require_plugin("linux::network")
|
968
914
|
@ohai['network']['interfaces']['eth0']['routes'].should_not include Mash.new( :destination => "10.116.201.0/26", :proto => "kernel", :family => "inet", :via => "10.116.201.39" )
|
969
915
|
@ohai['network']['interfaces']['eth0']['routes'].should_not include Mash.new( :destination => "10.118.19.0/26", :proto => "kernel", :family => "inet", :via => "10.118.19.39" )
|
@@ -971,13 +917,11 @@ IP_ROUTE
|
|
971
917
|
end
|
972
918
|
|
973
919
|
it "doesn't set ipaddress" do
|
974
|
-
@ohai._require_plugin("network")
|
975
920
|
@ohai._require_plugin("linux::network")
|
976
921
|
@ohai['ipaddress'].should be_nil
|
977
922
|
end
|
978
923
|
|
979
924
|
it "doesn't set ip6address" do
|
980
|
-
@ohai._require_plugin("network")
|
981
925
|
@ohai._require_plugin("linux::network")
|
982
926
|
@ohai['ip6address'].should be_nil
|
983
927
|
end
|
@@ -996,7 +940,6 @@ IP_ROUTE
|
|
996
940
|
it "logs a message and skips previously unseen interfaces in 'ip route show'" do
|
997
941
|
Ohai::Log.should_receive(:debug).with("Skipping previously unseen interface from 'ip route show': virbr0").once
|
998
942
|
Ohai::Log.should_receive(:debug).any_number_of_times # Catches the 'Loading plugin network' type messages
|
999
|
-
@ohai._require_plugin("network")
|
1000
943
|
@ohai._require_plugin("linux::network")
|
1001
944
|
end
|
1002
945
|
end
|
@@ -36,6 +36,7 @@ describe Ohai::System, "Linux plugin platform" do
|
|
36
36
|
File.stub!(:exists?).with("/etc/slackware-version").and_return(false)
|
37
37
|
File.stub!(:exists?).with("/etc/enterprise-release").and_return(false)
|
38
38
|
File.stub!(:exists?).with("/etc/oracle-release").and_return(false)
|
39
|
+
File.stub!(:exists?).with("/usr/bin/raspi-config").and_return(false)
|
39
40
|
end
|
40
41
|
|
41
42
|
it "should require the lsb plugin" do
|
@@ -130,6 +131,15 @@ describe Ohai::System, "Linux plugin platform" do
|
|
130
131
|
@ohai._require_plugin("linux::platform")
|
131
132
|
@ohai[:platform].should == "ubuntu"
|
132
133
|
end
|
134
|
+
|
135
|
+
# Raspbian is a debian clone
|
136
|
+
it "should detect Raspbian as itself with debian as the family" do
|
137
|
+
File.should_receive(:exists?).with("/usr/bin/raspi-config").and_return(true)
|
138
|
+
File.should_receive(:read).with("/etc/debian_version").and_return("wheezy/sid")
|
139
|
+
@ohai._require_plugin("linux::platform")
|
140
|
+
@ohai[:platform].should == "raspbian"
|
141
|
+
@ohai[:platform_family].should == "debian"
|
142
|
+
end
|
133
143
|
end
|
134
144
|
|
135
145
|
describe "on slackware" do
|