ohai 8.8.1 → 8.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -0
  3. data/README.md +1 -1
  4. data/Rakefile +6 -0
  5. data/bin/ohai +2 -2
  6. data/lib/ohai.rb +4 -4
  7. data/lib/ohai/config.rb +2 -2
  8. data/lib/ohai/dsl.rb +2 -2
  9. data/lib/ohai/dsl/plugin.rb +3 -3
  10. data/lib/ohai/dsl/plugin/versionvi.rb +3 -3
  11. data/lib/ohai/dsl/plugin/versionvii.rb +2 -2
  12. data/lib/ohai/exception.rb +2 -2
  13. data/lib/ohai/hints.rb +2 -2
  14. data/lib/ohai/loader.rb +1 -1
  15. data/lib/ohai/log.rb +2 -2
  16. data/lib/ohai/mixin/command.rb +2 -2
  17. data/lib/ohai/mixin/constant_helper.rb +2 -2
  18. data/lib/ohai/mixin/dmi_decode.rb +1 -1
  19. data/lib/ohai/mixin/ec2_metadata.rb +3 -3
  20. data/lib/ohai/mixin/network_constants.rb +4 -4
  21. data/lib/ohai/mixin/os.rb +2 -2
  22. data/lib/ohai/mixin/seconds_to_human.rb +4 -4
  23. data/lib/ohai/mixin/string.rb +4 -4
  24. data/lib/ohai/plugin_config.rb +1 -1
  25. data/lib/ohai/plugins/aix/cpu.rb +35 -29
  26. data/lib/ohai/plugins/aix/filesystem.rb +58 -40
  27. data/lib/ohai/plugins/aix/kernel.rb +3 -2
  28. data/lib/ohai/plugins/aix/memory.rb +4 -3
  29. data/lib/ohai/plugins/aix/network.rb +6 -4
  30. data/lib/ohai/plugins/aix/os.rb +30 -0
  31. data/lib/ohai/plugins/aix/platform.rb +3 -2
  32. data/lib/ohai/plugins/aix/uptime.rb +3 -2
  33. data/lib/ohai/plugins/aix/virtualization.rb +115 -5
  34. data/lib/ohai/plugins/azure.rb +1 -1
  35. data/lib/ohai/plugins/bsd/filesystem.rb +1 -1
  36. data/lib/ohai/plugins/command.rb +4 -4
  37. data/lib/ohai/plugins/darwin/cpu.rb +5 -3
  38. data/lib/ohai/plugins/darwin/filesystem.rb +4 -4
  39. data/lib/ohai/plugins/darwin/filesystem2.rb +4 -4
  40. data/lib/ohai/plugins/darwin/memory.rb +6 -5
  41. data/lib/ohai/plugins/darwin/network.rb +2 -2
  42. data/lib/ohai/plugins/darwin/platform.rb +2 -2
  43. data/lib/ohai/plugins/darwin/system_profiler.rb +2 -2
  44. data/lib/ohai/plugins/dragonflybsd/os.rb +2 -2
  45. data/lib/ohai/plugins/ec2.rb +3 -3
  46. data/lib/ohai/plugins/erlang.rb +3 -3
  47. data/lib/ohai/plugins/eucalyptus.rb +3 -3
  48. data/lib/ohai/plugins/freebsd/cpu.rb +8 -4
  49. data/lib/ohai/plugins/freebsd/os.rb +2 -2
  50. data/lib/ohai/plugins/hostname.rb +12 -4
  51. data/lib/ohai/plugins/init_package.rb +2 -8
  52. data/lib/ohai/plugins/java.rb +2 -2
  53. data/lib/ohai/plugins/kernel.rb +5 -4
  54. data/lib/ohai/plugins/keys.rb +3 -3
  55. data/lib/ohai/plugins/languages.rb +4 -4
  56. data/lib/ohai/plugins/linux/block_device.rb +3 -3
  57. data/lib/ohai/plugins/linux/cpu.rb +2 -2
  58. data/lib/ohai/plugins/linux/filesystem.rb +2 -2
  59. data/lib/ohai/plugins/linux/filesystem2.rb +3 -3
  60. data/lib/ohai/plugins/linux/lsb.rb +2 -2
  61. data/lib/ohai/plugins/linux/memory.rb +2 -2
  62. data/lib/ohai/plugins/linux/network.rb +141 -59
  63. data/lib/ohai/plugins/linux/platform.rb +6 -1
  64. data/lib/ohai/plugins/linux/virtualization.rb +1 -1
  65. data/lib/ohai/plugins/network.rb +49 -42
  66. data/lib/ohai/plugins/ohai_time.rb +4 -4
  67. data/lib/ohai/plugins/openstack.rb +2 -2
  68. data/lib/ohai/plugins/os.rb +2 -2
  69. data/lib/ohai/plugins/packages.rb +122 -0
  70. data/lib/ohai/plugins/perl.rb +5 -5
  71. data/lib/ohai/plugins/platform.rb +2 -2
  72. data/lib/ohai/plugins/powershell.rb +2 -2
  73. data/lib/ohai/plugins/ps.rb +2 -2
  74. data/lib/ohai/plugins/python.rb +1 -1
  75. data/lib/ohai/plugins/rackspace.rb +13 -0
  76. data/lib/ohai/plugins/ruby.rb +6 -6
  77. data/lib/ohai/plugins/sigar/network_route.rb +1 -1
  78. data/lib/ohai/plugins/solaris2/filesystem.rb +1 -1
  79. data/lib/ohai/plugins/solaris2/network.rb +1 -1
  80. data/lib/ohai/plugins/solaris2/platform.rb +1 -1
  81. data/lib/ohai/plugins/solaris2/virtualization.rb +5 -5
  82. data/lib/ohai/plugins/solaris2/zpools.rb +2 -2
  83. data/lib/ohai/plugins/ssh_host_key.rb +2 -2
  84. data/lib/ohai/plugins/uptime.rb +4 -4
  85. data/lib/ohai/plugins/virtualbox.rb +1 -1
  86. data/lib/ohai/plugins/virtualization.rb +7 -7
  87. data/lib/ohai/plugins/vmware.rb +1 -1
  88. data/lib/ohai/plugins/windows/filesystem.rb +1 -1
  89. data/lib/ohai/plugins/windows/network.rb +1 -1
  90. data/lib/ohai/plugins/windows/platform.rb +1 -1
  91. data/lib/ohai/plugins/windows/virtualization.rb +1 -1
  92. data/lib/ohai/provides_map.rb +3 -3
  93. data/lib/ohai/runner.rb +2 -2
  94. data/lib/ohai/system.rb +2 -2
  95. data/lib/ohai/util/file_helper.rb +1 -1
  96. data/lib/ohai/util/win32.rb +1 -1
  97. data/lib/ohai/util/win32/group_helper.rb +1 -1
  98. data/lib/ohai/version.rb +3 -3
  99. data/spec/data/plugins/dpkg-query.output +1087 -0
  100. data/spec/data/plugins/lslpp.output +49 -0
  101. data/spec/data/plugins/pkginfo.output +50 -0
  102. data/spec/data/plugins/pkglist.output +24 -0
  103. data/spec/data/plugins/rpmquery.output +388 -0
  104. data/spec/functional/application_spec.rb +1 -1
  105. data/spec/functional/loader_spec.rb +1 -1
  106. data/spec/functional/plugins/powershell_spec.rb +1 -1
  107. data/spec/functional/plugins/root_group_spec.rb +2 -2
  108. data/spec/ohai_spec.rb +6 -6
  109. data/spec/unit/application_spec.rb +1 -1
  110. data/spec/unit/config_spec.rb +1 -1
  111. data/spec/unit/dsl/plugin_spec.rb +2 -2
  112. data/spec/unit/hints_spec.rb +2 -2
  113. data/spec/unit/loader_spec.rb +2 -2
  114. data/spec/unit/mixin/ec2_metadata_spec.rb +1 -1
  115. data/spec/unit/plugin_config_spec.rb +1 -1
  116. data/spec/unit/plugins/aix/cpu_spec.rb +68 -40
  117. data/spec/unit/plugins/aix/filesystem_spec.rb +152 -50
  118. data/spec/unit/plugins/aix/hostname_spec.rb +5 -3
  119. data/spec/unit/plugins/aix/kernel_spec.rb +2 -1
  120. data/spec/unit/plugins/aix/memory_spec.rb +7 -5
  121. data/spec/unit/plugins/aix/network_spec.rb +17 -1
  122. data/spec/unit/plugins/aix/os_spec.rb +35 -0
  123. data/spec/unit/plugins/aix/platform_spec.rb +5 -4
  124. data/spec/unit/plugins/aix/uptime_spec.rb +2 -1
  125. data/spec/unit/plugins/aix/virtualization_spec.rb +269 -3
  126. data/spec/unit/plugins/azure_spec.rb +1 -1
  127. data/spec/unit/plugins/bsd/filesystem_spec.rb +1 -1
  128. data/spec/unit/plugins/bsd/virtualization_spec.rb +2 -2
  129. data/spec/unit/plugins/chef_spec.rb +8 -8
  130. data/spec/unit/plugins/darwin/cpu_spec.rb +8 -3
  131. data/spec/unit/plugins/darwin/hostname_spec.rb +2 -2
  132. data/spec/unit/plugins/darwin/kernel_spec.rb +4 -4
  133. data/spec/unit/plugins/darwin/memory_spec.rb +1 -1
  134. data/spec/unit/plugins/darwin/network_spec.rb +1 -1
  135. data/spec/unit/plugins/darwin/platform_spec.rb +6 -6
  136. data/spec/unit/plugins/darwin/system_profiler_output.rb +0 -1
  137. data/spec/unit/plugins/darwin/system_profiler_spec.rb +4 -4
  138. data/spec/unit/plugins/ec2_spec.rb +3 -3
  139. data/spec/unit/plugins/erlang_spec.rb +3 -3
  140. data/spec/unit/plugins/eucalyptus_spec.rb +2 -2
  141. data/spec/unit/plugins/fail_spec.rb +6 -6
  142. data/spec/unit/plugins/freebsd/cpu_spec.rb +19 -4
  143. data/spec/unit/plugins/freebsd/hostname_spec.rb +2 -2
  144. data/spec/unit/plugins/freebsd/kernel_spec.rb +4 -4
  145. data/spec/unit/plugins/freebsd/platform_spec.rb +7 -7
  146. data/spec/unit/plugins/hostname_spec.rb +2 -2
  147. data/spec/unit/plugins/init_package_spec.rb +12 -2
  148. data/spec/unit/plugins/java_spec.rb +5 -5
  149. data/spec/unit/plugins/kernel_spec.rb +4 -2
  150. data/spec/unit/plugins/linux/block_device_spec.rb +75 -0
  151. data/spec/unit/plugins/linux/cpu_spec.rb +2 -2
  152. data/spec/unit/plugins/linux/filesystem2_spec.rb +14 -14
  153. data/spec/unit/plugins/linux/filesystem_spec.rb +1 -1
  154. data/spec/unit/plugins/linux/hostname_spec.rb +2 -2
  155. data/spec/unit/plugins/linux/kernel_spec.rb +5 -5
  156. data/spec/unit/plugins/linux/lsb_spec.rb +17 -17
  157. data/spec/unit/plugins/linux/network_spec.rb +80 -11
  158. data/spec/unit/plugins/linux/platform_spec.rb +20 -1
  159. data/spec/unit/plugins/linux/uptime_spec.rb +8 -8
  160. data/spec/unit/plugins/linux/virtualization_spec.rb +1 -1
  161. data/spec/unit/plugins/lua_spec.rb +2 -2
  162. data/spec/unit/plugins/netbsd/hostname_spec.rb +2 -2
  163. data/spec/unit/plugins/netbsd/kernel_spec.rb +2 -2
  164. data/spec/unit/plugins/netbsd/platform_spec.rb +2 -2
  165. data/spec/unit/plugins/network_spec.rb +110 -37
  166. data/spec/unit/plugins/nodejs_spec.rb +2 -2
  167. data/spec/unit/plugins/ohai_spec.rb +5 -5
  168. data/spec/unit/plugins/ohai_time_spec.rb +8 -8
  169. data/spec/unit/plugins/openbsd/hostname_spec.rb +2 -2
  170. data/spec/unit/plugins/openbsd/kernel_spec.rb +4 -4
  171. data/spec/unit/plugins/openbsd/platform_spec.rb +6 -6
  172. data/spec/unit/plugins/openstack_spec.rb +2 -2
  173. data/spec/unit/plugins/os_spec.rb +11 -11
  174. data/spec/unit/plugins/packages_spec.rb +241 -0
  175. data/spec/unit/plugins/perl_spec.rb +3 -3
  176. data/spec/unit/plugins/php_spec.rb +2 -2
  177. data/spec/unit/plugins/platform_spec.rb +2 -2
  178. data/spec/unit/plugins/python_spec.rb +3 -3
  179. data/spec/unit/plugins/rackspace_spec.rb +7 -0
  180. data/spec/unit/plugins/ruby_spec.rb +3 -3
  181. data/spec/unit/plugins/sigar/network_route_spec.rb +1 -1
  182. data/spec/unit/plugins/solaris2/cpu_spec.rb +1 -1
  183. data/spec/unit/plugins/solaris2/filesystem.rb +1 -1
  184. data/spec/unit/plugins/solaris2/network_spec.rb +3 -3
  185. data/spec/unit/plugins/solaris2/platform_spec.rb +5 -5
  186. data/spec/unit/plugins/solaris2/virtualization_spec.rb +1 -1
  187. data/spec/unit/plugins/ssh_host_keys_spec.rb +2 -2
  188. data/spec/unit/plugins/virtualbox_spec.rb +1 -1
  189. data/spec/unit/plugins/windows/virtualization_spec.rb +1 -1
  190. data/spec/unit/provides_map_spec.rb +2 -2
  191. data/spec/unit/runner_spec.rb +2 -2
  192. data/spec/unit/system_spec.rb +3 -3
  193. data/spec/unit/util/file_helper_spec.rb +1 -1
  194. metadata +13 -3
