specinfra 2.36.0 → 2.36.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba72337ccaf4712a530e15f891406045d124b271
4
- data.tar.gz: 273a5118e176f1bc48aa8057b6c4e46b3eadf20d
3
+ metadata.gz: 33d250fa8ec84232dcd3ef0fd643b99a3f25bc92
4
+ data.tar.gz: ee2a46276a98c8df0bc31b30580ab236073fa647
5
5
  SHA512:
6
- metadata.gz: d63e38da22c28976d54e5b33f75a6f433862b0ccc2f1e1406898c29c87e6108309fd48ea5e8673de1339726e745472d73990c9c997836eba262e68870e06628e
7
- data.tar.gz: 4e078c7326cf195ea3392c5f211279d29638069bbca6239d85254e863d13ee5ea496563ceeb6e9e948f48724fc0de1c7f3ef7398bf6646233aa8ada548d6415f
6
+ metadata.gz: 1d0d51a27f089c575df76fe87868004a1f1f7b485dcc1282913928684178e888330c4b1a06d523de141dd7110df95482d97a3a35fd4f2a7592bb6dbbb522802d
7
+ data.tar.gz: ec36da9d90d0c3563a21dd29adae8f6c86cbea38cb06254d29e199f731c9e5199f47fbb975467d0a35f351b378fe63a0fbc039ed0b1609387fbab9a0a5ae8883
@@ -3,8 +3,12 @@ module Specinfra
3
3
  class Filesystem < Base
4
4
  def get
5
5
  cmd = backend.command.get(:get_inventory_filesystem)
6
+ ret = backend.run_command(cmd).stdout.lines
7
+ parse(ret)
8
+ end
9
+ def parse(ret)
6
10
  filesystem = {}
7
- backend.run_command(cmd).stdout.lines do |line|
11
+ ret.each do |line|
8
12
  next if line =~ /^Filesystem\s+/
9
13
  if line =~ /^(.+?)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+\%)\s+(.+)$/
10
14
  device = $1
@@ -1,3 +1,3 @@
1
1
  module Specinfra
2
- VERSION = "2.36.0"
2
+ VERSION = "2.36.1"
3
3
  end
@@ -0,0 +1,53 @@
1
+ require 'spec_helper'
2
+
3
+ str = <<-EOH
4
+ Filesystem 1024-blocks Used Available Capacity Mounted on
5
+ /dev/mapper/vg_idefix-lv_root 51475068 8840540 40013088 19% /
6
+ tmpfs 509696 872 508824 1% /dev/shm
7
+ /dev/sdb3 487652 124828 337224 28% /boot
8
+ /dev/mapper/vg_idefix-lv_home 20857444 17905852 1885404 91% /home
9
+ EOH
10
+
11
+
12
+ describe Specinfra::HostInventory::Filesystem do
13
+ let(:host_inventory) { nil }
14
+ describe 'Example of CentOS 6.6 Kernel version 2.6.32-504.23.4.el6.i686' do
15
+ ret = Specinfra::HostInventory::Filesystem.new(host_inventory).parse(str.split(/\n/))
16
+ example do
17
+ expect(ret["/dev/mapper/vg_idefix-lv_root"]).to include(
18
+ "kb_used" => "8840540",
19
+ "kb_size" => "51475068",
20
+ "kb_available" => "40013088",
21
+ "mount" => "/",
22
+ "percent_used" => "19%"
23
+ )
24
+ end
25
+ example do
26
+ expect(ret["/dev/sdb3"]).to include(
27
+ "kb_used" => "124828",
28
+ "kb_size" => "487652",
29
+ "kb_available" => "337224",
30
+ "mount" => "/boot",
31
+ "percent_used" => "28%"
32
+ )
33
+ end
34
+ example do
35
+ expect(ret["tmpfs"]).to include(
36
+ "kb_used" => "872",
37
+ "kb_size" => "509696",
38
+ "kb_available" => "508824",
39
+ "mount" => "/dev/shm",
40
+ "percent_used" => "1%"
41
+ )
42
+ end
43
+ example do
44
+ expect(ret["/dev/mapper/vg_idefix-lv_home"]).to include(
45
+ "kb_used" => "17905852",
46
+ "kb_size" => "20857444",
47
+ "kb_available" => "1885404",
48
+ "mount" => "/home",
49
+ "percent_used" => "91%"
50
+ )
51
+ end
52
+ end
53
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specinfra
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.36.0
4
+ version: 2.36.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gosuke Miyashita
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-16 00:00:00.000000000 Z
11
+ date: 2015-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh
@@ -435,6 +435,7 @@ files:
435
435
  - spec/helper/properties_spec.rb
436
436
  - spec/helper/set_spec.rb
437
437
  - spec/host_inventory/cpu_spec.rb
438
+ - spec/host_inventory/filesystem_spec.rb
438
439
  - spec/spec_helper.rb
439
440
  - specinfra.gemspec
440
441
  homepage: ''
@@ -504,4 +505,5 @@ test_files:
504
505
  - spec/helper/properties_spec.rb
505
506
  - spec/helper/set_spec.rb
506
507
  - spec/host_inventory/cpu_spec.rb
508
+ - spec/host_inventory/filesystem_spec.rb
507
509
  - spec/spec_helper.rb