Sha256: 8fe3e92858c88fc4692a9cfb88282ec41ef409ae3e1d507e491fcf75a7d75a9b

Contents?: true

Size: 786 Bytes

Versions: 4

Compression:

Stored size: 786 Bytes

Contents

module Specinfra
  class HostInventory
    class Filesystem < Base
      def get
        cmd = backend.command.get(:get_inventory_filesystem)
        ret = backend.run_command(cmd).stdout.lines
        parse(ret)
      end
      def parse(ret)
        filesystem = {}
        ret.each do |line|
          next if line =~ /^Filesystem\s+/
          if line =~ /^(.+?)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+\%)\s+(.+)$/
            device = $1
            filesystem[device] = {}
            filesystem[device]['kb_size'] = $2
            filesystem[device]['kb_used'] = $3
            filesystem[device]['kb_available'] = $4
            filesystem[device]['percent_used'] = $5
            filesystem[device]['mount'] = $6
          end
        end
        filesystem
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
specinfra-2.36.4 lib/specinfra/host_inventory/filesystem.rb
specinfra-2.36.3 lib/specinfra/host_inventory/filesystem.rb
specinfra-2.36.2 lib/specinfra/host_inventory/filesystem.rb
specinfra-2.36.1 lib/specinfra/host_inventory/filesystem.rb