@@ -1,6 +1,7 @@
1
1
  #
2
2
  # Author:: Prabhu Das (<prabhu.das@clogeny.com>)
3
- # Copyright:: Copyright (c) 2013 Opscode, Inc.
3
+ # Author:: Isa Farnik (<isa@chef.io>)
4
+ # Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
4
5
  # License:: Apache License, Version 2.0
5
6
  #
6
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,11 +18,12 @@
17
18
 
18
19
  require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
19
20
 
20
- describe Ohai::System, "Aix hostname plugin" do
21
+ describe Ohai::System, "AIX hostname plugin" do
21
22
  before(:each) do
22
23
  @plugin = get_plugin("hostname")
23
24
  allow(@plugin).to receive(:collect_os).and_return(:aix)
24
- allow(@plugin).to receive(:from_cmd).with("hostname").and_return("aix_admin")
25
+ allow(@plugin).to receive(:from_cmd).with("hostname -s").and_return("aix_admin")
26
+ allow(@plugin).to receive(:from_cmd).with("hostname").and_return("aix_admin.ponyville.com")
25
27
  @plugin.run
26
28
  end
27
29
 
@@ -1,6 +1,7 @@
1
1
  #
2
2
  # Author:: Prabhu Das (<prabhu.das@clogeny.com>)
