ohai 8.6.0.alpha.1 → 8.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -12
  3. data/lib/ohai/config.rb +3 -0
  4. data/lib/ohai/dsl/plugin/versionvii.rb +41 -0
  5. data/lib/ohai/exception.rb +1 -0
  6. data/lib/ohai/mixin/softlayer_metadata.rb +64 -0
  7. data/lib/ohai/plugin_config.rb +46 -0
  8. data/lib/ohai/plugins/aix/cpu.rb +23 -18
  9. data/lib/ohai/plugins/aix/memory.rb +9 -2
  10. data/lib/ohai/plugins/aix/network.rb +1 -1
  11. data/lib/ohai/plugins/cloud.rb +34 -3
  12. data/lib/ohai/plugins/ec2.rb +6 -0
  13. data/lib/ohai/plugins/linux/network.rb +245 -190
  14. data/lib/ohai/plugins/linux/platform.rb +50 -15
  15. data/lib/ohai/plugins/linux/virtualization.rb +3 -1
  16. data/lib/ohai/plugins/softlayer.rb +47 -0
  17. data/lib/ohai/plugins/solaris2/cpu.rb +46 -17
  18. data/lib/ohai/plugins/solaris2/memory.rb +9 -1
  19. data/lib/ohai/plugins/vmware.rb +73 -0
  20. data/lib/ohai/plugins/windows/memory.rb +38 -0
  21. data/lib/ohai/version.rb +1 -1
  22. data/spec/unit/config_spec.rb +28 -0
  23. data/spec/unit/dsl/plugin_spec.rb +73 -0
  24. data/spec/unit/mixin/softlayer_metadata_spec.rb +71 -0
  25. data/spec/unit/plugin_config_spec.rb +118 -0
  26. data/spec/unit/plugins/aix/cpu_spec.rb +31 -12
  27. data/spec/unit/plugins/aix/memory_spec.rb +47 -0
  28. data/spec/unit/plugins/aix/network_spec.rb +1 -1
  29. data/spec/unit/plugins/ec2_spec.rb +35 -13
  30. data/spec/unit/plugins/linux/memory_spec.rb +204 -0
  31. data/spec/unit/plugins/linux/network_spec.rb +40 -0
  32. data/spec/unit/plugins/linux/platform_spec.rb +62 -6
  33. data/spec/unit/plugins/linux/virtualization_spec.rb +21 -0
  34. data/spec/unit/plugins/softlayer_spec.rb +60 -0
  35. data/spec/unit/plugins/solaris2/cpu_spec.rb +2887 -42
  36. data/spec/unit/plugins/solaris2/memory_spec.rb +15 -2
  37. data/spec/unit/plugins/vmware_spec.rb +62 -0
  38. data/spec/unit/plugins/windows/memory_spec.rb +52 -0
  39. metadata +18 -5
@@ -20,11 +20,24 @@ describe Ohai::System, "Solaris2.X memory plugin" do
20
20
  before(:each) do
21
21
  @plugin = get_plugin("solaris2/memory")
22
22
  allow(@plugin).to receive(:collect_os).and_return("solaris2")
23
- allow(@plugin).to receive(:shell_out).with("prtconf -m").and_return(mock_shell_out(0, "8194\n", ""))
23
+ allow(@plugin).to receive(:shell_out).with("prtconf | grep Memory").and_return(mock_shell_out(0, "Memory size: 8194 Megabytes\n", ""))
24
+ @swap_s = "total: 112230656k bytes allocated + 357865576k reserved = 470096232k used, 47057688k available\n"
25
+ allow(@plugin).to receive(:shell_out).with("swap -s").and_return(mock_shell_out(0,@swap_s, ""))
24
26
  end
25
27
 
26
28
  it "should get the total memory" do
27
29
  @plugin.run
28
- expect(@plugin['memory']['total']).to eql(8194)
30
+ expect(@plugin[:memory][:total]).to eql("#{8194 * 1024}kB")
29
31
  end
32
+
33
+ it "should get total swap" do
34
+ @plugin.run
35
+ expect(@plugin[:memory][:swap][:total]).to eql("#{(470096232 + 47057688)}kB" )
36
+ end
37
+
38
+ it "should get free swap" do
39
+ @plugin.run
40
+ expect(@plugin[:memory][:swap][:free]).to eql("47057688kB")
41
+ end
42
+
30
43
  end
