ohai 6.24.0 → 6.24.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ea95d6137035fa5e4065985fda8ee793152bfb70
4
- data.tar.gz: b8f8ebc64d0d228542eca403be15715dae942e51
3
+ metadata.gz: 51f239fef7b893af29e810e6363de6cb6eb28677
4
+ data.tar.gz: 5603ac2d5ea2372cd70b49e6465060769740df92
5
5
  SHA512:
6
- metadata.gz: 0a2bd36af0e8368ec8dcf6e95ef9833e546a956ba84c839c711ad8708a790468d3d3782f428e1ed58f662e48a4e5a4cee0d068f90332af71311f1c40ea088c23
7
- data.tar.gz: cb3ec503e6c4fd6ec4d8aecaf338d5c3a1d2bcfc1b44bb98fd1eb8316dcc8579f739abd5dc8aad82fc53175c9627ebf49ed74046370a8344e23bd69d6b26a5b0
6
+ metadata.gz: 8e694af21f9642bffcb1b2e2505c9dcf4f9178290aa44b2e19c4e7ed84696b06371b2e7c2ea56ad1d414bff88c2cd0a51fdc8f870ae4ebe584cc46910dc004cf
7
+ data.tar.gz: 50630f4f45bc364aa753542e7184bd2c2b2b485bf08065a1964b224c8c47dbe4a281124e469bb79f4909d37c0e8558343b7193f916986925f21058f5f69e02aa
@@ -20,6 +20,14 @@ provides "filesystem"
20
20
 
21
21
  fs = Mash.new
22
22
 
23
+ def find_device(name)
24
+ %w{/dev /dev/mapper}.each do |dir|
25
+ path = File.join(dir, name)
26
+ return path if File.exist?(path)
27
+ end
28
+ name
29
+ end
30
+
23
31
  # Grab filesystem data from df
24
32
  # df often returns non-zero even when it has useful output, accept it.