3
- # Copyright:: Copyright (c) 2013 Opscode, Inc.
3
+ # Author:: Isa Farnik (<isa@chef.io>)
4
+ # Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
4
5
  # License:: Apache License, Version 2.0
5
6
  #
6
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,4 +1,6 @@
1
1
  #
2
+ # Author:: Isa Farnik (<isa@chef.io>)
3
+ # Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
2
4
  # License:: Apache License, Version 2.0
3
5
  #
4
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,25 +25,25 @@ describe Ohai::System, "AIX memory plugin" do
23
25
  allow(@plugin).to receive(:shell_out).with("svmon -G -O unit=MB,summary=longreal | grep '[0-9]'").and_return(mock_shell_out(0, " 513280.00 340034.17 173245.83 62535.17 230400.05 276950.14 70176.00\n", nil))
24
26
  @swap_s = "allocated = 23887872 blocks used = 288912 blocks free = 23598960 blocks\n"
25
27
  allow(@plugin).to receive(:shell_out).with("swap -s").and_return(mock_shell_out(0,@swap_s, nil))
26
- end
28
+ end
27
29
 
28
30
  it "should get total memory" do
29
31
  @plugin.run
30
32
  expect(@plugin['memory']['total']).to eql("#{513280 * 1024}kB")
31
33
  end