@@ -0,0 +1,62 @@
1
+ #
2
+ # Author:: "Christopher M. Luciano" <cmlucian@us.ibm.com>
3
+ # Copyright (C) 2015 IBM Corp.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ require 'spec_helper'
18
+
19
+ describe Ohai::System, "plugin vmware" do
20
+
21
+ let(:plugin) { get_plugin("vmware") }
22
+ let(:path) { "/usr/bin/vmware-toolbox-cmd" }
23
+
24
+ context "vmware toolbox" do
25
+
26
+ def setup_stubs
27
+ allow(File).to receive(:exist?).and_return(true)
28
+ allow(plugin).to receive(:collect_os).and_return(:linux)
29
+ allow(plugin).to receive(:shell_out).with("#{path} stat speed").and_return(mock_shell_out(0, "2000 MHz", nil))
30
+ allow(plugin).to receive(:shell_out).with("#{path} stat hosttime").and_return(mock_shell_out(0, "04 Jun 2015 19:21:16", nil))
31
+ allow(plugin).to receive(:shell_out).with("#{path} stat sessionid").and_return(mock_shell_out(0, "0x0000000000000000", nil))
32
+ allow(plugin).to receive(:shell_out).with("#{path} stat balloon").and_return(mock_shell_out(0, "0 MB", nil))
33
+ allow(plugin).to receive(:shell_out).with("#{path} stat swap").and_return(mock_shell_out(0, "0 MB", nil))
34
+ allow(plugin).to receive(:shell_out).with("#{path} stat memlimit").and_return(mock_shell_out(0, "4000000000 MB", nil))
35
+ allow(plugin).to receive(:shell_out).with("#{path} stat memres").and_return(mock_shell_out(0, "0 MB", nil))
36
+ allow(plugin).to receive(:shell_out).with("#{path} stat cpures").and_return(mock_shell_out(0, "0 MHz", nil))
37
+ allow(plugin).to receive(:shell_out).with("#{path} stat cpulimit").and_return(mock_shell_out(0, "4000000000 MB", nil))
38
+ allow(plugin).to receive(:shell_out).with("#{path} upgrade status").and_return(mock_shell_out(0, "VMware Tools are up-to-date.", nil))
39
+ allow(plugin).to receive(:shell_out).with("#{path} timesync status").and_return(mock_shell_out(0, "Disabled", nil))
40
+ plugin.run
41
+ end
42
+
43
+ before(:each) do
44
+ setup_stubs
45
+ end
46
+
47
+ context "the vmware toolbox cmd" do
48
+
49
+ it "gets the speed" do
50
+ expect(plugin[:vmware][:speed]).to eq("2000 MHz")
51
+ end
52
+
53
+ it "gets the hosttime" do
54
+ expect(plugin[:vmware][:hosttime]).to eq("04 Jun 2015 19:21:16")
55
+ end
56
+
57
+ it "gets tools update status" do
58
+ expect(plugin[:vmware][:upgrade]).to eq("VMware Tools are up-to-date.")
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,52 @@
1
+ #
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
+
17
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
18
+
19
+ describe Ohai::System, "Windows memory plugin", :windows_only do
20
+ before do
21
+ require "wmi-lite/wmi"
22
+ @plugin = get_plugin("windows/memory")
23
+ mock_os = {
24
+ "TotalVisibleMemorySize" => "10485760",
25
+ "FreePhysicalMemory" => "5242880",
26
+ "SizeStoredInPagingFiles" => "20971520",
27
+ "FreeSpaceInPagingFiles" => "15728640"
28
+ }
29
+ expect_any_instance_of(WmiLite::Wmi).to receive(:first_of).with('Win32_OperatingSystem').and_return(mock_os)
30
+ end
31
+
32
+ it "should get total memory" do
33
+ @plugin.run
34
+ expect(@plugin["memory"]["total"]).to eql("10485760kB")
35
+ end
36
+
37
+ it "should get free memory" do
38
+ @plugin.run
39
+ expect(@plugin["memory"]["free"]).to eql("5242880kB")
40
+ end
41
+
42
+ it "should get total swap" do
43
+ @plugin.run
44
+ expect(@plugin["memory"]["swap"]["total"]).to eql("20971520kB")
45
+ end
46
+
47
+ it "should get free memory" do
48
+ @plugin.run
49
+ expect(@plugin["memory"]["swap"]["free"]).to eql("15728640kB")
50
+ end
51
+
52
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ohai
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.6.0.alpha.1
4
+ version: 8.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-07 00:00:00.000000000 Z
11
+ date: 2015-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mime-types
@@ -300,7 +300,9 @@ files:
300
300
  - lib/ohai/mixin/network_constants.rb
301
301
  - lib/ohai/mixin/os.rb
302
302
  - lib/ohai/mixin/seconds_to_human.rb
303
+ - lib/ohai/mixin/softlayer_metadata.rb
303
304
  - lib/ohai/mixin/string.rb
305
+ - lib/ohai/plugin_config.rb
304
306
  - lib/ohai/plugins/aix/cpu.rb