25
33
  status, stdout, stderr = run_command(:command => "df -P",
@@ -68,8 +76,10 @@ popen4(cmd) do |pid, stdin, stdout, stderr|
68
76
  stdout.each do |line|
69
77
  if line =~ regex
70
78
  filesystem = $1
79
+ type = $2
80
+ filesystem = find_device(filesystem) unless filesystem.start_with?('/')
71
81
  fs[filesystem] = Mash.new unless fs.has_key?(filesystem)
72
- fs[filesystem][:fs_type] = $2
82
+ fs[filesystem][:fs_type] = type
73
83
  end
74
84
  end
75
85
  end
@@ -87,8 +97,10 @@ popen4(cmd) do |pid, stdin, stdout, stderr|
87
97
  stdout.each do |line|
88
98
  if line =~ regex
89
99
  filesystem = $1
100
+ uuid = $2
101
+ filesystem = find_device(filesystem) unless filesystem.start_with?('/')
90
102
  fs[filesystem] = Mash.new unless fs.has_key?(filesystem)
91
- fs[filesystem][:uuid] = $2
103
+ fs[filesystem][:uuid] = uuid
92
104
  end
93
105
  end
94
106
  end
@@ -106,8 +118,10 @@ popen4(cmd) do |pid, stdin, stdout, stderr|
106
118
  stdout.each do |line|
107
119
  if line =~ regex
108
120
  filesystem = $1
121
+ label = $2
122
+ filesystem = find_device(filesystem) unless filesystem.start_with?('/')
109
123
  fs[filesystem] = Mash.new unless fs.has_key?(filesystem)
110
- fs[filesystem][:label] = $2
124
+ fs[filesystem][:label] = label
111
125
  end
112
126
  end
113
127
  end
@@ -18,5 +18,5 @@
18
18
 
19
19
  module Ohai
20
20
  OHAI_ROOT = File.expand_path(File.dirname(__FILE__))
21
- VERSION = '6.24.0'
21
+ VERSION = '6.24.2'
22
22
  end
@@ -52,6 +52,21 @@ describe Ohai::System, "Linux filesystem plugin" do
52
52
  @ohai.stub!(:popen4).with("lsblk -r -o NAME,LABEL -n").and_return(false)
53
53
 
54
54
  File.stub!(:exists?).with("/proc/mounts").and_return(false)
55
+
56
+ %w{sdb1 sdb2 sda1 sda2 md0 md1 md2}.each do |name|
57
+ File.stub!(:exist?).with("/dev/#{name}").and_return(true)
58
+ end
59
+ %w{
60
+ sys.vg-root.lv
61
+ sys.vg-swap.lv
62
+ sys.vg-tmp.lv
63
+ sys.vg-usr.lv
64
+ sys.vg-var.lv
65
+ sys.vg-home.lv
66
+ }.each do |name|
67
+ File.stub!(:exist?).with("/dev/#{name}").and_return(false)
68
+ File.stub!(:exist?).with("/dev/mapper/#{name}").and_return(true)
69
+ end
55
70
  end
56
71
 
57
72
  describe "when gathering filesystem usage data from df" do
@@ -207,18 +222,18 @@ describe Ohai::System, "Linux filesystem plugin" do
207
222
  @status = 0
208
223
 
209
224
  @stdout.stub!(:each).
210
- and_yield("/dev/sdb1 linux_raid_member").
211
- and_yield("/dev/sdb2 linux_raid_member").
212
- and_yield("/dev/sda1 linux_raid_member").
213
- and_yield("/dev/sda2 linux_raid_member").
214
- and_yield("/dev/md0 ext3").
215
- and_yield("/dev/md1 LVM2_member").
216
- and_yield("/dev/mapper/sys.vg-root.lv ext4").
217
- and_yield("/dev/mapper/sys.vg-swap.lv swap").
218
- and_yield("/dev/mapper/sys.vg-tmp.lv ext4").
219
- and_yield("/dev/mapper/sys.vg-usr.lv ext4").
220
- and_yield("/dev/mapper/sys.vg-var.lv ext4").
221
- and_yield("/dev/mapper/sys.vg-home.lv xfs")
225
+ and_yield("sdb1 linux_raid_member").
226
+ and_yield("sdb2 linux_raid_member").
227
+ and_yield("sda1 linux_raid_member").
228
+ and_yield("sda2 linux_raid_member").
229
+ and_yield("md0 ext3").
230
+ and_yield("md1 LVM2_member").
231
+ and_yield("sys.vg-root.lv ext4").
232
+ and_yield("sys.vg-swap.lv swap").
233
+ and_yield("sys.vg-tmp.lv ext4").
234
+ and_yield("sys.vg-usr.lv ext4").
235
+ and_yield("sys.vg-var.lv ext4").
236
+ and_yield("sys.vg-home.lv xfs")
222
237
  end
223
238
 
224
239
  it "should run lsblk -r -o NAME,FSTYPE -n" do
@@ -273,18 +288,18 @@ describe Ohai::System, "Linux filesystem plugin" do
273
288
  @status = 0
274
289
 
275
290
  @stdout.stub!(:each).
276
- and_yield("/dev/sdb1 bd1197e0-6997-1f3a-e27e-7801388308b5").
277
- and_yield("/dev/sdb2 e36d933e-e5b9-cfe5-6845-1f84d0f7fbfa").
278
- and_yield("/dev/sda1 bd1197e0-6997-1f3a-e27e-7801388308b5").
279
- and_yield("/dev/sda2 e36d933e-e5b9-cfe5-6845-1f84d0f7fbfa").
280
- and_yield("/dev/md0 37b8de8e-0fe3-4b5a-b9b4-dde33e19bb32").
281
- and_yield("/dev/md1 YsIe0R-fj1y-LXTd-imla-opKo-OuIe-TBoxSK").
282
- and_yield("/dev/mapper/sys.vg-root.lv 7742d14b-80a3-4e97-9a32-478be9ea9aea").
283
- and_yield("/dev/mapper/sys.vg-swap.lv 9bc2e515-8ddc-41c3-9f63-4eaebde9ce96").
284
- and_yield("/dev/mapper/sys.vg-tmp.lv 74cf7eb9-428f-479e-9a4a-9943401e81e5").
285
- and_yield("/dev/mapper/sys.vg-usr.lv 26ec33c5-d00b-4f88-a550-492def013bbc").
286
- and_yield("/dev/mapper/sys.vg-var.lv 6b559c35-7847-4ae2-b512-c99012d3f5b3").
287
- and_yield("/dev/mapper/sys.vg-home.lv d6efda02-1b73-453c-8c74-7d8dee78fa5e")
291
+ and_yield("sdb1 bd1197e0-6997-1f3a-e27e-7801388308b5").
292
+ and_yield("sdb2 e36d933e-e5b9-cfe5-6845-1f84d0f7fbfa").
293
+ and_yield("sda1 bd1197e0-6997-1f3a-e27e-7801388308b5").
294
+ and_yield("sda2 e36d933e-e5b9-cfe5-6845-1f84d0f7fbfa").
295
+ and_yield("md0 37b8de8e-0fe3-4b5a-b9b4-dde33e19bb32").
296
+ and_yield("md1 YsIe0R-fj1y-LXTd-imla-opKo-OuIe-TBoxSK").
297
+ and_yield("sys.vg-root.lv 7742d14b-80a3-4e97-9a32-478be9ea9aea").
298
+ and_yield("sys.vg-swap.lv 9bc2e515-8ddc-41c3-9f63-4eaebde9ce96").
299
+ and_yield("sys.vg-tmp.lv 74cf7eb9-428f-479e-9a4a-9943401e81e5").
300
+ and_yield("sys.vg-usr.lv 26ec33c5-d00b-4f88-a550-492def013bbc").
301
+ and_yield("sys.vg-var.lv 6b559c35-7847-4ae2-b512-c99012d3f5b3").
302
+ and_yield("sys.vg-home.lv d6efda02-1b73-453c-8c74-7d8dee78fa5e")
288
303
  end
289
304
 
290
305
  it "should run lsblk -r -o NAME,UUID -n" do
@@ -344,16 +359,16 @@ describe Ohai::System, "Linux filesystem plugin" do
344
359
  @status = 0
345
360
 
346
361
  @stdout.stub!(:each).
347
- and_yield("/dev/sda1 fuego:0").
348
- and_yield("/dev/sda2 fuego:1").
349
- and_yield("/dev/sdb1 fuego:0").
350
- and_yield("/dev/sdb2 fuego:1").
351
- and_yield("/dev/md0 /boot").
352
- and_yield("/dev/mapper/sys.vg-root.lv /").
353
- and_yield("/dev/mapper/sys.vg-tmp.lv /tmp").
354
- and_yield("/dev/mapper/sys.vg-usr.lv /usr").
355
- and_yield("/dev/mapper/sys.vg-var.lv /var").
356
- and_yield("/dev/mapper/sys.vg-home.lv /home")
362
+ and_yield("sda1 fuego:0").
363
+ and_yield("sda2 fuego:1").
364
+ and_yield("sdb1 fuego:0").
365
+ and_yield("sdb2 fuego:1").
366
+ and_yield("md0 /boot").
367
+ and_yield("sys.vg-root.lv /").
368
+ and_yield("sys.vg-tmp.lv /tmp").
369
+ and_yield("sys.vg-usr.lv /usr").
370
+ and_yield("sys.vg-var.lv /var").
371
+ and_yield("sys.vg-home.lv /home")
357
372
  end
358
373
 
359
374
  it "should run lsblk -r -o NAME,LABEL -n" do
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: 6.24.0
4
+ version: 6.24.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: 2014-08-19 00:00:00.000000000 Z
11
+ date: 2014-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: systemu