32
-
34
+
33
35
  it "should get free memory" do
34
36
  @plugin.run
35
37
  expect(@plugin['memory']['free']).to eql("#{173245.83.to_i * 1024}kB")
36
38
  end
37
-
39
+
38
40
  it "should get total swap" do
39
41
  @plugin.run
40
42
  expect(@plugin['memory']['swap']['total']).to eql( "#{23887872 * 4}kB")
41
43
  end
42
-
44
+
43
45
  it "should get free swap" do
44
46
  @plugin.run
45
47
  expect(@plugin['memory']['swap']['free']).to eql( "#{23598960 * 4}kB")
46
48
  end
47
- end
49
+ end
@@ -1,6 +1,7 @@
1
1
  #
2
2
  # Author:: Prabhu Das (<prabhu.das@clogeny.com>)
3
- # Copyright:: Copyright (c) 2013 Opscode, Inc.
3
+ # Author:: Isa Farnik (<isa@chef.io>)
4
+ # Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
4
5
  # License:: Apache License, Version 2.0
5
6
  #
6
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -106,6 +107,17 @@ ARP_AN
106
107
  end
107
108
 
108
109
  describe "when running on an LPAR" do
110
+
111
+ describe "sets the top-level attribute correctly" do
112
+ before do
113
+ @plugin.run
114
+ end
115
+
116
+ it 'for \'macaddress\'' do
117
+ expect(@plugin[:macaddress]).to eq("BE:42:80:00:B0:05")
118
+ end
119
+ end
120
+
109
121
  describe "netstat -rn |grep default" do
110
122
  before do
111
123
  @plugin.run
@@ -134,6 +146,10 @@ ARP_AN
134
146
  it "avoids collecting default interface" do
135
147
  expect(@plugin[:network][:default_gateway]).to be_nil
136
148
  end
149
+
150
+ it "avoids collecting a macaddress" do
151
+ expect(@plugin[:macaddress]).to be_nil
152
+ end
137
153
  end
138
154
 
139
155
  describe "lsdev -Cc if" do