305
307
  - lib/ohai/plugins/aix/filesystem.rb
306
308
  - lib/ohai/plugins/aix/kernel.rb
@@ -396,6 +398,7 @@ files:
396
398
  - lib/ohai/plugins/sigar/network.rb
397
399
  - lib/ohai/plugins/sigar/network_route.rb
398
400
  - lib/ohai/plugins/sigar/platform.rb
401
+ - lib/ohai/plugins/softlayer.rb
399
402
  - lib/ohai/plugins/solaris2/cpu.rb
400
403
  - lib/ohai/plugins/solaris2/dmi.rb
401
404
  - lib/ohai/plugins/solaris2/filesystem.rb
@@ -407,9 +410,11 @@ files:
407
410
  - lib/ohai/plugins/ssh_host_key.rb
408
411
  - lib/ohai/plugins/uptime.rb
409
412
  - lib/ohai/plugins/virtualization.rb
413
+ - lib/ohai/plugins/vmware.rb
410
414
  - lib/ohai/plugins/windows/cpu.rb
411
415
  - lib/ohai/plugins/windows/drivers.rb
412
416
  - lib/ohai/plugins/windows/filesystem.rb
417
+ - lib/ohai/plugins/windows/memory.rb
413
418
  - lib/ohai/plugins/windows/network.rb
414
419
  - lib/ohai/plugins/windows/platform.rb
415
420
  - lib/ohai/plugins/windows/virtualization.rb
@@ -458,10 +463,13 @@ files:
458
463
  - spec/unit/loader_spec.rb
459
464
  - spec/unit/mixin/command_spec.rb
460
465
  - spec/unit/mixin/ec2_metadata_spec.rb
466
+ - spec/unit/mixin/softlayer_metadata_spec.rb
467
+ - spec/unit/plugin_config_spec.rb
461
468
  - spec/unit/plugins/aix/cpu_spec.rb
462
469
  - spec/unit/plugins/aix/filesystem_spec.rb
463
470
  - spec/unit/plugins/aix/hostname_spec.rb
464
471
  - spec/unit/plugins/aix/kernel_spec.rb
472
+ - spec/unit/plugins/aix/memory_spec.rb
465
473
  - spec/unit/plugins/aix/network_spec.rb
466
474
  - spec/unit/plugins/aix/platform_spec.rb
467
475
  - spec/unit/plugins/aix/uptime_spec.rb
@@ -512,6 +520,7 @@ files:
512
520
  - spec/unit/plugins/linux/kernel_spec.rb
513
521
  - spec/unit/plugins/linux/lsb_spec.rb
514
522
  - spec/unit/plugins/linux/mdadm_spec.rb
523
+ - spec/unit/plugins/linux/memory_spec.rb
515
524
  - spec/unit/plugins/linux/network_spec.rb
516
525
  - spec/unit/plugins/linux/platform_spec.rb
517
526
  - spec/unit/plugins/linux/uptime_spec.rb
@@ -541,6 +550,7 @@ files:
541
550
  - spec/unit/plugins/ruby_spec.rb
542
551
  - spec/unit/plugins/rust_spec.rb
543
552
  - spec/unit/plugins/sigar/network_route_spec.rb
553
+ - spec/unit/plugins/softlayer_spec.rb
544
554
  - spec/unit/plugins/solaris2/cpu_spec.rb
545
555
  - spec/unit/plugins/solaris2/dmi_spec.rb
546
556
  - spec/unit/plugins/solaris2/hostname_spec.rb
@@ -551,6 +561,8 @@ files:
551
561
  - spec/unit/plugins/solaris2/virtualization_spec.rb
552
562
  - spec/unit/plugins/solaris2/zpools_spec.rb
553
563
  - spec/unit/plugins/ssh_host_keys_spec.rb
564
+ - spec/unit/plugins/vmware_spec.rb
565
+ - spec/unit/plugins/windows/memory_spec.rb
554
566
  - spec/unit/plugins/windows/virtualization_spec.rb
555
567
  - spec/unit/provides_map_spec.rb
556
568
  - spec/unit/runner_spec.rb
@@ -572,13 +584,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
572
584
  version: 2.0.0
573
585
  required_rubygems_version: !ruby/object:Gem::Requirement
574
586
  requirements:
575
- - - ">"
587
+ - - ">="
576
588
  - !ruby/object:Gem::Version
577
- version: 1.3.1
589
+ version: '0'
578
590
  requirements: []
579
591
  rubyforge_project:
580
- rubygems_version: 2.4.4
592
+ rubygems_version: 2.4.5
581
593
  signing_key:
582
594
  specification_version: 4
583
595
  summary: Ohai profiles your system and emits JSON
584
596
  test_files: []
597
+ has_rdoc: