ohai 13.9.0 → 13.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ohai/common/dmi.rb +16 -4
- data/lib/ohai/mixin/dmi_decode.rb +2 -0
- data/lib/ohai/plugins/aix/filesystem.rb +1 -1
- data/lib/ohai/plugins/bsd/filesystem2.rb +121 -0
- data/lib/ohai/plugins/dmi.rb +2 -3
- data/lib/ohai/plugins/solaris2/dmi.rb +1 -1
- data/lib/ohai/version.rb +1 -1
- data/spec/unit/plugins/aix/filesystem_spec.rb +10 -10
- data/spec/unit/plugins/bsd/filesystem2_spec.rb +126 -0
- data/spec/unit/plugins/dmi_spec.rb +25 -17
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f400446fd8d86f4e2985744e12ca32a7b85859c7817edf01cdf9e5c79dbc8a1
|
4
|
+
data.tar.gz: 7fc73a4140957c5c78fb3c5a314275c99da0b7615cc5b208f7899727b7004f94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 594b82a931b294a8fdca9eb9bb866013d70e7601bc09bf1e8a99410223470fcb981bc83294092ec4dacb961d9502c80c6451bb1362b1e16300d7bef1950808d7
|
7
|
+
data.tar.gz: 68a89b951d8f5135e94098fef59125ef4fb011b9ec6912efaafcb09a1a069063391e44031714cb2d3e648b01c5697072059d726aefa5ef484d3c7c640244aeaf
|
data/lib/ohai/common/dmi.rb
CHANGED
@@ -72,10 +72,22 @@ module Ohai
|
|
72
72
|
127 => "end_of_table_marker",
|
73
73
|
}
|
74
74
|
|
75
|
-
# list of IDs to collect
|
76
|
-
#
|
75
|
+
# list of IDs to collect from config or default to a sane list that prunes
|
76
|
+
# away some of the less useful IDs
|
77
77
|
ID_TO_CAPTURE = [ 0, 1, 2, 3, 4, 6, 11 ]
|
78
78
|
|
79
|
+
# return the list of DMI IDs to capture
|
80
|
+
def whitelisted_ids
|
81
|
+
if Ohai.config[:additional_dmi_ids]
|
82
|
+
if [ Integer, Array ].include?(Ohai.config[:additional_dmi_ids].class)
|
83
|
+
return ID_TO_CAPTURE + Array(Ohai.config[:additional_dmi_ids])
|
84
|
+
else
|
85
|
+
Ohai::Log.warn("The DMI plugin additional_dmi_ids config must be an array of IDs!")
|
86
|
+
end
|
87
|
+
end
|
88
|
+
ID_TO_CAPTURE
|
89
|
+
end
|
90
|
+
|
79
91
|
# look up DMI ID
|
80
92
|
def id_lookup(id)
|
81
93
|
id = id.to_i
|
@@ -85,7 +97,7 @@ module Ohai
|
|
85
97
|
id = DMI::ID_TO_DESCRIPTION[id]
|
86
98
|
else
|
87
99
|
Ohai::Log.debug("unrecognized header id; falling back to 'unknown'")
|
88
|
-
id = "
|
100
|
+
id = "unknown_dmi_id_#{id}"
|
89
101
|
end
|
90
102
|
rescue
|
91
103
|
Ohai::Log.debug("failed to look up id #{id}, returning unchanged")
|
@@ -122,7 +134,7 @@ module Ohai
|
|
122
134
|
end
|
123
135
|
end
|
124
136
|
|
125
|
-
module_function :id_lookup, :convenience_keys
|
137
|
+
module_function :id_lookup, :convenience_keys, :whitelisted_ids
|
126
138
|
end
|
127
139
|
end
|
128
140
|
end
|
@@ -59,7 +59,7 @@ Ohai.plugin(:Filesystem) do
|
|
59
59
|
else
|
60
60
|
key = fields[0] + ":" + fields[1]
|
61
61
|
oldie[key] ||= Mash.new
|
62
|
-
oldie[key][:mount] = fields[
|
62
|
+
oldie[key][:mount] = fields[2]
|
63
63
|
oldie[key][:fs_type] = fields[3]
|
64
64
|
oldie[key][:mount_options] = fields[7].split(",")
|
65
65
|
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
+
# Author:: Tim Smith (<tsmith@chef.io>)
|
4
|
+
# Author:: Phil Dibowitz (<phil@ipom.com>)
|
5
|
+
# Copyright:: Copyright (c) 2008-2016 Chef Software, Inc.
|
6
|
+
# License:: Apache License, Version 2.0
|
7
|
+
#
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
# you may not use this file except in compliance with the License.
|
10
|
+
# You may obtain a copy of the License at
|
11
|
+
#
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
#
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
# See the License for the specific language governing permissions and
|
18
|
+
# limitations under the License.
|
19
|
+
#
|
20
|
+
|
21
|
+
Ohai.plugin(:Filesystem2) do
|
22
|
+
provides "filesystem2"
|
23
|
+
|
24
|
+
def generate_device_view(fs)
|
25
|
+
view = {}
|
26
|
+
fs.each_value do |entry|
|
27
|
+
view[entry[:device]] = Mash.new unless view[entry[:device]]
|
28
|
+
entry.each do |key, val|
|
29
|
+
next if %w{device mount}.include?(key)
|
30
|
+
view[entry[:device]][key] = val
|
31
|
+
end
|
32
|
+
view[entry[:device]][:mounts] ||= []
|
33
|
+
if entry[:mount]
|
34
|
+
view[entry[:device]][:mounts] << entry[:mount]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
view
|
38
|
+
end
|
39
|
+
|
40
|
+
def generate_mountpoint_view(fs)
|
41
|
+
view = {}
|
42
|
+
fs.each_value do |entry|
|
43
|
+
next unless entry[:mount]
|
44
|
+
view[entry[:mount]] = Mash.new unless view[entry[:mount]]
|
45
|
+
entry.each do |key, val|
|
46
|
+
next if %w{mount device}.include?(key)
|
47
|
+
view[entry[:mount]][key] = val
|
48
|
+
end
|
49
|
+
view[entry[:mount]][:devices] ||= []
|
50
|
+
if entry[:device]
|
51
|
+
view[entry[:mount]][:devices] << entry[:device]
|
52
|
+
end
|
53
|
+
end
|
54
|
+
view
|
55
|
+
end
|
56
|
+
|
57
|
+
collect_data(:freebsd, :openbsd, :netbsd, :dragonflybsd) do
|
58
|
+
fs = Mash.new
|
59
|
+
|
60
|
+
# Grab filesystem data from df
|
61
|
+
so = shell_out("df")
|
62
|
+
so.stdout.lines do |line|
|
63
|
+
case line
|
64
|
+
when /^Filesystem/
|
65
|
+
next
|
66
|
+
when /^(\S+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+\%)\s+(\S+)$/
|
67
|
+
key = "#{$1},#{$6}"
|
68
|
+
fs[key] = Mash.new
|
69
|
+
fs[key][:device] = $1
|
70
|
+
fs[key][:kb_size] = $2
|
71
|
+
fs[key][:kb_used] = $3
|
72
|
+
fs[key][:kb_available] = $4
|
73
|
+
fs[key][:percent_used] = $5
|
74
|
+
fs[key][:mount] = $6
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# inode parsing from 'df -iP'
|
79
|
+
so = shell_out("df -iP")
|
80
|
+
so.stdout.lines do |line|
|
81
|
+
case line
|
82
|
+
when /^Filesystem/ # skip the header
|
83
|
+
next
|
84
|
+
when /^(\S+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\%\s+(\d+)\s+(\d+)\s+(\d+)%\s+(\S+)$/
|
85
|
+
key = "#{$1},#{$9}"
|
86
|
+
fs[key] ||= Mash.new
|
87
|
+
fs[key][:device] = $1
|
88
|
+
fs[key][:inodes_used] = $6
|
89
|
+
fs[key][:inodes_available] = $7
|
90
|
+
fs[key][:total_inodes] = ($6.to_i + $7.to_i).to_s
|
91
|
+
fs[key][:inodes_percent_used] = $8
|
92
|
+
fs[key][:mount] = $9
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
# Grab mount information from mount
|
97
|
+
so = shell_out("mount -l")
|
98
|
+
so.stdout.lines do |line|
|
99
|
+
if line =~ /^(.+?) on (.+?) \((.+?), (.+?)\)$/
|
100
|
+
key = "#{$1},#{$2}"
|
101
|
+
fs[key] ||= Mash.new
|
102
|
+
fs[key][:device] = $1
|
103
|
+
fs[key][:mount] = $2
|
104
|
+
fs[key][:fs_type] = $3
|
105
|
+
fs[key][:mount_options] = $4.split(/,\s*/)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# create views
|
110
|
+
by_pair = fs
|
111
|
+
by_device = generate_device_view(fs)
|
112
|
+
by_mountpoint = generate_mountpoint_view(fs)
|
113
|
+
|
114
|
+
fs_data = Mash.new
|
115
|
+
fs_data["by_device"] = by_device
|
116
|
+
fs_data["by_mountpoint"] = by_mountpoint
|
117
|
+
fs_data["by_pair"] = by_pair
|
118
|
+
|
119
|
+
filesystem2 fs_data
|
120
|
+
end
|
121
|
+
end
|
data/lib/ohai/plugins/dmi.rb
CHANGED
@@ -74,9 +74,8 @@ Ohai.plugin(:DMI) do
|
|
74
74
|
elsif table_location = table_location_line.match(line)
|
75
75
|
dmi[:table_location] = table_location[1]
|
76
76
|
|
77
|
-
elsif handle = handle_line.match(line)
|
78
|
-
|
79
|
-
unless Ohai::Common::DMI::ID_TO_CAPTURE.include?(handle[2].to_i)
|
77
|
+
elsif ( handle = handle_line.match(line) )
|
78
|
+
unless Ohai::Common::DMI.whitelisted_ids.include?(handle[2].to_i)
|
80
79
|
dmi_record = nil
|
81
80
|
next
|
82
81
|
end
|
@@ -129,7 +129,7 @@ Ohai.plugin(:DMI) do
|
|
129
129
|
id = smb_to_id[header_information[3]]
|
130
130
|
|
131
131
|
# Don't overcapture for now (OHAI-260)
|
132
|
-
unless Ohai::Common::DMI
|
132
|
+
unless Ohai::Common::DMI.whitelisted_ids.include?(id)
|
133
133
|
dmi_record = nil
|
134
134
|
next
|
135
135
|
end
|
data/lib/ohai/version.rb
CHANGED
@@ -69,7 +69,7 @@ DF_PK
|
|
69
69
|
/dev/hd11admin /admin jfs2 Jul 17 13:22 rw,log=/dev/hd8
|
70
70
|
/proc /proc procfs Jul 17 13:22 rw
|
71
71
|
/dev/hd10opt /opt jfs2 Jul 17 13:22 rw,log=/dev/hd8
|
72
|
-
192.168.1.11 /stage/
|
72
|
+
192.168.1.11 /stage/middleware1 /stage/middleware2 nfs3 Jul 17 13:24 ro,bg,hard,intr,sec=sys
|
73
73
|
MOUNT
|
74
74
|
|
75
75
|
@mount_wpar = <<-MOUNT
|
@@ -82,7 +82,7 @@ MOUNT
|
|
82
82
|
Global /tmp jfs2 Nov 23 21:03 rw,log=NULL
|
83
83
|
Global /usr jfs2 Nov 23 21:03 rw,log=NULL
|
84
84
|
Global /var jfs2 Nov 23 21:03 rw,log=NULL
|
85
|
-
192.168.1.11 /stage/
|
85
|
+
192.168.1.11 /stage/middleware3 /stage/middleware4 nfs3 Jul 17 13:24 ro,bg,hard,intr,sec=sys
|
86
86
|
MOUNT
|
87
87
|
|
88
88
|
@plugin = get_plugin("aix/filesystem")
|
@@ -134,19 +134,19 @@ MOUNT
|
|
134
134
|
expect(@plugin[:filesystem]["/dev/hd4"]["mount_options"]).to eq(["rw", "log=/dev/hd8"])
|
135
135
|
end
|
136
136
|
|
137
|
-
# For entries like 192.168.1.11 /stage/
|
137
|
+
# For entries like 192.168.1.11 /stage/middleware1 /stage/middleware2 nfs3 Jul 17 13:24 ro,bg,hard,intr,sec=sys
|
138
138
|
context "having node values" do
|
139
139
|
|
140
140
|
it "returns the filesystem mount location" do
|
141
|
-
expect(@plugin[:filesystem]["192.168.1.11:/stage/
|
141
|
+
expect(@plugin[:filesystem]["192.168.1.11:/stage/middleware1"]["mount"]).to eq("/stage/middleware2")
|
142
142
|
end
|
143
143
|
|
144
144
|
it "returns the filesystem type" do
|
145
|
-
expect(@plugin[:filesystem]["192.168.1.11:/stage/
|
145
|
+
expect(@plugin[:filesystem]["192.168.1.11:/stage/middleware1"]["fs_type"]).to eq("nfs3")
|
146
146
|
end
|
147
147
|
|
148
148
|
it "returns the filesystem mount options" do
|
149
|
-
expect(@plugin[:filesystem]["192.168.1.11:/stage/
|
149
|
+
expect(@plugin[:filesystem]["192.168.1.11:/stage/middleware1"]["mount_options"]).to eq(["ro", "bg", "hard", "intr", "sec=sys"])
|
150
150
|
end
|
151
151
|
end
|
152
152
|
end
|
@@ -196,19 +196,19 @@ MOUNT
|
|
196
196
|
expect(@plugin[:filesystem]["Global:/"]["mount_options"]).to eq(["rw", "log=NULL"])
|
197
197
|
end
|
198
198
|
|
199
|
-
# For entries like 192.168.1.11 /stage/
|
199
|
+
# For entries like 192.168.1.11 /stage/middleware3 /stage/middleware4 nfs3 Jul 17 13:24 ro,bg,hard,intr,sec=sys
|
200
200
|
context "having node values" do
|
201
201
|
|
202
202
|
it "returns the filesystem mount location" do
|
203
|
-
expect(@plugin[:filesystem]["192.168.1.11:/stage/
|
203
|
+
expect(@plugin[:filesystem]["192.168.1.11:/stage/middleware3"]["mount"]).to eq("/stage/middleware4")
|
204
204
|
end
|
205
205
|
|
206
206
|
it "returns the filesystem type" do
|
207
|
-
expect(@plugin[:filesystem]["192.168.1.11:/stage/
|
207
|
+
expect(@plugin[:filesystem]["192.168.1.11:/stage/middleware3"]["fs_type"]).to eq("nfs3")
|
208
208
|
end
|
209
209
|
|
210
210
|
it "returns the filesystem mount options" do
|
211
|
-
expect(@plugin[:filesystem]["192.168.1.11:/stage/
|
211
|
+
expect(@plugin[:filesystem]["192.168.1.11:/stage/middleware3"]["mount_options"]).to eq(["ro", "bg", "hard", "intr", "sec=sys"])
|
212
212
|
end
|
213
213
|
end
|
214
214
|
end
|
@@ -0,0 +1,126 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Matthew Kent (<mkent@magoazul.com>)
|
3
|
+
# Author:: Tim Smith (<tsmith@chef.io>)
|
4
|
+
# Copyright:: Copyright (c) 2011-2016 Chef Software, Inc.
|
5
|
+
# License:: Apache License, Version 2.0
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
require_relative "../../../spec_helper.rb"
|
21
|
+
|
22
|
+
describe Ohai::System, "BSD filesystem2 plugin" do
|
23
|
+
let(:plugin) { get_plugin("bsd/filesystem2") }
|
24
|
+
before(:each) do
|
25
|
+
allow(plugin).to receive(:collect_os).and_return(:freebsd)
|
26
|
+
|
27
|
+
allow(plugin).to receive(:shell_out).with("df").and_return(mock_shell_out(0, "", ""))
|
28
|
+
allow(plugin).to receive(:shell_out).with("df -iP").and_return(mock_shell_out(0, "", ""))
|
29
|
+
allow(plugin).to receive(:shell_out).with("mount -l").and_return(mock_shell_out(0, "", ""))
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "when gathering filesystem usage data from df" do
|
33
|
+
before(:each) do
|
34
|
+
@stdout = <<-DF
|
35
|
+
Filesystem 1K-blocks Used Avail Capacity Mounted on
|
36
|
+
/dev/ada0p2 9637788 3313504 5553264 37% /
|
37
|
+
devfs 1 1 0 100% /dev
|
38
|
+
DF
|
39
|
+
allow(plugin).to receive(:shell_out).with("df").and_return(mock_shell_out(0, @stdout, ""))
|
40
|
+
|
41
|
+
@inode_stdout = <<-DFi
|
42
|
+
Filesystem 512-blocks Used Avail Capacity iused ifree %iused Mounted on
|
43
|
+
/dev/ada0p2 15411832 5109256 9069632 36% 252576 790750 24% /
|
44
|
+
devfs 2 2 0 100% 0 0 100% /dev
|
45
|
+
DFi
|
46
|
+
allow(plugin).to receive(:shell_out).with("df -iP").and_return(mock_shell_out(0, @inode_stdout, ""))
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should run df and df -iP" do
|
50
|
+
expect(plugin).to receive(:shell_out).ordered.with("df").and_return(mock_shell_out(0, @stdout, ""))
|
51
|
+
expect(plugin).to receive(:shell_out).ordered.with("df -iP").and_return(mock_shell_out(0, @inode_stdout, ""))
|
52
|
+
plugin.run
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should set kb_size to value from df" do
|
56
|
+
plugin.run
|
57
|
+
expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:kb_size]).to eq("9637788")
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should set kb_used to value from df" do
|
61
|
+
plugin.run
|
62
|
+
expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:kb_used]).to eq("3313504")
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should set kb_available to value from df" do
|
66
|
+
plugin.run
|
67
|
+
expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:kb_available]).to eq("5553264")
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should set percent_used to value from df" do
|
71
|
+
plugin.run
|
72
|
+
expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:percent_used]).to eq("37%")
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should set mount to value from df" do
|
76
|
+
plugin.run
|
77
|
+
expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:mount]).to eq("/")
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should set total_inodes to value from df -iP" do
|
81
|
+
plugin.run
|
82
|
+
expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:total_inodes]).to eq("1043326")
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should set inodes_used to value from df -iP" do
|
86
|
+
plugin.run
|
87
|
+
expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:inodes_used]).to eq("252576")
|
88
|
+
end
|
89
|
+
|
90
|
+
it "should set inodes_available to value from df -iP" do
|
91
|
+
plugin.run
|
92
|
+
expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:inodes_available]).to eq("790750")
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
describe "when gathering mounted filesystem data from mount" do
|
97
|
+
before(:each) do
|
98
|
+
@stdout = <<-MOUNT
|
99
|
+
/dev/ada0p2 on / (ufs, local, journaled soft-updates)
|
100
|
+
devfs on /dev (devfs, local, multilabel)
|
101
|
+
MOUNT
|
102
|
+
allow(plugin).to receive(:shell_out).with("mount -l").and_return(mock_shell_out(0, @stdout, ""))
|
103
|
+
end
|
104
|
+
|
105
|
+
it "should run mount" do
|
106
|
+
expect(plugin).to receive(:shell_out).with("mount -l").and_return(mock_shell_out(0, @stdout, ""))
|
107
|
+
plugin.run
|
108
|
+
end
|
109
|
+
|
110
|
+
it "should set mount to value from mount" do
|
111
|
+
plugin.run
|
112
|
+
expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:mount]).to eq("/")
|
113
|
+
end
|
114
|
+
|
115
|
+
it "should set fs_type to value from mount" do
|
116
|
+
plugin.run
|
117
|
+
expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:fs_type]).to eq("ufs")
|
118
|
+
end
|
119
|
+
|
120
|
+
it "should set mount_options to an array of values from mount" do
|
121
|
+
plugin.run
|
122
|
+
expect(plugin[:filesystem2]["by_pair"]["/dev/ada0p2,/"][:mount_options]).to eq(["local", "journaled soft-updates"])
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
end
|
@@ -101,15 +101,16 @@ Chassis Information
|
|
101
101
|
EOS
|
102
102
|
|
103
103
|
describe Ohai::System, "plugin dmi" do
|
104
|
+
let(:plugin) { get_plugin("dmi") }
|
105
|
+
let(:stdout) { DMI_OUT }
|
106
|
+
|
104
107
|
before(:each) do
|
105
|
-
|
106
|
-
@stdout = DMI_OUT
|
107
|
-
allow(@plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, @stdout, ""))
|
108
|
+
allow(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, stdout, ""))
|
108
109
|
end
|
109
110
|
|
110
|
-
it "
|
111
|
-
expect(
|
112
|
-
|
111
|
+
it "runs dmidecode" do
|
112
|
+
expect(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, stdout, ""))
|
113
|
+
plugin.run
|
113
114
|
end
|
114
115
|
|
115
116
|
# Test some simple sample data
|
@@ -128,21 +129,28 @@ describe Ohai::System, "plugin dmi" do
|
|
128
129
|
},
|
129
130
|
}.each do |id, data|
|
130
131
|
data.each do |attribute, value|
|
131
|
-
it "
|
132
|
-
|
133
|
-
expect(
|
132
|
+
it "attribute [:dmi][:#{id}][:#{attribute}] is set" do
|
133
|
+
plugin.run
|
134
|
+
expect(plugin[:dmi][id][attribute]).to eql(value)
|
134
135
|
end
|
135
|
-
it "
|
136
|
-
|
137
|
-
expect(
|
138
|
-
|
139
|
-
expect(
|
136
|
+
it "attribute [:dmi][:#{id}][:#{attribute}] set for windows output" do
|
137
|
+
stdout = convert_windows_output(DMI_OUT)
|
138
|
+
expect(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, stdout, ""))
|
139
|
+
plugin.run
|
140
|
+
expect(plugin[:dmi][id][attribute]).to eql(value)
|
140
141
|
end
|
141
142
|
end
|
142
143
|
end
|
143
144
|
|
144
|
-
it "
|
145
|
-
|
146
|
-
|
145
|
+
it "allows capturing additional DMI data" do
|
146
|
+
Ohai.config[:additional_dmi_ids] = [ 16 ]
|
147
|
+
plugin.run
|
148
|
+
expect(plugin[:dmi]).to have_key(:physical_memory_array)
|
149
|
+
end
|
150
|
+
|
151
|
+
it "correctly ignores data in excluded DMI IDs" do
|
152
|
+
expect(plugin).to receive(:shell_out).with("dmidecode").and_return(mock_shell_out(0, stdout, ""))
|
153
|
+
plugin.run
|
154
|
+
expect(plugin[:dmi]).not_to have_key(:physical_memory_array)
|
147
155
|
end
|
148
156
|
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: 13.9.
|
4
|
+
version: 13.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04
|
11
|
+
date: 2018-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: systemu
|
@@ -227,6 +227,7 @@ files:
|
|
227
227
|
- lib/ohai/plugins/aix/virtualization.rb
|
228
228
|
- lib/ohai/plugins/azure.rb
|
229
229
|
- lib/ohai/plugins/bsd/filesystem.rb
|
230
|
+
- lib/ohai/plugins/bsd/filesystem2.rb
|
230
231
|
- lib/ohai/plugins/bsd/virtualization.rb
|
231
232
|
- lib/ohai/plugins/c.rb
|
232
233
|
- lib/ohai/plugins/chef.rb
|
@@ -409,6 +410,7 @@ files:
|
|
409
410
|
- spec/unit/plugins/aix/uptime_spec.rb
|
410
411
|
- spec/unit/plugins/aix/virtualization_spec.rb
|
411
412
|
- spec/unit/plugins/azure_spec.rb
|
413
|
+
- spec/unit/plugins/bsd/filesystem2_spec.rb
|
412
414
|
- spec/unit/plugins/bsd/filesystem_spec.rb
|
413
415
|
- spec/unit/plugins/bsd/virtualization_spec.rb
|
414
416
|
- spec/unit/plugins/c_spec.rb
|
@@ -541,7 +543,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
541
543
|
version: '0'
|
542
544
|
requirements: []
|
543
545
|
rubyforge_project:
|
544
|
-
rubygems_version: 2.7.
|
546
|
+
rubygems_version: 2.7.6
|
545
547
|
signing_key:
|
546
548
|
specification_version: 4
|
547
549
|
summary: Ohai profiles your system and emits JSON
|