@@ -0,0 +1,35 @@
1
+ #
2
+ # Author:: Isa Farnik (<isa@chef.io>)
3
+ # Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
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
+ require File.expand_path(File.dirname(__FILE__) + '/../../../spec_helper.rb')
19
+
20
+ describe Ohai::System, "AIX os plugin" do
21
+ before(:each) do
22
+ @plugin = get_plugin("aix/os")
23
+ kernel = Mash.new
24
+ kernel[:version] = "6"
25
+ kernel[:release] = "1"
26
+ allow(@plugin).to receive(:collect_os).and_return(:aix)
27
+ allow(@plugin).to receive(:kernel).and_return(kernel)
28
+ @plugin.run
29
+ end
30
+
31
+ it "should set the top-level os_level attribute" do
32
+ expect(@plugin[:os_version]).to eql("6")
33
+ end
34
+ end
35
+
@@ -1,6 +1,7 @@
1
1
  #
2
2
  # Author:: Prabhu Das (<prabhu.das@clogeny.com>)
3
- # Copyright:: Copyright (c) 2013 Opscode, Inc.
3
+ # Author:: Isa Farnik (<isa@chef.io>)
4
+ # Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
4
5
  # License:: Apache License, Version 2.0
5
6
  #
6
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,8 +24,8 @@ describe Ohai::System, "Aix plugin platform" do
23
24
  allow(@plugin).to receive(:collect_os).and_return(:aix)
24
25
  kernel = Mash.new
25
26
  kernel[:name] = "aix"
26
- kernel[:version] = "1"
27
- kernel[:release] = "0"
27
+ kernel[:version] = "7"
28
+ kernel[:release] = "1"
28
29
  allow(@plugin).to receive(:kernel).and_return(kernel)
29
30
  @plugin.run
30
31
  end
@@ -34,7 +35,7 @@ describe Ohai::System, "Aix plugin platform" do
34
35
  end
35
36
 
36
37
  it "should set the platform_version" do
37
- expect(@plugin[:platform_version]).to eq("1.0")
38
+ expect(@plugin[:platform_version]).to eq("7.1")
38
39
  end
39
40
 
40
41
  it "should set platform_family" do
@@ -1,6 +1,7 @@
1
1
  #
2
2
  # Author:: Prabhu Das (<prabhu.das@clogeny.com>)
3
- # Copyright:: Copyright (c) 2013 Opscode, Inc.
3
+ # Author:: Isa Farnik (<isa@chef.io>)
4
+ # Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
4
5
  # License:: Apache License, Version 2.0
5
6
  #
6
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,6 +1,7 @@
1
1
  #
2
- # Author:: Julian C. Dunn (<jdunn@getchef.com>)
3
- # Copyright:: Copyright (c) 2014 Chef Software, Inc.
2
+ # Author:: Julian C. Dunn (<jdunn@chef.iom>)
3
+ # Author:: Isa Farnik (<isa@chef.io>)
4
+ # Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
4
5
  # License:: Apache License, Version 2.0
5
6
  #
6
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,19 +21,284 @@ require 'spec_helper'
20
21
  describe Ohai::System, "AIX virtualization plugin" do
21
22
 
22
23
  context "inside an LPAR" do
24
+
23
25
  let(:plugin) do
24
26
  p = get_plugin("aix/virtualization")
25
27
  allow(p).to receive(:collect_os).and_return(:aix)
26
28
  allow(p).to receive(:shell_out).with("uname -L").and_return(mock_shell_out(0, "29 l273pp027", nil))
27
29
  allow(p).to receive(:shell_out).with("uname -W").and_return(mock_shell_out(0, "0", nil))
28
- p.run
30
+ allow(p).to receive(:shell_out).with("lswpar -L").and_return(mock_shell_out(0, @lswpar_L, nil))
29
31
  p
30
32
  end
31
33
 
