ohai 8.25.0 → 8.25.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ohai/plugins/linux/mdadm.rb +9 -1
- data/lib/ohai/version.rb +1 -1
- data/spec/unit/plugins/linux/mdadm_spec.rb +39 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a1b3302250943cf188557ec78a2f4680599ba9a
|
4
|
+
data.tar.gz: 02bce3c0c52a84b45a434ef78804f4f33e341333
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6dbc95ed3640a4ae09726ae2e6dcd7895fd6470110c72539fdb8f0383a535cfcac6a03bc71397c1ef64651611ee244e696d7094e9dbce3d266452e8a71eaceee
|
7
|
+
data.tar.gz: 98806579f7b734f843fdcdbf1c636ee8da12be4d295078e1ca6742c13a9f708470157de4e392a19944301ca6e90de850e5dc0f7d5dbc263c396cee5af57bb0c7
|
@@ -59,7 +59,15 @@ Ohai.plugin(:Mdadm) do
|
|
59
59
|
if line =~ /(md[0-9]+)/
|
60
60
|
device = Regexp.last_match[1]
|
61
61
|
pieces = line.split(/\s+/)
|
62
|
-
|
62
|
+
# there are variable numbers of fields until you hit the raid level
|
63
|
+
# everything after that is members...
|
64
|
+
# unless the array is inactive, in which case you don't get a raid
|
65
|
+
# level.
|
66
|
+
members = pieces.drop_while { |x| !x.start_with?("raid", "inactive") }
|
67
|
+
# drop the 'raid' too
|
68
|
+
|
69
|
+
members.shift unless members.empty?
|
70
|
+
devices[device] = members.map { |s| s.match(/(.+)\[\d+\]/)[1] }
|
63
71
|
end
|
64
72
|
end
|
65
73
|
|
data/lib/ohai/version.rb
CHANGED
@@ -105,6 +105,45 @@ MD
|
|
105
105
|
%w{sdc sdd sde sdf sdg sdh}
|
106
106
|
)
|
107
107
|
end
|
108
|
+
|
109
|
+
it "should detect member devices even if there are multi-digit numbers" do
|
110
|
+
new_mdstat = double("/proc/mdstat2")
|
111
|
+
allow(new_mdstat).to receive(:each).
|
112
|
+
and_yield("Personalities : [raid1] [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid10]").
|
113
|
+
and_yield("md0 : active raid10 sdj[2010] sdi[99] sdh[5] sdg[4] sdf[3] sde[2] sdd[1] sdc[0]").
|
114
|
+
and_yield(" 2929893888 blocks super 1.2 256K chunks 2 near-copies [6/6] [UUUUUU]")
|
115
|
+
allow(File).to receive(:open).with("/proc/mdstat").and_return(new_mdstat)
|
116
|
+
|
117
|
+
@plugin.run
|
118
|
+
expect(@plugin[:mdadm][:md0][:members].sort).to eq(
|
119
|
+
%w{sdc sdd sde sdf sdg sdh sdi sdj}
|
120
|
+
)
|
121
|
+
end
|
122
|
+
|
123
|
+
it "should detect member devices even if mdstat has extra entries" do
|
124
|
+
new_mdstat = double("/proc/mdstat2")
|
125
|
+
allow(new_mdstat).to receive(:each).
|
126
|
+
and_yield("Personalities : [raid1] [raid6] [raid5] [raid4] [linear] [multipath] [raid0] [raid10]").
|
127
|
+
and_yield("md0 : active (somecraphere) <morestuff> raid10 sdh[5] sdg[4] sdf[3] sde[2] sdd[1] sdc[0]").
|
128
|
+
and_yield(" 2929893888 blocks super 1.2 256K chunks 2 near-copies [6/6] [UUUUUU]")
|
129
|
+
allow(File).to receive(:open).with("/proc/mdstat").and_return(new_mdstat)
|
130
|
+
|
131
|
+
@plugin.run
|
132
|
+
expect(@plugin[:mdadm][:md0][:members].sort).to eq(
|
133
|
+
%w{sdc sdd sde sdf sdg sdh}
|
134
|
+
)
|
135
|
+
end
|
136
|
+
|
137
|
+
it "should accurately report inactive arrays" do
|
138
|
+
new_mdstat = double("/proc/mdstat_inactive")
|
139
|
+
allow(new_mdstat).to receive(:each).
|
140
|
+
and_yield("Personalities :").
|
141
|
+
and_yield("md0 : inactive nvme2n1p3[2](S)")
|
142
|
+
allow(File).to receive(:open).with("/proc/mdstat").and_return(new_mdstat)
|
143
|
+
|
144
|
+
@plugin.run
|
145
|
+
expect(@plugin[:mdadm][:md0][:members].sort).to eq(%w{nvme2n1p3})
|
146
|
+
end
|
108
147
|
end
|
109
148
|
|
110
149
|
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.25.
|
4
|
+
version: 8.25.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: systemu
|