34
+ before(:each) do
35
+ @lswpar_L = <<-LSWPAR_L
36
+ =================================================================
37
+ applejack-541ba3 - Active
38
+ =================================================================
39
+ GENERAL
40
+ Type: S
41
+ RootVG WPAR: no
42
+ Owner: root
43
+ Hostname: applejack-pony-541ba3.ponyville.com
44
+ WPAR-Specific Routing: yes
45
+ Virtual IP WPAR:
46
+ Directory: /wpars/applejack-541ba3
47
+ Start/Stop Script:
48
+ Auto: no
49
+ Private /usr: yes
50
+ Checkpointable: no
51
+ Application:
52
+ UUID: 541ba314-c7ca-4f67-bc6e-a10d5eaa8541
53
+
54
+ NETWORK
55
+ Interface Address(6) Mask/Prefix Broadcast
56
+ -----------------------------------------------------------------
57
+ en0 192.168.0.231 255.255.252.0 192.168.0.255
58
+ lo0 127.0.0.1 255.0.0.0 127.255.255.255
59
+
60
+ USER-SPECIFIED ROUTES
61
+ Type Destination Gateway Interface
62
+ -----------------------------------------------------------------
63
+ default 192.168.0.1 en0
64
+
65
+ FILE SYSTEMS
66
+ MountPoint Device Vfs Nodename Options
67
+ -----------------------------------------------------------------
68
+ /wpars/sink-thinker-5... /dev/fslv00 jfs2 log=NULL
69
+ /wpars/sink-thinker-5... /dev/fslv01 jfs2 log=NULL
70
+ /wpars/sink-thinker-5... /dev/fslv02 jfs2 log=NULL
71
+ /wpars/sink-thinker-5... /proc namefs rw
72
+ /wpars/sink-thinker-5... /dev/fslv03 jfs2 log=NULL
73
+ /wpars/sink-thinker-5... /dev/fslv04 jfs2 log=NULL
74
+ /wpars/sink-thinker-5... /dev/fslv05 jfs2 log=NULL
75
+
76
+ RESOURCE CONTROLS
77
+ Active: yes
78
+ Resource Set:
79
+ CPU Shares: unlimited
80
+ CPU Limits: 0%-100%,100%
81
+ Memory Shares: unlimited
82
+ Memory Limits: 0%-100%,100%
83
+ Per-Process Virtual Memory Limit: unlimited
84
+ Total Virtual Memory Limit: unlimited
85
+ Total Processes: unlimited
86
+ Total Threads: unlimited
87
+ Total PTYs: unlimited
88
+ Total Large Pages: unlimited
89
+ Max Message Queue IDs: 100%
90
+ Max Semaphore IDs: 100%
91
+ Max Shared Memory IDs: 100%
92
+ Max Pinned Memory: 100%
93
+
94
+ OPERATION
95
+ Operation: none
96
+ Process ID:
97
+ Start Time:
98
+
99
+ SECURITY SETTINGS
100
+ Privileges: PV_AU_,PV_AU_ADD,PV_AU_ADMIN,PV_AU_PROC,PV_AU_READ,
101
+ PV_AU_WRITE,PV_AZ_ADMIN,PV_AZ_CHECK,PV_AZ_READ,PV_AZ_ROOT,
102
+ PV_DAC_,PV_DAC_GID,PV_DAC_O,PV_DAC_R,PV_DAC_RID,PV_DAC_UID,
103
+ PV_DAC_W,PV_DAC_X,PV_DEV_CONFIG,PV_DEV_QUERY,PV_FS_CHOWN,
104
+ PV_FS_CHROOT,PV_FS_CNTL,PV_FS_LINKDIR,PV_FS_MKNOD,
105
+ PV_FS_MOUNT,PV_FS_PDMODE,PV_FS_QUOTA,PV_KER_ACCT,
106
+ PV_KER_CONF,PV_KER_DR,PV_KER_EWLM,PV_KER_EXTCONF,
107
+ PV_KER_IPC,PV_KER_IPC_O,PV_KER_IPC_R,PV_KER_IPC_W,
108
+ PV_KER_NFS,PV_KER_RAC,PV_KER_RAS_ERR,PV_KER_REBOOT,
109
+ PV_NET_PORT,PV_PROC_CKPT,PV_PROC_CORE,PV_PROC_CRED,
110
+ PV_PROC_ENV,PV_PROC_PRIO,PV_PROC_PDMODE,PV_PROC_RAC,
111
+ PV_PROC_RTCLK,PV_PROC_SIG,PV_PROC_TIMER,PV_PROC_VARS,
112
+ PV_PROC_PRIV,PV_SU_UID,PV_TCB,PV_TP,PV_TP_SET,PV_MIC,
113
+ PV_MIC_CL,PV_LAB_,PV_LAB_CL,PV_LAB_CLTL,PV_LAB_LEF,
114
+ PV_LAB_SLDG,PV_LAB_SLDG_STR,PV_LAB_SL_FILE,PV_LAB_SL_PROC,
115
+ PV_LAB_SL_SELF,PV_LAB_SLUG,PV_LAB_SLUG_STR,PV_LAB_TL,
116
+ PV_MAC_,PV_MAC_CL,PV_MAC_R,PV_MAC_R_CL,PV_MAC_R_STR,
117
+ PV_MAC_R_PROC,PV_MAC_W,PV_MAC_W_CL,PV_MAC_W_DN,PV_MAC_W_UP,
118
+ PV_MAC_W_PROC,PV_MAC_OVRRD,PV_KER_SECCONFIG,
119
+ PV_PROBEVUE_TRC_USER,PV_PROBEVUE_TRC_USER_SELF,PV_KER_LVM
120
+
121
+ DEVICE EXPORTS
122
+ Name Type Virtual Device RootVG Status
123
+ -----------------------------------------------------------------
124
+ /dev/null pseudo EXPORTED
125
+ /dev/tty pseudo EXPORTED
126
+ /dev/console pseudo EXPORTED
127
+ /dev/zero pseudo EXPORTED
128
+ /dev/clone pseudo EXPORTED
129
+ /dev/sad clone EXPORTED
130
+ /dev/xti/tcp clone EXPORTED
131
+ /dev/xti/tcp6 clone EXPORTED
132
+ /dev/xti/udp clone EXPORTED
133
+ /dev/xti/udp6 clone EXPORTED
134
+ /dev/xti/unixdg clone EXPORTED
135
+ /dev/xti/unixst clone EXPORTED
136
+ /dev/error pseudo EXPORTED
137
+ /dev/errorctl pseudo EXPORTED
138
+ /dev/audit pseudo EXPORTED
139
+ /dev/nvram pseudo EXPORTED
140
+
141
+ =================================================================
142
+ fluttershy-5c969f - Active
143
+ =================================================================
144
+ GENERAL
145
+ Type: S
146
+ RootVG WPAR: no
147
+ Owner: root
148
+ Hostname: fluttershy-pony-5c969f.ponyville.com
149
+ WPAR-Specific Routing: yes
150
+ Virtual IP WPAR:
151
+ Directory: /wpars/fluttershy-5c969f
152
+ Start/Stop Script:
153
+ Auto: no
154
+ Private /usr: yes
155
+ Checkpointable: no
156
+ Application:
157
+ UUID: 6f1fd4be-8be5-4627-8ec0-3a8739cbd9e2
158
+
159
+ NETWORK
160
+ Interface Address(6) Mask/Prefix Broadcast
161
+ -----------------------------------------------------------------
162
+ en0 192.168.0.18 255.255.252.0 192.168.0.255
163
+ lo0 127.0.0.1 255.0.0.0 127.255.255.255
164
+
165
+ USER-SPECIFIED ROUTES
166
+ Type Destination Gateway Interface
167
+ -----------------------------------------------------------------
168
+ default 192.168.0.1 en0
169
+
170
+ FILE SYSTEMS
171
+ MountPoint Device Vfs Nodename Options
172
+ -----------------------------------------------------------------
173
+ /wpars/toolchain-test... /dev/fslv07 jfs2 log=NULL
174
+ /wpars/toolchain-test... /dev/fslv08 jfs2 log=NULL
175
+ /wpars/toolchain-test... /dev/fslv09 jfs2 log=NULL
176
+ /wpars/toolchain-test... /proc namefs rw
177
+ /wpars/toolchain-test... /dev/fslv10 jfs2 log=NULL
178
+ /wpars/toolchain-test... /dev/fslv11 jfs2 log=NULL
179
+ /wpars/toolchain-test... /dev/fslv12 jfs2 log=NULL
180
+
181
+ RESOURCE CONTROLS
182
+ Active: yes
183
+ Resource Set:
184
+ CPU Shares: unlimited
185
+ CPU Limits: 0%-100%,100%
186
+ Memory Shares: unlimited
187
+ Memory Limits: 0%-100%,100%
188
+ Per-Process Virtual Memory Limit: unlimited
189
+ Total Virtual Memory Limit: unlimited
190
+ Total Processes: unlimited
191
+ Total Threads: unlimited
192
+ Total PTYs: unlimited
193
+ Total Large Pages: unlimited
194
+ Max Message Queue IDs: 100%
195
+ Max Semaphore IDs: 100%
196
+ Max Shared Memory IDs: 100%
197
+ Max Pinned Memory: 100%
198
+
199
+ OPERATION
200
+ Operation: none
201
+ Process ID:
202
+ Start Time:
203
+
204
+ SECURITY SETTINGS
205
+ Privileges: PV_AU_,PV_AU_ADD,PV_AU_ADMIN,PV_AU_PROC,PV_AU_READ,
206
+ PV_AU_WRITE,PV_AZ_ADMIN,PV_AZ_CHECK,PV_AZ_READ,PV_AZ_ROOT,
207
+ PV_DAC_,PV_DAC_GID,PV_DAC_O,PV_DAC_R,PV_DAC_RID,PV_DAC_UID,
208
+ PV_DAC_W,PV_DAC_X,PV_DEV_CONFIG,PV_DEV_QUERY,PV_FS_CHOWN,
209
+ PV_FS_CHROOT,PV_FS_CNTL,PV_FS_LINKDIR,PV_FS_MKNOD,
210
+ PV_FS_MOUNT,PV_FS_PDMODE,PV_FS_QUOTA,PV_KER_ACCT,
211
+ PV_KER_CONF,PV_KER_DR,PV_KER_EWLM,PV_KER_EXTCONF,
212
+ PV_KER_IPC,PV_KER_IPC_O,PV_KER_IPC_R,PV_KER_IPC_W,
213
+ PV_KER_NFS,PV_KER_RAC,PV_KER_RAS_ERR,PV_KER_REBOOT,
214
+ PV_NET_PORT,PV_PROC_CKPT,PV_PROC_CORE,PV_PROC_CRED,
215
+ PV_PROC_ENV,PV_PROC_PRIO,PV_PROC_PDMODE,PV_PROC_RAC,
216
+ PV_PROC_RTCLK,PV_PROC_SIG,PV_PROC_TIMER,PV_PROC_VARS,
217
+ PV_PROC_PRIV,PV_SU_UID,PV_TCB,PV_TP,PV_TP_SET,PV_MIC,
218
+ PV_MIC_CL,PV_LAB_,PV_LAB_CL,PV_LAB_CLTL,PV_LAB_LEF,
219
+ PV_LAB_SLDG,PV_LAB_SLDG_STR,PV_LAB_SL_FILE,PV_LAB_SL_PROC,
220
+ PV_LAB_SL_SELF,PV_LAB_SLUG,PV_LAB_SLUG_STR,PV_LAB_TL,
221
+ PV_MAC_,PV_MAC_CL,PV_MAC_R,PV_MAC_R_CL,PV_MAC_R_STR,
222
+ PV_MAC_R_PROC,PV_MAC_W,PV_MAC_W_CL,PV_MAC_W_DN,PV_MAC_W_UP,
223
+ PV_MAC_W_PROC,PV_MAC_OVRRD,PV_KER_SECCONFIG,
224
+ PV_PROBEVUE_TRC_USER,PV_PROBEVUE_TRC_USER_SELF,PV_KER_LVM
225
+
226
+ DEVICE EXPORTS
227
+ Name Type Virtual Device RootVG Status
228
+ -----------------------------------------------------------------
229
+ /dev/null pseudo EXPORTED
230
+ /dev/tty pseudo EXPORTED
231
+ /dev/console pseudo EXPORTED
232
+ /dev/zero pseudo EXPORTED
233
+ /dev/clone pseudo EXPORTED
234
+ /dev/sad clone EXPORTED
235
+ /dev/xti/tcp clone EXPORTED
236
+ /dev/xti/tcp6 clone EXPORTED
237
+ /dev/xti/udp clone EXPORTED
238
+ /dev/xti/udp6 clone EXPORTED
239
+ /dev/xti/unixdg clone EXPORTED
240
+ /dev/xti/unixst clone EXPORTED
241
+ /dev/error pseudo EXPORTED
242
+ /dev/errorctl pseudo EXPORTED
243
+ /dev/audit pseudo EXPORTED
244
+ /dev/nvram pseudo EXPORTED
245
+
246
+
247
+ LSWPAR_L
248
+
249
+ end
250
+
32
251
  it "uname -L detects the LPAR number and name" do
252
+ plugin.run
33
253
  expect(plugin[:virtualization][:lpar_no]).to eq("29")
34
254
  expect(plugin[:virtualization][:lpar_name]).to eq("l273pp027")
35
255
  end
256
+
257
+ context 'when WPARs exist on the LPAR' do
258
+ before do
259
+ plugin.run
260
+ end
261
+
262
+ let(:wpar1) do
263
+ plugin[:virtualization][:wpars]['applejack-541ba3']
264
+ end
265
+
266
+ let(:wpar2) do
267
+ plugin[:virtualization][:wpars]['fluttershy-5c969f']
268
+ end
269
+
270
+ it 'detects all WPARs present (2)' do
271
+ expect(plugin[:virtualization][:wpars].length).to eq(2)
272
+ end
273
+
274
+ context 'when collecting WPAR info' do
275
+ it 'finds the WPAR\'s hostname correctly' do
276
+ expect(wpar1[:hostname]).to eq("applejack-pony-541ba3.ponyville.com")
277
+ expect(wpar2[:hostname]).to eq("fluttershy-pony-5c969f.ponyville.com")
278
+ end
279
+
280
+ it 'finds the WPAR\'s IP correctly' do
281
+ expect(wpar1[:address]).to eq("192.168.0.231")
282
+ expect(wpar2[:address]).to eq("192.168.0.18")
283
+ end
284
+
285
+ it 'parses device exports properly' do
286
+ expect(wpar1['device exports']['/dev/nvram']['type']).to eq("pseudo")
287
+ expect(wpar1['device exports']['/dev/nvram']['status']).to eq("EXPORTED")
288
+ end
289
+ end
290
+ end
291
+
292
+ context 'when WPARs don\'t exist on the LPAR' do
293
+ before do
294
+ allow(plugin).to receive(:shell_out).with("lswpar -L").and_return(mock_shell_out(0, '', nil))
295
+ plugin.run
296
+ end
297
+
298
+ it 'detects all WPARs present (0)' do
299
+ expect(plugin[:virtualization][:wpars]).to be_nil
300
+ end
301
+ end
36
302
  end
37
303
 
38
304
  context "inside a WPAR" do